eric6/Globals/__init__.py

changeset 7741
6ead5f865f72
parent 7673
f0309b9483b1
child 7742
38ad1351688c
--- a/eric6/Globals/__init__.py	Sat Oct 03 15:23:58 2020 +0200
+++ b/eric6/Globals/__init__.py	Sat Oct 03 15:24:48 2020 +0200
@@ -18,8 +18,8 @@
 import shutil
 
 from PyQt5.QtCore import (
-    QDir, QLibraryInfo, QByteArray, QCoreApplication, QT_VERSION_STR,
-    QT_VERSION, QProcess, qVersion
+    QDir, QByteArray, QCoreApplication, QT_VERSION_STR, QT_VERSION, QProcess,
+    qVersion
 )
 
 # names of the various settings objects
@@ -288,7 +288,8 @@
     """
     Module function to get the path of the Qt binaries.
     
-    @return path of the Qt binaries (string)
+    @return path of the Qt binaries
+    @rtype str
     """
     import Preferences
     
@@ -297,41 +298,25 @@
     # step 1: check, if the user has configured a tools path
     path = Preferences.getQt("QtToolsDir")
     
-    if not path and isWindowsPlatform():
-        # step 2.1: check for PyQt5 Windows installer (designer is test object)
-        modDir = getPyQt5ModulesDirectory()
-        if os.path.exists(os.path.join(modDir, "bin", "designer.exe")):
-            path = os.path.join(modDir, "bin")
-        elif os.path.exists(os.path.join(modDir, "designer.exe")):
-            path = modDir
-        
-        if not path:
-            import distutils.sysconfig
-            # step 2.2.1: check for the pyqt5-tools wheel (new variant)
-            # (Windows only)
-            pyqt5ToolsPath = os.path.join(
-                distutils.sysconfig.get_python_lib(True), "pyqt5_tools")
-            if os.path.exists(os.path.join(pyqt5ToolsPath, "designer.exe")):
-                path = pyqt5ToolsPath
-            if not path:
-                # step 2.2.2: check for the pyqt5-tools wheel (old variant)
-                # (Windows only)
-                pyqt5ToolsPath = os.path.join(
-                    distutils.sysconfig.get_python_lib(True), "pyqt5-tools")
-                if os.path.exists(os.path.join(pyqt5ToolsPath,
-                                               "designer.exe")):
-                    path = pyqt5ToolsPath
-    
+    # step 2: determine from used Python interpreter (designer is test object)
     if not path:
-        # step 3: get the path from Qt
-        # Note: no Qt tools are to be found there for PyQt 5.7.0
-        path = QLibraryInfo.location(QLibraryInfo.BinariesPath)
-        if not os.path.exists(path):
-            path = ""
+        program = "designer"
+        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 QDir.toNativeSeparators(path)
 
 
+# TODO: get rid of this
 def translate(*args):
     """
     Module function to handle different PyQt 4/5 QCoreApplication.translate

eric ide

mercurial