diff -r 53d5a42625a2 -r 316f35ec5162 PluginSelectionEncloser.py --- a/PluginSelectionEncloser.py Thu Jan 01 13:29:19 2015 +0100 +++ b/PluginSelectionEncloser.py Mon Jan 05 20:07:39 2015 +0100 @@ -24,7 +24,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "2.0.0" +version = "2.0.1" className = "SelectionEncloserPlugin" packageName = "SelectionEncloser" shortDescription = "Enclose the selection with a string." @@ -165,6 +165,7 @@ self.__editorClosed) for editor, acts in self.__editors.items(): + editor.showMenu.disconnect(self.__editorShowMenu) menu = editor.getMenu("Tools") if menu is not None: for act in acts: @@ -286,9 +287,16 @@ @param editor reference to the editor """ if menuName == "Tools": - for act in self.__editors[editor]: - if not act.isSeparator(): - act.setEnabled(editor.hasSelectedText()) + if self.__menu.menuAction() not in menu.actions(): + # Re-add our menu + self.__editors[editor] = [] + if not menu.isEmpty(): + act = menu.addSeparator() + self.__editors[editor].append(act) + act = menu.addMenu(self.__menu) + self.__editors[editor].append(act) + + self.__menu.setEnabled(editor.selectedText() != '') def __showMenu(self): """