Extended the API to allow for plug-in extension by another plug-in. release-3.3.0

Sat, 25 Jan 2014 17:41:00 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 25 Jan 2014 17:41:00 +0100
changeset 32
fd79d080b065
parent 31
a632d10fdb7c
child 33
d2b78ef8b216

Extended the API to allow for plug-in extension by another plug-in.

ChangeLog file | annotate | diff | comparison | revisions
PluginProjectDjango.py file | annotate | diff | comparison | revisions
PluginProjectDjango.zip file | annotate | diff | comparison | revisions
ProjectDjango/Documentation/source/Plugin_Project_Django.PluginProjectDjango.html file | annotate | diff | comparison | revisions
ProjectDjango/Documentation/source/Plugin_Project_Django.ProjectDjango.Project.html file | annotate | diff | comparison | revisions
ProjectDjango/Project.py file | annotate | diff | comparison | revisions
--- a/ChangeLog	Wed Jan 01 14:47:54 2014 +0100
+++ b/ChangeLog	Sat Jan 25 17:41:00 2014 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 3.3.0:
+- extended the API to allow for plug-in extension by another plug-in
+
 Version 3.2.1:
 - fixed code style issues
 
--- a/PluginProjectDjango.py	Wed Jan 01 14:47:54 2014 +0100
+++ b/PluginProjectDjango.py	Sat Jan 25 17:41:00 2014 +0100
@@ -28,7 +28,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "3.2.1"
+version = "3.3.0"
 className = "ProjectDjangoPlugin"
 packageName = "ProjectDjango"
 shortDescription = "Project support for Django projects."
@@ -421,3 +421,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 []
Binary file PluginProjectDjango.zip has changed
--- a/ProjectDjango/Documentation/source/Plugin_Project_Django.PluginProjectDjango.html	Wed Jan 01 14:47:54 2014 +0100
+++ b/ProjectDjango/Documentation/source/Plugin_Project_Django.PluginProjectDjango.html	Sat Jan 25 17:41:00 2014 +0100
@@ -102,6 +102,12 @@
 <td><a href="#ProjectDjangoPlugin.fileTypesCallback">fileTypesCallback</a></td>
 <td>Public method get the filetype associations of the Django project type.</td>
 </tr><tr>
+<td><a href="#ProjectDjangoPlugin.getMenu">getMenu</a></td>
+<td>Public method to get a reference to the requested menu.</td>
+</tr><tr>
+<td><a href="#ProjectDjangoPlugin.getMenuNames">getMenuNames</a></td>
+<td>Public method to get the names of all menus.</td>
+</tr><tr>
 <td><a href="#ProjectDjangoPlugin.getPreferences">getPreferences</a></td>
 <td>Public method to retrieve the various settings.</td>
 </tr><tr>
@@ -202,6 +208,32 @@
 <dd>
 dictionary with file type associations
 </dd>
+</dl><a NAME="ProjectDjangoPlugin.getMenu" ID="ProjectDjangoPlugin.getMenu"></a>
+<h4>ProjectDjangoPlugin.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="ProjectDjangoPlugin.getMenuNames" ID="ProjectDjangoPlugin.getMenuNames"></a>
+<h4>ProjectDjangoPlugin.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="ProjectDjangoPlugin.getPreferences" ID="ProjectDjangoPlugin.getPreferences"></a>
 <h4>ProjectDjangoPlugin.getPreferences</h4>
 <b>getPreferences</b>(<i>key</i>)
--- a/ProjectDjango/Documentation/source/Plugin_Project_Django.ProjectDjango.Project.html	Wed Jan 01 14:47:54 2014 +0100
+++ b/ProjectDjango/Documentation/source/Plugin_Project_Django.ProjectDjango.Project.html	Sat Jan 25 17:41:00 2014 +0100
@@ -296,6 +296,12 @@
 <td><a href="#Project.getDjangoVersion">getDjangoVersion</a></td>
 <td>Public method to get the Django version.</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.getProjectPath">getProjectPath</a></td>
 <td>Public method to get the path of the eric5 project.</td>
 </tr><tr>
@@ -937,6 +943,32 @@
 <dd>
 Django version (string)
 </dd>
+</dl><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.getProjectPath" ID="Project.getProjectPath"></a>
 <h4>Project.getProjectPath</h4>
 <b>getProjectPath</b>(<i></i>)
--- a/ProjectDjango/Project.py	Wed Jan 01 14:47:54 2014 +0100
+++ b/ProjectDjango/Project.py	Sat Jan 25 17:41:00 2014 +0100
@@ -97,7 +97,7 @@
         self.__e5project = e5App().getObject("Project")
         self.__hooksInstalled = False
         
-        self.__mainMenu = None
+        self.__menus = {}   # dictionary with references to menus
         
         self.__serverProc = None
         self.__testServerProc = None
@@ -642,6 +642,8 @@
         
         @return the menu generated (QMenu)
         """
+        self.__menus = {}   # clear menus references
+        
         menu = QMenu(self.trUtf8('D&jango'), self.__ui)
         menu.setTearOffEnabled(True)
         
@@ -670,7 +672,7 @@
         menu.addSeparator()
         menu.addAction(self.helpAct)
         
-        self.__mainMenu = menu
+        self.__menus["main"] = menu
         
         return menu
 
@@ -693,6 +695,8 @@
         menu.addSeparator()
         menu.addMenu(self.__initDatabaseSqlMenu())
         
+        self.__menus["database"] = menu
+        
         return menu
     
     def __initDatabaseSqlMenu(self):
@@ -715,6 +719,8 @@
         menu.addAction(self.databaseSqlFlushAct)
         menu.addAction(self.databaseSqlResetSeqAct)
         
+        self.__menus["sql"] = menu
+        
         return menu
     
     def __initToolsMenu(self):
@@ -732,6 +738,8 @@
         menu.addSeparator()
         menu.addAction(self.runPythonShellAct)
         
+        self.__menus["tools"] = menu
+        
         return menu
     
     def __initTestingMenu(self):
@@ -749,6 +757,8 @@
         menu.addAction(self.runTestAct)
         menu.addAction(self.runTestServerAct)
         
+        self.__menus["testing"] = menu
+        
         return menu
     
     def __initAuthorizationMenu(self):
@@ -763,6 +773,8 @@
         menu.addAction(self.changePasswordAct)
         menu.addAction(self.createSuperUserAct)
         
+        self.__menus["authorization"] = menu
+        
         return menu
     
     def __initSessionMenu(self):
@@ -776,7 +788,30 @@
         
         menu.addAction(self.clearSessionsAct)
         
+        self.__menus["session"] = 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())
 
     ##################################################################
     ## methods below implement the various hook related functions

eric ide

mercurial