eric6/Utilities/__init__.py

changeset 7911
4621c9082a43
parent 7908
33afc8e96e19
child 7923
91e843545d9a
--- a/eric6/Utilities/__init__.py	Wed Dec 23 16:28:35 2020 +0100
+++ b/eric6/Utilities/__init__.py	Thu Dec 24 16:17:57 2020 +0100
@@ -1800,27 +1800,21 @@
     return exe
 
 ###############################################################################
-# PySide2 utility functions below
+# PySide2/PySide6 utility functions below
 ###############################################################################
 
 
 def generatePySideToolPath(toolname, variant=2):
     """
-    Module function to generate the executable path for a PySide2 tool.
+    Module function to generate the executable path for a PySide2/PySide6 tool.
     
     @param toolname base name of the tool
     @type str
-    @param variant indicator for the PySide variant (not used)
-    @type int
-    @return the PySide2 tool path with extension
+    @param variant indicator for the PySide variant
+    @type int or str
+    @return the PySide2/PySide6 tool path with extension
     @rtype str
     """
-    # TODO: add support for pyside6
-    
-    if variant == 1:
-        # no PySide support anymore
-        return ""
-    
     if isWindowsPlatform():
         hasPyside = checkPyside(variant)
         if not hasPyside:
@@ -1834,21 +1828,10 @@
         if interpreter == "" or not isinpath(interpreter):
             interpreter = sys.executable
         prefix = os.path.dirname(interpreter)
-        if toolname in ["pyside2-uic"]:
-            return os.path.join(prefix, "Scripts", toolname + '.exe')
-        else:
-            path = os.path.join(prefix, "Scripts", toolname + '.exe')
-            if os.path.exists(path):
-                return path
-            
-            # report it the old style
-            return os.path.join(
-                prefix, "Lib", "site-packages",
-                "PySide{0}".format(variant),
-                toolname + ".exe")
+        return os.path.join(prefix, "Scripts", toolname + '.exe')
     else:
         # step 1: check, if the user has configured a tools path
-        path = Preferences.getQt("PySide2ToolsDir")
+        path = Preferences.getQt("PySide{0}ToolsDir".format(variant))
         if path:
             return os.path.join(path, toolname)
         
@@ -1857,28 +1840,18 @@
         if os.path.exists(os.path.join(dirName, toolname)):
             return os.path.join(dirName, toolname)
         
-        # step 3: if it is not 'pyside2-uic' look in the package directory
-        if toolname == "pyside2-uic":
-            return toolname
-        else:
-            import distutils.sysconfig
-            return os.path.join(distutils.sysconfig.get_python_lib(True),
-                                "PySide2", toolname)
+        return toolname
 
 
 def checkPyside(variant=2):
     """
-    Module function to check the presence of PySide2.
+    Module function to check the presence of PySide2/PySide6.
     
-    @param variant indicator for the PySide variant (not used)
-    @type int
-    @return flags indicating the presence of PySide2
+    @param variant indicator for the PySide variant
+    @type int or str
+    @return flags indicating the presence of PySide2/PySide6
     @rtype bool
     """
-    if variant == 1:
-        # no longer supported PySide
-        return False
-    
     venvName = Preferences.getQt("PySide{0}VenvName".format(variant))
     if not venvName:
         venvName = Preferences.getDebugger("Python3VirtualEnv")

eric ide

mercurial