--- a/PluginPySide2PyQt.py Sun Mar 08 18:17:53 2015 +0100 +++ b/PluginPySide2PyQt.py Fri Aug 28 11:21:29 2015 +0200 @@ -21,7 +21,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "2.0.3" +version = "2.1.0" className = "PySide2PyQtPlugin" packageName = "PySide2PyQt" shortDescription = "Convert PySide file to PyQt and vice versa" @@ -56,6 +56,7 @@ self.__initMenu() self.__editors = {} + self.__mainActions = [] def activate(self): """ @@ -68,6 +69,14 @@ self.__ui.showMenu.connect(self.__populateMenu) + menu = self.__ui.getMenu("plugin_tools") + if menu is not None: + if not menu.isEmpty(): + act = menu.addSeparator() + self.__mainActions.append(act) + act = menu.addMenu(self.__menu) + self.__mainActions.append(act) + e5App().getObject("ViewManager").editorOpenedEd.connect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.connect( @@ -84,6 +93,12 @@ """ self.__ui.showMenu.disconnect(self.__populateMenu) + menu = self.__ui.getMenu("plugin_tools") + if menu is not None: + for act in self.__mainActions: + menu.removeAction(act) + self.__mainActions = [] + e5App().getObject("ViewManager").editorOpenedEd.disconnect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.disconnect( @@ -139,16 +154,18 @@ @param name name of the menu (string) @param menu reference to the menu to be populated (QMenu) """ - if name != "Tools": + if name not in ["Tools", "PluginTools"]: return editor = e5App().getObject("ViewManager").activeWindow() - if not menu.isEmpty(): - menu.addSeparator() - - act = menu.addMenu(self.__menu) - act.setEnabled(editor is not None) + if name == "Tools": + if not menu.isEmpty(): + menu.addSeparator() + act = menu.addMenu(self.__menu) + act.setEnabled(editor is not None) + elif name == "PluginTools" and self.__mainActions: + self.__mainActions[-1].setEnabled(editor is not None) def __editorOpened(self, editor): """