eric6/Preferences/ProgramsDialog.py

changeset 7907
7991ea245c20
parent 7900
72b88fb20261
child 7911
4621c9082a43
--- a/eric6/Preferences/ProgramsDialog.py	Mon Dec 21 13:36:24 2020 +0100
+++ b/eric6/Preferences/ProgramsDialog.py	Tue Dec 22 19:59:29 2020 +0100
@@ -86,7 +86,7 @@
         header.setSortIndicatorShown(False)
         
         with E5OverrideCursor():
-            # 1. do the Qt5 programs
+            # 1. do the Qt programs
             # 1a. Translation Converter
             exe = (
                 Utilities.isWindowsPlatform() and
@@ -156,6 +156,18 @@
                 Utilities.generatePyQtToolPath("pyrcc5"),
                 '-version', '', -1, versionRe='Resource Compiler|pyrcc5')
             
+            # 2.2 do the PyQt6 programs
+            # 2.2a. Translation Extractor PyQt6
+            self.__createProgramEntry(
+                self.tr("Translation Extractor (Python, PyQt6)"),
+                Utilities.generatePyQtToolPath("pylupdate6"),
+                '--version', versionPosition=0)
+            # 2.2b. Forms Compiler PyQt6
+            self.__createProgramEntry(
+                self.tr("Forms Compiler (Python, PyQt6)"),
+                Utilities.generatePyQtToolPath("pyuic6"),
+                '--version', versionPosition=0)
+            
             # 3. do the PySide programs
             # 3.1 do the PySide2 programs
             # 3.1a. Translation Extractor PySide2
@@ -303,7 +315,7 @@
 
     def __createProgramEntry(self, description, exe,
                              versionCommand="", versionStartsWith="",
-                             versionPosition=0, version="",
+                             versionPosition=None, version="",
                              versionCleanup=None, versionRe=None,
                              exeModule=None):
         """
@@ -347,12 +359,7 @@
                 exe = Utilities.getExecutablePath(exe)
             if exe:
                 available = True
-                if (
-                    versionCommand and
-                    (versionStartsWith != "" or
-                     (versionRe is not None and versionRe != "")) and
-                    versionPosition
-                ):
+                if versionCommand and versionPosition is not None:
                     proc = QProcess()
                     proc.setProcessChannelMode(QProcess.MergedChannels)
                     if exeModule:
@@ -374,6 +381,20 @@
                         ):
                             version = self.tr("(module not found)")
                             available = False
+                        elif not versionStartsWith and not versionRe:
+                            # assume output is just one line
+                            try:
+                                version = (
+                                    output.strip().split()[versionPosition]
+                                )
+                                if versionCleanup:
+                                    version = version[
+                                        versionCleanup[0]:
+                                        versionCleanup[1]
+                                    ]
+                            except IndexError:
+                                version = self.tr("(unknown)")
+                                available = False
                         else:
                             if versionRe is None:
                                 versionRe = "^{0}".format(

eric ide

mercurial