unregistering a plugin


https://forum.reallusion.com/Topic501580.aspx
Print Topic | Close Window

By frank_461853 - 4 Years Ago
in a python script how to i unregister a plugin from iclone 7's plugin menu?
By wires - 4 Years Ago
Jeff Little has a Plugin Manager in the Marketplace that lets users decide if a plugin should be loaded at start or not. Cool tool. :cool::smooooth:
By frank_461853 - 4 Years Ago
frank_461853 (12/8/2021)
in a python script how to i unregister a plugin from iclone 7's plugin menu?

is there a way of doing it from within python?

By jlittle - 4 Years Ago
Frank,

If you keep a pointer to the menu action that was created you can remove it by using the removeAction(action).

Jeff

By frank_461853 - 4 Years Ago
frank_461853 (12/8/2021)
frank_461853 (12/8/2021)
in a python script how to i unregister a plugin from iclone 7's plugin menu?

is there a way of doing it from within python?


Thank you. there's no global area to store the handle. i did try getting the Actions collection of the Menu object but it retrieved only the default which is strange as i added an action.
By jlittle - 4 Years Ago
Are you trying to "unregister" your own menu item or the already existing ones?
If the existing ones, why would want you do this?

If all you want to do is disable certain plugins then my "Plugin Manger" will do that for you.

Once you "find" the main menu, you can then look at each of the menus child objects to "find" other menu items which then can be removed.

Jeff
By frank_461853 - 4 Years Ago
jlittle (12/9/2021)
Are you trying to "unregister" your own menu item or the already existing ones?
If the existing ones, why would want you do this?

If all you want to do is disable certain plugins then my "Plugin Manger" will do that for you.

Once you "find" the main menu, you can then look at each of the menus child objects to "find" other menu items which then can be removed.

Jeff

i want to unregister my own plugin. 
my initialisation it thus
def initialize_plugin():
    # Add menu
    ic_dlg = wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow)
    plugin_menu = ic_dlg.menuBar().findChild(QtWidgets.QMenu, "Platform_menu")
    if (plugin_menu == None):
        plugin_menu = wrapInstance(int(RLPy.RUi.AddMenu("Platform lights", RLPy.EMenu_Plugins)), QtWidgets.QMenu)
        plugin_menu.setObjectName("Platform_menu")

        platform_action = plugin_menu.addAction("Stages")
        platform_action.triggered.connect(show_dialog)

despite this 

when i unload or attempt to 

def UnloadMe(toHandle):
# remove menu
    ic_dlg = wrapInstance(int(RLPy.RUi.GetMainWindow()), QtWidgets.QMainWindow)
    plugin_menu = ic_dlg.menuBar().findChild(QtWidgets.QMenu, "Platform_menu")
    if (plugin_menu != None):
        #lAction =  plugin_menu.findChild(QtWidgets.QAction, "Stages")
        for ThatActions in ic_dlg.actions():
             print (ThatActions)
        for TotherAction in plugin_menu.actions():
            print (TotherAction) 
returns nothing. 
when you say "find  the main menu" do you mean by interrogating the "ic_dlg" handle?


By jlittle - 4 Years Ago
Frank,

Attached is a program that you can load using the Script | Load Python menu item.
It shows several methods of removing a Menu Item/Action.

Jeff