Changed code to always add the entry to the tools menu and disable it, if prerequisites are not fulfilled. release-0.4.0

Sat, 28 Dec 2013 19:44:37 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 28 Dec 2013 19:44:37 +0100
changeset 18
ea533653d9b2
parent 17
8a22f4199481
child 19
d936d576b0b5

Changed code to always add the entry to the tools menu and disable it, if prerequisites are not fulfilled.

ChangeLog file | annotate | diff | comparison | revisions
PluginPySide2PyQt.py file | annotate | diff | comparison | revisions
PluginPySide2PyQt.zip file | annotate | diff | comparison | revisions
--- a/ChangeLog	Mon Dec 23 20:01:22 2013 +0100
+++ b/ChangeLog	Sat Dec 28 19:44:37 2013 +0100
@@ -1,5 +1,9 @@
 ChangeLog
 ---------
+Version 0.4.0:
+- always add the entry to the tools menu and disable it, if prerequisites
+  are not fulfilled
+
 Version 0.3.0:
 - added support for the editor Tools context menu (as of eric5 5.4.0)
 
--- a/PluginPySide2PyQt.py	Mon Dec 23 20:01:22 2013 +0100
+++ b/PluginPySide2PyQt.py	Sat Dec 28 19:44:37 2013 +0100
@@ -20,7 +20,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "0.3.0"
+version = "0.4.0"
 className = "PySide2PyQtPlugin"
 packageName = "PySide2PyQt"
 shortDescription = "Convert PySide file to PyQt4 and vice versa"
@@ -123,14 +123,14 @@
             return
         
         editor = e5App().getObject("ViewManager").activeWindow()
-        if editor is None:
-            return
         
         if not menu.isEmpty():
             menu.addSeparator()
         
-        menu.addAction(self.tr("PySide to PyQt4"), self.__pyside2Pyqt)
-        menu.addAction(self.tr("PyQt4 to PySide"), self.__pyqt2Pyside)
+        menu.addAction(self.tr("PySide to PyQt4"), self.__pyside2Pyqt)\
+            .setEnabled(editor is not None)
+        menu.addAction(self.tr("PyQt4 to PySide"), self.__pyqt2Pyside)\
+            .setEnabled(editor is not None)
     
     def __editorOpened(self, editor):
         """
Binary file PluginPySide2PyQt.zip has changed

eric ide

mercurial