Made the PySide support differentiate between Python2 and Python3.

Mon, 07 Jan 2013 17:06:13 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 07 Jan 2013 17:06:13 +0100
changeset 2319
116c547dedce
parent 2318
3a3ee7cc2ad6
child 2320
fe9d876fc9dd

Made the PySide support differentiate between Python2 and Python3.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Utilities.__init__.html file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/HelpDocumentationPage.py file | annotate | diff | comparison | revisions
Project/Project.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric5.Utilities.__init__.html	Mon Jan 07 16:34:02 2013 +0100
+++ b/Documentation/Source/eric5.Utilities.__init__.html	Mon Jan 07 17:06:13 2013 +0100
@@ -363,7 +363,8 @@
 </p><dl>
 <dt>Returns:</dt>
 <dd>
-flag indicating the presence of PySide (boolean)
+tuple of two flags indicating the presence of PySide for Python2
+        and PySide for Python3 (boolean, boolean)
 </dd>
 </dl>
 <div align="right"><a href="#top">Up</a></div>
--- a/Preferences/ConfigurationPages/HelpDocumentationPage.py	Mon Jan 07 16:34:02 2013 +0100
+++ b/Preferences/ConfigurationPages/HelpDocumentationPage.py	Mon Jan 07 17:06:13 2013 +0100
@@ -37,7 +37,8 @@
         self.pyqt4DocDirCompleter = E5FileCompleter(self.pyqt4DocDirEdit)
         self.pysideDocDirCompleter = E5FileCompleter(self.pysideDocDirEdit)
         
-        if Utilities.checkPyside():
+        pyside2, pyside3 = Utilities.checkPyside()
+        if pyside2 or pyside3:
             self.pysideGroup.setEnabled(True)
         else:
             self.pysideGroup.setEnabled(False)
--- a/Project/Project.py	Mon Jan 07 16:34:02 2013 +0100
+++ b/Project/Project.py	Mon Jan 07 17:06:13 2013 +0100
@@ -270,13 +270,14 @@
             "Ruby": ["Qt4", "Qt4C", "Console", "Other"],
         }
         
-        if Utilities.checkPyside():
+        pyside2, pyside3 = Utilities.checkPyside()
+        if pyside2 or pyside3:
             self.__projectTypes["PySide"] = self.trUtf8("PySide GUI")
             self.__projectTypes["PySideC"] = self.trUtf8("PySide Console")
-            self.__projectProgLanguages["Python2"].extend(["PySide", "PySideC"])
-            self.__projectProgLanguages["Python3"].extend(["PySide", "PySideC"])
-        else:
-            pass
+            if pyside2:
+                self.__projectProgLanguages["Python2"].extend(["PySide", "PySideC"])
+            if pyside3:
+                self.__projectProgLanguages["Python3"].extend(["PySide", "PySideC"])
         
     def getProjectTypes(self, progLanguage=""):
         """
--- a/UI/UserInterface.py	Mon Jan 07 16:34:02 2013 +0100
+++ b/UI/UserInterface.py	Mon Jan 07 17:06:13 2013 +0100
@@ -2096,7 +2096,8 @@
         """
         Private slot to initialize the action to show the PySide documentation.
         """
-        if Utilities.checkPyside():
+        pyside2, pyside3 = Utilities.checkPyside()
+        if pyside2 or pyside3:
             self.pysideDocAct = E5Action(self.trUtf8('PySide Documentation'),
                 self.trUtf8('Py&Side Documentation'), 0, 0, self, 'pyside_documentation')
             self.pysideDocAct.setStatusTip(self.trUtf8('Open PySide Documentation'))
--- a/Utilities/__init__.py	Mon Jan 07 16:34:02 2013 +0100
+++ b/Utilities/__init__.py	Mon Jan 07 17:06:13 2013 +0100
@@ -1502,19 +1502,24 @@
     """
     Module function to check the presence of PySide.
     
-    @return flag indicating the presence of PySide (boolean)
+    @return tuple of two flags indicating the presence of PySide for Python2
+        and PySide for Python3 (boolean, boolean)
     """
+
     try:
         # step 1: try Python3 variant of PySide
         import PySide       # __IGNORE_EXCEPTION__
         del PySide
-        return True
+        py3 = True
     except ImportError:
-        # step 2: check for a Python2 variant
-        interpreter = Preferences.getDebugger("PythonInterpreter")
-        if interpreter == "" or not isinpath(interpreter):
-            return False
-        
+        py3 = False
+    
+    # step 2: check for a Python2 variant
+    interpreter = Preferences.getDebugger("PythonInterpreter")
+    if interpreter == "" or not isinpath(interpreter):
+        py2 = False
+    else:
+        py2 = False
         checker = os.path.join(getConfig('ericDir'),
                                "UtilitiesPython2", "PySideImporter.py")
         args = [checker]
@@ -1524,9 +1529,9 @@
         finished = proc.waitForFinished(30000)
         if finished:
             if proc.exitCode() == 0:
-                return True
+                py2 = True
     
-    return False
+    return py2, py3
 
 ################################################################################
 # Other utility functions below

eric ide

mercurial