Mon, 05 Jan 2015 19:32:53 +0100
Added code to repopulate the Tools menu.
--- a/ChangeLog Thu Jan 01 13:29:02 2015 +0100 +++ b/ChangeLog Mon Jan 05 19:32:53 2015 +0100 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 2.0.1: +- bug fixes + Version 2.0.0: - ported for eric6 using PyQt5
--- a/PluginPySide2PyQt.py Thu Jan 01 13:29:02 2015 +0100 +++ b/PluginPySide2PyQt.py Mon Jan 05 19:32:53 2015 +0100 @@ -21,7 +21,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "2.0.0" +version = "2.0.1" className = "PySide2PyQtPlugin" packageName = "PySide2PyQt" shortDescription = "Convert PySide file to PyQt and vice versa" @@ -90,6 +90,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: @@ -164,6 +165,7 @@ act = menu.addMenu(self.__menu) self.__editors[editor].append(act) self.__menu.setEnabled(True) + editor.showMenu.connect(self.__editorShowMenu) def __editorClosed(self, editor): """ @@ -178,6 +180,25 @@ except KeyError: pass + def __editorShowMenu(self, menuName, menu, editor): + """ + Private slot called, when the the editor context menu or a submenu is + about to be shown. + + @param menuName name of the menu to be shown (string) + @param menu reference to the menu (QMenu) + @param editor reference to the editor + """ + if menuName == "Tools": + 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) + def __pyside2Pyqt(self): """ Private slot to convert the code of the current editor from PySide
--- a/PySide2PyQt.e4p Thu Jan 01 13:29:02 2015 +0100 +++ b/PySide2PyQt.e4p Mon Jan 05 19:32:53 2015 +0100 @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Project SYSTEM "Project-5.1.dtd"> -<!-- eric6 project file for project PySide2PyQt --> -<!-- Copyright (C) 2014 Detlev Offenbach, detlev@die-offenbachs.de --> +<!-- eric project file for project PySide2PyQt --> +<!-- Copyright (C) 2015 Detlev Offenbach, detlev@die-offenbachs.de --> <Project version="5.1"> <Language>en_US</Language> <Hash>d994091d1e81ad5afcdcbc00ecea86f23163c696</Hash> <ProgLanguage mixed="0">Python3</ProgLanguage> <ProjectType>E4Plugin</ProjectType> <Description>Plug-in to convert PySide filePyQt4 and vice versa. It works with the current editor.</Description> - <Version>0.x</Version> + <Version>2.x</Version> <Author>Detlev Offenbach</Author> <Email>detlev@die-offenbachs.de</Email> <TranslationPattern>PySide2PyQt/i18n/pyside2pyqt_%language%.ts</TranslationPattern>
--- a/PySide2PyQt/Documentation/source/Plugin_Tools_PySide2PyQt.PluginPySide2PyQt.html Thu Jan 01 13:29:02 2015 +0100 +++ b/PySide2PyQt/Documentation/source/Plugin_Tools_PySide2PyQt.PluginPySide2PyQt.html Mon Jan 05 19:32:53 2015 +0100 @@ -66,6 +66,9 @@ <td><a href="#PySide2PyQtPlugin.__editorOpened">__editorOpened</a></td> <td>Private slot called, when a new editor was opened.</td> </tr><tr> +<td><a href="#PySide2PyQtPlugin.__editorShowMenu">__editorShowMenu</a></td> +<td>Private slot called, when the the editor context menu or a submenu is about to be shown.</td> +</tr><tr> <td><a href="#PySide2PyQtPlugin.__initMenu">__initMenu</a></td> <td>Private method to initialize the menu.</td> </tr><tr> @@ -122,6 +125,23 @@ <dd> reference to the new editor (QScintilla.Editor) </dd> +</dl><a NAME="PySide2PyQtPlugin.__editorShowMenu" ID="PySide2PyQtPlugin.__editorShowMenu"></a> +<h4>PySide2PyQtPlugin.__editorShowMenu</h4> +<b>__editorShowMenu</b>(<i>menuName, menu, editor</i>) +<p> + Private slot called, when the the editor context menu or a submenu is + about to be shown. +</p><dl> +<dt><i>menuName</i></dt> +<dd> +name of the menu to be shown (string) +</dd><dt><i>menu</i></dt> +<dd> +reference to the menu (QMenu) +</dd><dt><i>editor</i></dt> +<dd> +reference to the editor +</dd> </dl><a NAME="PySide2PyQtPlugin.__initMenu" ID="PySide2PyQtPlugin.__initMenu"></a> <h4>PySide2PyQtPlugin.__initMenu</h4> <b>__initMenu</b>(<i></i>)