Adaptation for the new plug-in tools menu handling. release-2.1.0

Fri, 28 Aug 2015 11:21:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 28 Aug 2015 11:21:29 +0200
changeset 36
fa0e373b6c3c
parent 35
9b8861da76ea
child 37
1a72298aa212

Adaptation for the new plug-in tools menu handling.

ChangeLog file | annotate | diff | comparison | revisions
PluginPySide2PyQt.py file | annotate | diff | comparison | revisions
PluginPySide2PyQt.zip file | annotate | diff | comparison | revisions
PySide2PyQt.e4p file | annotate | diff | comparison | revisions
--- a/ChangeLog	Sun Mar 08 18:17:53 2015 +0100
+++ b/ChangeLog	Fri Aug 28 11:21:29 2015 +0200
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 2.1.0:
+- adaptation for the new plug-in tools menu handling
+
 Version 2.0.3:
 - added Russian translations provided by Alexander Barkoff
 
--- a/PluginPySide2PyQt.py	Sun Mar 08 18:17:53 2015 +0100
+++ b/PluginPySide2PyQt.py	Fri Aug 28 11:21:29 2015 +0200
@@ -21,7 +21,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.0.3"
+version = "2.1.0"
 className = "PySide2PyQtPlugin"
 packageName = "PySide2PyQt"
 shortDescription = "Convert PySide file to PyQt and vice versa"
@@ -56,6 +56,7 @@
         self.__initMenu()
         
         self.__editors = {}
+        self.__mainActions = []
     
     def activate(self):
         """
@@ -68,6 +69,14 @@
         
         self.__ui.showMenu.connect(self.__populateMenu)
         
+        menu = self.__ui.getMenu("plugin_tools")
+        if menu is not None:
+            if not menu.isEmpty():
+                act = menu.addSeparator()
+                self.__mainActions.append(act)
+            act = menu.addMenu(self.__menu)
+            self.__mainActions.append(act)
+        
         e5App().getObject("ViewManager").editorOpenedEd.connect(
             self.__editorOpened)
         e5App().getObject("ViewManager").editorClosedEd.connect(
@@ -84,6 +93,12 @@
         """
         self.__ui.showMenu.disconnect(self.__populateMenu)
         
+        menu = self.__ui.getMenu("plugin_tools")
+        if menu is not None:
+            for act in self.__mainActions:
+                menu.removeAction(act)
+        self.__mainActions = []
+
         e5App().getObject("ViewManager").editorOpenedEd.disconnect(
             self.__editorOpened)
         e5App().getObject("ViewManager").editorClosedEd.disconnect(
@@ -139,16 +154,18 @@
         @param name name of the menu (string)
         @param menu reference to the menu to be populated (QMenu)
         """
-        if name != "Tools":
+        if name not in ["Tools", "PluginTools"]:
             return
         
         editor = e5App().getObject("ViewManager").activeWindow()
         
-        if not menu.isEmpty():
-            menu.addSeparator()
-        
-        act = menu.addMenu(self.__menu)
-        act.setEnabled(editor is not None)
+        if name == "Tools":
+            if not menu.isEmpty():
+                menu.addSeparator()
+            act = menu.addMenu(self.__menu)
+            act.setEnabled(editor is not None)
+        elif name == "PluginTools" and self.__mainActions:
+            self.__mainActions[-1].setEnabled(editor is not None)
     
     def __editorOpened(self, editor):
         """
Binary file PluginPySide2PyQt.zip has changed
--- a/PySide2PyQt.e4p	Sun Mar 08 18:17:53 2015 +0100
+++ b/PySide2PyQt.e4p	Fri Aug 28 11:21:29 2015 +0200
@@ -6,7 +6,7 @@
   <Language>en_US</Language>
   <Hash>d994091d1e81ad5afcdcbc00ecea86f23163c696</Hash>
   <ProgLanguage mixed="0">Python3</ProgLanguage>
-  <ProjectType>E4Plugin</ProjectType>
+  <ProjectType>E6Plugin</ProjectType>
   <Description>Plug-in to convert PySide filePyQt4 and vice versa. It works with the current editor.</Description>
   <Version>2.x</Version>
   <Author>Detlev Offenbach</Author>
@@ -14,33 +14,33 @@
   <TranslationPattern>PySide2PyQt/i18n/pyside2pyqt_%language%.ts</TranslationPattern>
   <Eol index="1"/>
   <Sources>
-    <Source>__init__.py</Source>
     <Source>PluginPySide2PyQt.py</Source>
     <Source>PySide2PyQt/__init__.py</Source>
+    <Source>__init__.py</Source>
   </Sources>
   <Forms/>
   <Translations>
+    <Translation>PySide2PyQt/i18n/pyside2pyqt_de.qm</Translation>
     <Translation>PySide2PyQt/i18n/pyside2pyqt_de.ts</Translation>
-    <Translation>PySide2PyQt/i18n/pyside2pyqt_en.ts</Translation>
-    <Translation>PySide2PyQt/i18n/pyside2pyqt_es.ts</Translation>
-    <Translation>PySide2PyQt/i18n/pyside2pyqt_de.qm</Translation>
     <Translation>PySide2PyQt/i18n/pyside2pyqt_en.qm</Translation>
+    <Translation>PySide2PyQt/i18n/pyside2pyqt_en.ts</Translation>
     <Translation>PySide2PyQt/i18n/pyside2pyqt_es.qm</Translation>
-    <Translation>PySide2PyQt/i18n/pyside2pyqt_pt.ts</Translation>
+    <Translation>PySide2PyQt/i18n/pyside2pyqt_es.ts</Translation>
     <Translation>PySide2PyQt/i18n/pyside2pyqt_pt.qm</Translation>
+    <Translation>PySide2PyQt/i18n/pyside2pyqt_pt.ts</Translation>
+    <Translation>PySide2PyQt/i18n/pyside2pyqt_ru.qm</Translation>
     <Translation>PySide2PyQt/i18n/pyside2pyqt_ru.ts</Translation>
-    <Translation>PySide2PyQt/i18n/pyside2pyqt_ru.qm</Translation>
   </Translations>
   <Resources/>
   <Interfaces/>
   <Others>
     <Other>.hgignore</Other>
-    <Other>PySide2PyQt/Documentation/source</Other>
     <Other>ChangeLog</Other>
     <Other>PKGLIST</Other>
     <Other>PluginPySide2PyQt.zip</Other>
+    <Other>PySide2PyQt.e4p</Other>
     <Other>PySide2PyQt/Documentation/LICENSE.GPL3</Other>
-    <Other>PySide2PyQt.e4p</Other>
+    <Other>PySide2PyQt/Documentation/source</Other>
   </Others>
   <MainScript>PluginPySide2PyQt.py</MainScript>
   <Vcs>
@@ -159,7 +159,6 @@
     <FiletypeAssociation pattern="*.qrc" type="RESOURCES"/>
     <FiletypeAssociation pattern="*.ts" type="TRANSLATIONS"/>
     <FiletypeAssociation pattern="*.ui" type="FORMS"/>
-    <FiletypeAssociation pattern="*.ui.h" type="FORMS"/>
   </FiletypeAssociations>
   <Documentation>
     <DocumentationParams>

eric ide

mercurial