Sat, 25 Jan 2014 17:43:06 +0100
Extended the API to allow for plug-in extension by another plug-in.
--- a/ChangeLog Wed Jan 01 14:47:56 2014 +0100 +++ b/ChangeLog Sat Jan 25 17:43:06 2014 +0100 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 1.5.0: +- extended the API to allow for plug-in extension by another plug-in + Version 1.4.0 - bug fixes - Python 2 compatibility for Eric 5
--- a/PluginProjectPyramid.py Wed Jan 01 14:47:56 2014 +0100 +++ b/PluginProjectPyramid.py Sat Jan 25 17:43:06 2014 +0100 @@ -28,7 +28,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "1.4.0" +version = "1.5.0" className = "ProjectPyramidPlugin" packageName = "ProjectPyramid" shortDescription = "Project support for Pyramid projects." @@ -406,3 +406,27 @@ lexerAssociationCallback=self.lexerAssociationCallback, binaryTranslationsCallback= self.binaryTranslationsCallback) + + def getMenu(self, name): + """ + Public method to get a reference to the requested menu. + + @param name name of the menu (string) + @return reference to the menu (QMenu) or None, if no + menu with the given name exists + """ + if self.__object is not None: + return self.__object.getMenu(name) + else: + return None + + def getMenuNames(self): + """ + Public method to get the names of all menus. + + @return menu names (list of string) + """ + if self.__object is not None: + return list(self.__menus.keys()) + else: + return []
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.PluginProjectPyramid.html Wed Jan 01 14:47:56 2014 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.PluginProjectPyramid.html Sat Jan 25 17:43:06 2014 +0100 @@ -102,6 +102,12 @@ <td><a href="#ProjectPyramidPlugin.fileTypesCallback">fileTypesCallback</a></td> <td>Public method get the filetype associations of the Pyramid project type.</td> </tr><tr> +<td><a href="#ProjectPyramidPlugin.getMenu">getMenu</a></td> +<td>Public method to get a reference to the requested menu.</td> +</tr><tr> +<td><a href="#ProjectPyramidPlugin.getMenuNames">getMenuNames</a></td> +<td>Public method to get the names of all menus.</td> +</tr><tr> <td><a href="#ProjectPyramidPlugin.getPreferences">getPreferences</a></td> <td>Public method to retrieve the various settings.</td> </tr><tr> @@ -203,6 +209,32 @@ <dd> dictionary with file type associations </dd> +</dl><a NAME="ProjectPyramidPlugin.getMenu" ID="ProjectPyramidPlugin.getMenu"></a> +<h4>ProjectPyramidPlugin.getMenu</h4> +<b>getMenu</b>(<i>name</i>) +<p> + Public method to get a reference to the requested menu. +</p><dl> +<dt><i>name</i></dt> +<dd> +name of the menu (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +reference to the menu (QMenu) or None, if no + menu with the given name exists +</dd> +</dl><a NAME="ProjectPyramidPlugin.getMenuNames" ID="ProjectPyramidPlugin.getMenuNames"></a> +<h4>ProjectPyramidPlugin.getMenuNames</h4> +<b>getMenuNames</b>(<i></i>) +<p> + Public method to get the names of all menus. +</p><dl> +<dt>Returns:</dt> +<dd> +menu names (list of string) +</dd> </dl><a NAME="ProjectPyramidPlugin.getPreferences" ID="ProjectPyramidPlugin.getPreferences"></a> <h4>ProjectPyramidPlugin.getPreferences</h4> <b>getPreferences</b>(<i>key</i>)
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html Wed Jan 01 14:47:56 2014 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html Sat Jan 25 17:43:06 2014 +0100 @@ -156,6 +156,12 @@ <td><a href="#Project.extractMessages">extractMessages</a></td> <td>Public method to extract the messages catalog template file.</td> </tr><tr> +<td><a href="#Project.getMenu">getMenu</a></td> +<td>Public method to get a reference to the requested menu.</td> +</tr><tr> +<td><a href="#Project.getMenuNames">getMenuNames</a></td> +<td>Public method to get the names of all menus.</td> +</tr><tr> <td><a href="#Project.getPyramidCommand">getPyramidCommand</a></td> <td>Public method to build a Pyramid command.</td> </tr><tr> @@ -494,7 +500,33 @@ <b>extractMessages</b>(<i></i>) <p> Public method to extract the messages catalog template file. -</p><a NAME="Project.getPyramidCommand" ID="Project.getPyramidCommand"></a> +</p><a NAME="Project.getMenu" ID="Project.getMenu"></a> +<h4>Project.getMenu</h4> +<b>getMenu</b>(<i>name</i>) +<p> + Public method to get a reference to the requested menu. +</p><dl> +<dt><i>name</i></dt> +<dd> +name of the menu (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +reference to the menu (QMenu) or None, if no + menu with the given name exists +</dd> +</dl><a NAME="Project.getMenuNames" ID="Project.getMenuNames"></a> +<h4>Project.getMenuNames</h4> +<b>getMenuNames</b>(<i></i>) +<p> + Public method to get the names of all menus. +</p><dl> +<dt>Returns:</dt> +<dd> +menu names (list of string) +</dd> +</dl><a NAME="Project.getPyramidCommand" ID="Project.getPyramidCommand"></a> <h4>Project.getPyramidCommand</h4> <b>getPyramidCommand</b>(<i>cmd, language=""</i>) <p>
--- a/ProjectPyramid/Project.py Wed Jan 01 14:47:56 2014 +0100 +++ b/ProjectPyramid/Project.py Sat Jan 25 17:43:06 2014 +0100 @@ -96,7 +96,7 @@ self.__e5project = e5App().getObject("Project") self.__hooksInstalled = False - self.__mainMenu = None + self.__menus = {} # dictionary with references to menus self.__serverProc = None @@ -356,6 +356,8 @@ @return the menu generated (QMenu) """ + self.__menus = {} # clear menus references + menu = QMenu(self.trUtf8('P&yramid'), self.__ui) menu.setTearOffEnabled(True) @@ -383,9 +385,31 @@ menu.addSeparator() menu.addAction(self.aboutPyramidAct) - self.__mainMenu = menu + self.__menus["main"] = menu + return menu + def getMenu(self, name): + """ + Public method to get a reference to the requested menu. + + @param name name of the menu (string) + @return reference to the menu (QMenu) or None, if no + menu with the given name exists + """ + if name in self.__menus: + return self.__menus[name] + else: + return None + + def getMenuNames(self): + """ + Public method to get the names of all menus. + + @return menu names (list of string) + """ + return list(self.__menus.keys()) + def registerOpenHook(self): """ Public method to register the open hook to open a translations file