Fri, 02 Jan 2015 17:07:54 +0100
Added code to repopulate the Tools menu.
--- a/ChangeLog Thu Jan 01 13:27:54 2015 +0100 +++ b/ChangeLog Fri Jan 02 17:07:54 2015 +0100 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 2.0.1: +- bug fixes + Version 2.0.0: - ported for eric6 using PyQt5
--- a/ColorString.e4p Thu Jan 01 13:27:54 2015 +0100 +++ b/ColorString.e4p Fri Jan 02 17:07:54 2015 +0100 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Project SYSTEM "Project-5.1.dtd"> <!-- eric project file for project ColorString --> -<!-- Copyright (C) 2014 Detlev Offenbach, detlev@die-offenbachs.de --> +<!-- Copyright (C) 2015 Detlev Offenbach, detlev@die-offenbachs.de --> <Project version="5.1"> <Language>en_US</Language> <Hash>bf7dfc760db7f57239ae96b215ea79bb0df717d5</Hash> @@ -9,7 +9,7 @@ <ProjectType>E6Plugin</ProjectType> <Description>Plug-in to select a color via a color selection dialog and insert it as a string at the current editor cursor position. Selected text is used to initialize the dialog and is replaced with the new color. </Description> - <Version>0.1</Version> + <Version>2.x</Version> <Author>Detlev Offenbach</Author> <Email>detlev@die-offenbachs.de</Email> <TranslationPattern>ColorString/i18n/colorstring_%language%.ts</TranslationPattern>
--- a/ColorString/Documentation/source/Plugin_Tools_ColorString.PluginColorString.html Thu Jan 01 13:27:54 2015 +0100 +++ b/ColorString/Documentation/source/Plugin_Tools_ColorString.PluginColorString.html Fri Jan 02 17:07:54 2015 +0100 @@ -66,6 +66,9 @@ <td><a href="#ColorStringPlugin.__editorOpened">__editorOpened</a></td> <td>Private slot called, when a new editor was opened.</td> </tr><tr> +<td><a href="#ColorStringPlugin.__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="#ColorStringPlugin.__initMenu">__initMenu</a></td> <td>Private method to initialize the menu.</td> </tr><tr> @@ -128,6 +131,23 @@ <dd> reference to the new editor (QScintilla.Editor) </dd> +</dl><a NAME="ColorStringPlugin.__editorShowMenu" ID="ColorStringPlugin.__editorShowMenu"></a> +<h4>ColorStringPlugin.__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="ColorStringPlugin.__initMenu" ID="ColorStringPlugin.__initMenu"></a> <h4>ColorStringPlugin.__initMenu</h4> <b>__initMenu</b>(<i></i>)
--- a/PluginColorString.py Thu Jan 01 13:27:54 2015 +0100 +++ b/PluginColorString.py Fri Jan 02 17:07:54 2015 +0100 @@ -23,7 +23,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "2.0.0" +version = "2.0.1" className = "ColorStringPlugin" packageName = "ColorString" shortDescription = "Insert color as string" @@ -157,6 +157,7 @@ act = menu.addMenu(self.__menu) self.__menu.setEnabled(True) self.__editors[editor].append(act) + editor.showMenu.connect(self.__editorShowMenu) def __editorClosed(self, editor): """ @@ -171,6 +172,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 __isHexString(self, text): """ Private method to check, if a given text is a hex string.