Globals/__init__.py

changeset 5696
68af0e9c57ad
parent 5401
dbbbd94aec0b
child 5735
f606dbe20be6
--- a/Globals/__init__.py	Sun Apr 09 16:46:35 2017 +0200
+++ b/Globals/__init__.py	Sun Apr 09 19:41:35 2017 +0200
@@ -182,6 +182,40 @@
     return ""
     
 
+def getPyQtToolsPath(version=5):
+    """
+    Module function to get the path of the PyQt tools.
+    
+    @param version PyQt major version
+    @type int
+    @return path to the PyQt tools
+    @rtype str
+    """
+    import Preferences
+    
+    path = ""
+    
+    # step 1: check, if the user has configured a tools path
+    path = Preferences.getQt("PyQtToolsDir")
+    
+    # step 2: determine from used Python interpreter (pyrcc is test object)
+    if not path:
+        program = "pyrcc{0}".format(version)
+        if isWindowsPlatform():
+            program += ".exe"
+            dirName = os.path.dirname(sys.executable)
+            if os.path.exists(os.path.join(dirName, program)):
+                path = dirName
+            elif os.path.exists(os.path.join(dirName, "Scripts", program)):
+                path = os.path.join(dirName, "Scripts")
+        else:
+            dirName = os.path.dirname(sys.executable)
+            if os.path.exists(os.path.join(dirName, program)):
+                path = dirName
+    
+    return path
+
+
 def getQtBinariesPath():
     """
     Module function to get the path of the Qt binaries.
@@ -244,8 +278,8 @@
                        "C:\\Python27", "C:\\Python28"]
         posixVersionsList = ["2.5", "2.6", "2.7", "2.8"]
     else:
-        winPathList = ["C:\\Python3{0}".format(x) for x in range(5)]
-        posixVersionsList = ["3.{0}".format(x) for x in range(5)]
+        winPathList = ["C:\\Python3{0}".format(x) for x in range(11)]
+        posixVersionsList = ["3.{0}".format(x) for x in range(11)]
     posixPathList = ["/usr/bin", "/usr/local/bin"]
     
     interpreters = []

eric ide

mercurial