Mscore Plugin and QTScript

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Mscore Plugin and QTScript

lasconic
Administrator
Hi !
I'm still trying to create a plugin for musescore using the QtScript plugin framework.
For now, I face two major problems :

- I don't manage to understand how signals work with qtscript. I attach my js script and an ui file I created with QtDesigner. I don't manage to access the value of the fields defined in the form. I'm a Qt ultra newbie... Do you mind taking a look  ?

- No ui binder on windows so no dialog. On windows, the dialog does not even show up. In fact, it's because ui and uitools bindings are not build for windows. If I understand well what you explained to me,  the problem is that on windows, Qt dlls by trolltech are compiled with GCC3.XX and MuseScore is built with GCC4.XX. That prevents the linking of the ui and uitools dlls during the building on mscore for windows on linux. Building MScore with GCC.3XX results in more problems... Building Qt with GCC4 on Windows seems hard too. I'm stuck...

Lasconic

PS : for now authentication2.ui needs to be int the directory where you launch mscore.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer

wikifonia.js (2K) Download Attachment
authentification2.ui (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Mscore Plugin and QTScript

wschweer
Administrator
On Mittwoch 18 Juni 2008, Lasconic wrote:
> Hi !
> I'm still trying to create a plugin for musescore using the QtScript plugin
> framework.
> For now, I face two major problems :
>
> - I don't manage to understand how signals work with qtscript. I attach my
> js script and an ui file I created with QtDesigner. I don't manage to access
> the value of the fields defined in the form. I'm a Qt ultra newbie... Do you
> mind taking a look  ?

I think after leaving the "run" function (form.show() is last statement)
the script is finished and no further processing of signals take place.
After changing the form.show() into form.exe() (making the dialog modal),
the slots are called and you can read the form values.

function run()
      {
      var loader = new QUiLoader(null);
      var file = new QFile("authentification2.ui");
      file.open(QIODevice.OpenMode(QIODevice.ReadOnly, QIODevice.Text));
      var form = loader.load(file,null);

      try {
            form.buttonBox.accepted.connect(accept);
            form.buttonBox.rejected.connect(reject);
            }
      catch(e) {
            print(e);
            }
      form.exec();
      print("login:");
      print(form.login.text);
      print("passwd:");
      print(form.password.text);
      print("exit");
      }

>
> - No ui binder on windows so no dialog. On windows, the dialog does not even
> show up. In fact, it's because ui and uitools bindings are not build for
> windows. If I understand well what you explained to me,  the problem is that
> on windows, Qt dlls by trolltech are compiled with GCC3.XX and MuseScore is
> built with GCC4.XX. That prevents the linking of the ui and uitools dlls
> during the building on mscore for windows on linux. Building MScore with
> GCC.3XX results in more problems... Building Qt with GCC4 on Windows seems
> hard too. I'm stuck...

i also tried compiling mscore with gcc3 but without luck. Maybe building
qt with gcc4 on windows works better but i did not tried so far.

Werner



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Mscore Plugin and QTScript

lasconic
Administrator
Hi !
I try this. I think you are right. The run fonction finishes too early...
So using exec makes it waits until the moment the user click on OK. But then it's finished.
So when I use your code I got :
"login :" and that's all...

I also have a call to accept function.(accept is printed) So maybe I can do something there as it is called by exec(). Doing things after exec seems to be not OK...

Next question, how can I access "form" in the accept function ?

Thks !

Lasconic




I think after leaving the "run" function (form.show() is last statement)
the script is finished and no further processing of signals take place.
After changing the form.show() into form.exe() (making the dialog modal),
the slots are called and you can read the form values.

function run()
     {
     var loader = new QUiLoader(null);
     var file = new QFile("authentification2.ui");
     file.open(QIODevice.OpenMode(QIODevice.ReadOnly, QIODevice.Text));
     var form = loader.load(file,null);

     try {
           form.buttonBox.accepted.connect(accept);
           form.buttonBox.rejected.connect(reject);
           }
     catch(e) {
           print(e);
           }
     form.exec();
     print("login:");
     print(form.login.text);
     print("passwd:");
     print(form.password.text);
     print("exit");
     }

>




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Mscore Plugin and QTScript

lasconic
Administrator

I'm wrong... Doing things after exec is of course OK ! The problem is that it fails for me ...
It fails on print(form.login.text);
with error (thanks to the debugger :)) TypeError: not an object

Weird ...

Lasconic


2008/6/19 Lasconic <[hidden email]>:
Hi !
I try this. I think you are right. The run fonction finishes too early...
So using exec makes it waits until the moment the user click on OK. But then it's finished.
So when I use your code I got :
"login :" and that's all...

I also have a call to accept function.(accept is printed) So maybe I can do something there as it is called by exec(). Doing things after exec seems to be not OK...

Next question, how can I access "form" in the accept function ?

Thks !

Lasconic





I think after leaving the "run" function (form.show() is last statement)
the script is finished and no further processing of signals take place.
After changing the form.show() into form.exe() (making the dialog modal),
the slots are called and you can read the form values.

function run()
     {
     var loader = new QUiLoader(null);
     var file = new QFile("authentification2.ui");
     file.open(QIODevice.OpenMode(QIODevice.ReadOnly, QIODevice.Text));
     var form = loader.load(file,null);

     try {
           form.buttonBox.accepted.connect(accept);
           form.buttonBox.rejected.connect(reject);
           }
     catch(e) {
           print(e);
           }
     form.exec();
     print("login:");
     print(form.login.text);
     print("passwd:");
     print(form.password.text);
     print("exit");
     }

>





-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Mscore Plugin and QTScript

lasconic
Administrator

And it works :) Thks for your help !
The good syntax is print(form.gridLayout.login.text);
I was not aware that in Qt layout are part of the tree...



2008/6/19 Lasconic <[hidden email]>:

I'm wrong... Doing things after exec is of course OK ! The problem is that it fails for me ...
It fails on print(form.login.text);
with error (thanks to the debugger :)) TypeError: not an object

Weird ...

Lasconic


2008/6/19 Lasconic <[hidden email]>:

Hi !
I try this. I think you are right. The run fonction finishes too early...
So using exec makes it waits until the moment the user click on OK. But then it's finished.
So when I use your code I got :
"login :" and that's all...

I also have a call to accept function.(accept is printed) So maybe I can do something there as it is called by exec(). Doing things after exec seems to be not OK...

Next question, how can I access "form" in the accept function ?

Thks !

Lasconic





I think after leaving the "run" function (form.show() is last statement)
the script is finished and no further processing of signals take place.
After changing the form.show() into form.exe() (making the dialog modal),
the slots are called and you can read the form values.

function run()
     {
     var loader = new QUiLoader(null);
     var file = new QFile("authentification2.ui");
     file.open(QIODevice.OpenMode(QIODevice.ReadOnly, QIODevice.Text));
     var form = loader.load(file,null);

     try {
           form.buttonBox.accepted.connect(accept);
           form.buttonBox.rejected.connect(reject);
           }
     catch(e) {
           print(e);
           }
     form.exec();
     print("login:");
     print(form.login.text);
     print("passwd:");
     print(form.password.text);
     print("exit");
     }

>






-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Mscore Plugin and QTScript

wschweer
Administrator
In reply to this post by lasconic
On Donnerstag 19 Juni 2008, Lasconic wrote:

> Hi !
> I try this. I think you are right. The run fonction finishes too early...
> So using exec makes it waits until the moment the user click on OK. But then
> it's finished.
> So when I use your code I got :
> "login :" and that's all...
>
> I also have a call to accept function.(accept is printed) So maybe I can do
> something there as it is called by exec(). Doing things after exec seems to
> be not OK...
>
> Next question, how can I access "form" in the accept function ?

"form" must be some kind if global variable. But you dont need the
accept or reject functions as form.exec() should return a code which indicates
"accepted" or "rejected".

Werner



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Mscore Plugin and QTScript

lasconic
Administrator



Indeed ! form.exec() return 1 if OK and 0 if KO.


"form" must be some kind if global variable. But you dont need the
accept or reject functions as form.exec() should return a code which indicates
"accepted" or "rejected".

Werner



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer