Is plugin running?
Is there a way to find out is plugin running?
To prevent the situation on the picture.
if (myPlugingIsRunning ()) Qt.quit();
Attachment | Size |
---|---|
Ms_multiPlug.jpg | 68.23 KB |
Is there a way to find out is plugin running?
To prevent the situation on the picture.
if (myPlugingIsRunning ()) Qt.quit();
Attachment | Size |
---|---|
Ms_multiPlug.jpg | 68.23 KB |
Do you still have an unanswered question? Please log in first to post your question.
Comments
I don't believe there really is at the moment.
Adding a singleton property to a plugin and have MuseScore track the instances might be a future option (feature request).
As a probably workaround (untested, just sprouting the idea here) you could try the following:
* have a Settings object with an alreadyRunning property
* as one of the first things in onRun, check for the property to be
false
* if it is
true
do aQt.quit();
(perhaps show a warning first?)* next set that property to
true
and save it* make sure to set the property to
false
again in each possible path that quits your plugin.In reply to I don't believe there really by jeetee
Thank you for idea, jeetee!
Unfortunately for now I don't know how to save Setting not automatically at program quit but when I want. And how to use Setting for saving not properties, but variables. (doc.qt.io/qt-5/qml-qt-labs-settings-settings.html )
Settings {
id: settings
category: "myPlugin"
property alias alreadyRunning : ???
In reply to Thank you for idea, by straannick
Just discovered that the settings are written each time you change a settings.property. For this item you should be able to do:
In reply to Just discovered that the by jeetee
Thank you. Funny, but I was unaware that assigning is possible for settings ("settings.alreadyRunning = ..."). Now I feel much better :-)
In reply to Thank you. Funny, but I was by straannick
Except if settings automatically store the key in a different namespace, "alreadyRunning" is probably not a good key. It's better to use your plugin name of something or other plugins might have problems if they use the same method...
In reply to Except if settings by [DELETED] 5
In the example the category was set as an example to "myPlugin". It would indeed be the idea to fill that out with the actual Plugin identifier like a condensed name or the like.
If that is set, a separate group [myPlugin] is created in the .ini file. According to the Qt docs, that should act as a namespace:
Instead of ensuring that all settings in the application have unique names, the settings can be divided into unique categories that may then contain settings using the same names that are used in other categories - without a conflict.
So let me stress this point here again for everyone using Settings in Plugins: make sure to set the category property to a unique string (like your plugin name).
EDIT: a task has been created to add/improve auto-namespacing for plugin settings #98381: Force a category for the Settings of a Plugin
In reply to Except if settings by [DELETED] 5
of course :-)