lgvr123 / musescore-workoutbuilder

MuseScore plugin for building sheets with chord progression workouts
6 stars 0 forks source link

plugin not visible in plugin manager #2

Closed hanslub42 closed 1 year ago

hanslub42 commented 1 year ago

I unpacked the latest released .zip file into a plugin directory, but the plugin remains invisible in the plugin manager

instead, musescore prints on its stderr:

file:///usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/NiceComboBox.qml:unknown: file:///usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/NiceComboBox.qml:11: ReferenceError: text is not defined
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/SmallButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/NiceRadioButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/ImageButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/workoutbuilder.qml>
unknown:unknown: QQmlComponent: Component is not ready
unknown:unknown: creating component </usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/workoutbuilder.qml> failed
unknown:unknown:    line 12: Script file:///usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/chordanalyser.js unavailable
unknown:unknown:    line 592: Expected token `,'
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/musescore-workoutbuilder-2.4.0/workoutbuilder/SmallCheckBox.qml>

I use musescore 3.6.2 and qtdeclarative 5.15.8 (if that's relevant at all...)

lgvr123 commented 1 year ago

Actually, this must be unzipped to /usr/share/mscore-3.6/plugins/workoutbuilder/xxx qml

hanslub42 commented 1 year ago

Thank you for the reply! I'm sorry, but I am afraid I still don't understand (what should xxx be?)

Unzipping musescore-workoutbuilder-2.4.0.zip results in one folder musescore-workoutbuilder-2.4.0 that contans a subfolder workoutbuilder

Moving this folder to a plugin directory doesn't work. Moving the subfolder workoutbuilder there doesn't work either. Moving the contents of that folder there also doesn't work (and is not recommended anyawy because of name collisions)

musescore clearly reads the .qml files in the plugin (as witnessed by the error messages).

lgvr123 commented 1 year ago

After unzipping, you should have this:

 Directory of D:\data\MuseScore3\Plugins\workoutbuilder

[.]                      [..]                     about.svg
cancel.svg               chordanalyser.js         chorddown.png
chordup.png              copy.svg                 down.png
download.svg             edittext.svg             grid.png
ImageButton.qml          logo.png                 loopat-1.png
loopat1.png              NiceComboBox.qml         NiceRadioButton.qml
none.png                 notehelper.js            paste.svg
remove.svg               reverse.png              selectionhelper.js
SmallButton.qml          SmallCheckBox.qml        triadedown.png
triadeup.png             up.png                   upload.svg
workoutbuilder.library   workoutbuilder.qml       

Don't forget to to go Plugins | Plugin Manager | Reload Plugins.

I've just tested the packaging in a bare folder and it is working as expected.

hanslub42 commented 1 year ago

Thanks again! This is one of the configurations I tried, but to no avail.

But I noticed a lot of error messages like:

unknown:unknown: creating component </usr/share/mscore-3.6/plugins/workoutbuilder/workoutbuilder.qml> failed                                        
unknown:unknown:    line 2945: Cannot override FINAL property

By blindly commenting out the offending lines (there are several) I can get the plugin to appear in the menu, and even load, although (not surprisingly, after such vandalism) it doesn't really work (it refuses to create a score)

But this shows that there probably is a version skew problem somewhere. I am not current with QtQuick and its JavaScript implementation, so I cannot really diagnose what might be going on.

My setup:

lgvr123 commented 1 year ago

What do you have at line 2945 ? Because in the latest version, the line 2945 is an empty line !! https://github.com/lgvr123/musescore-workoutbuilder/blob/master/workoutbuilder/workoutbuilder.qml#L2945

For the sake of it, I just tested the last available version from GitHub in Ubuntu + MuseScore 3.6.2, and it is working like a charm.

In order to isolate the issue, I would

  1. Create a new empty plugin folder and tell to MuseScore that this is the new plugin folder. E.g. /usr/share/mscore-3.6/pluginsTest/
  2. Download the latest version from GitHub and unzip it that folder, leading to having all the files in the folder "/usr/share/mscore-3.6/pluginsTest/workoutbuilder/"
  3. In MuseScore, reload the plugin
  4. In the Plugin Creator, open and start "workoutbuilder/workoutbuilder.qml"
  5. Report me the errors if any.
hanslub42 commented 1 year ago

What do you have at line 2945 ? Because in the latest version, the line 2945 is an empty line !!

I started with adding some empty lines in workoutbuilder.qml in order to verify that the offending line number would change, and hence the offending lines are in that file (The MuseScore error messages are not crystal clear in that respect) This would have moved the lines around a bit. If I remember well, the offending line was originally #2943 (textRole: "text") which I simply commented out.

In order to isolate the issue, I would [...]

I did what you suggested, and got the very same error messages I cited in my original report:

file:///usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/NiceComboBox.qml:unknown: file:///usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/NiceComboBox.qml:11: ReferenceError: text is not defined
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/SmallButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/NiceRadioButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/ImageButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/workoutbuilder.qml>
unknown:unknown: QQmlComponent: Component is not ready
unknown:unknown: creating component </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/workoutbuilder.qml> failed
unknown:unknown:    line 12: Script file:///usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/chordanalyser.js unavailable
unknown:unknown:    line 592: Expected token `,'
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/SmallCheckBox.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/NiceComboBox.qml>

Opening workoutbuilder.qml in Plugin Creator, and then clicking "Run", results in a similar error message

Running…
Creating component failed
   line 12: Script file:///usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/chordanalyser.js unavailable
   line 592: Expected token `,'
lgvr123 commented 1 year ago

> In order to isolate the issue, I would [...] I did what you suggested, and got the very same error messages I cited in my original report:

You have NOT done precisely what I suggested !!

Here is the path where you have unzipped the plugin's content: /usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/workoutbuilder.qml

This is where I suggested you to do it: /usr/share/mscore-3.6/pluginsTest/workoutbuilder/workoutbuilder.qml

Spot the difference. Yours "mscore-3.6/plugins/pluginTest/", Mine: "mscore-3.6/pluginTest/"

Please retry exactly how I suggested you and do precisely the 5 steps.

hanslub42 commented 1 year ago

It doesn't make any difference, I get the very same error messages

In general, I can move my other plugins to any subdirectory inside the plugin directory (i.e. the directory I specified as such in the preferences) and Musescore will find and read it.

And please don't yell. Closing.

lgvr123 commented 1 year ago

Sorry for what appeared as yelling ! It was merely some emphasis ...

It is pretty difficult to debug a code when you can't reproduce the issue locally. So better follow exactly the proposed steps, so we could eliminate all possible causes one by one.

What is the code you have in "chordanalyser.js", line 592 ?

Running…
Creating component failed
   line 12: Script file:///usr/share/mscore-3.6/plugins/pluginTest/workoutbuilder/chordanalyser.js unavailable
   line 592: Expected token `,'
hanslub42 commented 1 year ago

OK, I understand....

What is the code you have in "chordanalyser.js", line 592 ?

The same as what is linked to above ( "note":idx,). In context:

    this.allnotes = (!allnotes || (allnotes == null)) ? default_names.map(function (role, idx) { {
            "note": idx,
            "role": role
        }
    }) : allnotes;

This looks like legal JavaScript to me, so why does it complain about a syntax error?

hanslub42 commented 1 year ago

workoutbuilder requires QtQuick.Dialogs, which means it is using qtquickcontrols, as qtquickcontrols2 doesn't have that module (see https://doc.qt.io/qt-5/qtquickcontrols2-differences.html)

On Gentoo, qtquickcontrols is marked as "deprecated" and possibly not up-to-date anymore.

Having both qtquickcontrols and qtquickcontrols2 installed is possible (but probably a bad idea) on Gentoo (they go into different directories)

This makes many other plugins invisible, and results in the strange error messages for workoutbuilder.

Removing qtquickcontrols makes those other plugins suddenly visible, but makes workoutbuilder complain: module "QtQuick.Dialogs" is not installed

Removing qtquickcontrols2 is not possible, as musescore requires it (at least on Gentoo)

It is still strange that it all works on Ubuntu (which should have the same problem), so I must be missing something here.

lgvr123 commented 1 year ago

Please check the code in the branch Issue#2.

Actually, some times ago I detected minor issues in the "chordanalyser.js" file as well as in the other subcomponents. None of them were critical in my Windows and my Ubutnu environments so I didn't deployed them and ended up by forgetting about them :-( . One of these improvements is related to this "chordanalyser.js", line 592 issue. Others to the (a.o) NiceCombBox.qml subcomponent I saw in your log.

I hope this will fix your issues.

Thanks for this analyse about the QML libraries conflicts. I will look at this. MS is a bit a mess about this. I'll investigate this to see if that could explain why some of plugin don't look nice in MS4.

hanslub42 commented 1 year ago

With both qtquickcontrols and qtquickcontrols2 installed, I get

unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboBox.qml>
file:///usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboBox.qml:unknown: file:///usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboBox.qml:11: ReferenceError: text is not defined
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/SmallButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceRadioButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/ImageButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/workoutbuilder.qml>
unknown:unknown: QQmlComponent: Component is not ready
unknown:unknown: creating component </usr/share/mscore-3.6/pluginsTest/workoutbuilder/workoutbuilder.qml> failed
unknown:unknown:    line 12: Script file:///usr/share/mscore-3.6/pluginsTest/workoutbuilder/chordanalyser.js unavailable
unknown:unknown:    line 592: Expected token `,'
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/SmallCheckBox.qml>

With qtquickcontrols removed (and only qtquickcontrols2 installed), I get

Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboBox.qml>
file:///usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboBox.qml:unknown: file:///usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboB
ox.qml:11: ReferenceError: text is not defined                        
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/SmallButton.qml>                            
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceRadioButton.qml>
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/ImageButton.qml>                                     
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/workoutbuilder.qml>
unknown:unknown: QQmlComponent: Component is not ready                                                                                              
unknown:unknown: creating component </usr/share/mscore-3.6/pluginsTest/workoutbuilder/workoutbuilder.qml> failed
unknown:unknown:    line 6: module "QtQuick.Controls.Styles" is not installed                                                            
unknown:unknown:    line 5: module "QtQuick.Dialogs" is not installed 
unknown:unknown:    line 6: module "QtQuick.Controls.Styles" is not installed                                                   
unknown:unknown:    line 5: module "QtQuick.Dialogs" is not installed
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/SmallCheckBox.qml>                                   
unknown:unknown: Collect meta for </usr/share/mscore-3.6/pluginsTest/workoutbuilder/NiceComboBox.qml>
lgvr123 commented 1 year ago

The first error log is "correct". Thus this is the right configuration with qml libraries. However, this log is correct for the previous version. Not the last one I posted earlier today. Are you sure you have downloaded the right code ? I haven't made a new release for that !!! You have to download the source code directly : donwloadIssue2

hanslub42 commented 1 year ago

Yes, you're right, I used git clone but forgot to checkout Issue#2

I'm occupied now, but will report back!

hanslub42 commented 1 year ago

OK, I checked out branch Issue#2 and everything works!

If I remove qtquickcontrols (and leave only qtquickcontrols2 then workoutbuilder becomes unavailable again , with error messages like:

unknown:unknown: creating component </usr/share/mscore-3.6/pluginsTest/musescore-workoutbuilder/workoutbuilder/workoutbuilder.qml> failed
unknown:unknown:    line 3988: Type Dialog unavailable

But that is a minor hassle, as qtquickcontrols and qtquickcontrols2 can coexist

I will make a report on the Gentoo bugtracker, warning that Musescore itself can live without version 1 of qtquickcontrols but that some plugins may need it anyway.

Thanks for fixing this!

lgvr123 commented 1 year ago

Glad it worked. I'll push the correction to the main branch.