eric6/UI/UserInterface.py

branch
multi_processing
changeset 7627
812ee8c0a91a
parent 7564
787684e6f2f3
parent 7586
9ca5907d5ed3
child 7646
39e3db2b4936
diff -r e8688eb98b98 -r 812ee8c0a91a eric6/UI/UserInterface.py
--- a/eric6/UI/UserInterface.py	Sun May 03 13:42:52 2020 +0200
+++ b/eric6/UI/UserInterface.py	Wed Jun 17 17:14:12 2020 +0200
@@ -358,7 +358,7 @@
             self.viewmanager.closeWindow)
         self.projectBrowser.prBrowser.appendStderr.connect(self.appendToStderr)
         
-        self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist4)
+        self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist)
         self.projectBrowser.ptBrowser.sourceFile.connect(
             self.viewmanager.openSourceFile)
         self.projectBrowser.ptBrowser.trpreview[list].connect(
@@ -399,7 +399,7 @@
         
         self.project.sourceFile.connect(self.viewmanager.openSourceFile)
         self.project.designerFile.connect(self.__designer)
-        self.project.linguistFile.connect(self.__linguist4)
+        self.project.linguistFile.connect(self.__linguist)
         self.project.projectOpened.connect(self.viewmanager.projectOpened)
         self.project.projectClosed.connect(self.viewmanager.projectClosed)
         self.project.projectFileRenamed.connect(
@@ -485,7 +485,7 @@
             self.browser.sourceFile[str, int, str].connect(
                 self.viewmanager.openSourceFile)
             self.browser.designerFile.connect(self.__designer)
-            self.browser.linguistFile.connect(self.__linguist4)
+            self.browser.linguistFile.connect(self.__linguist)
             self.browser.projectFile.connect(self.project.openProject)
             self.browser.multiProjectFile.connect(
                 self.multiProject.openMultiProject)
@@ -2209,7 +2209,7 @@
                 """<b>Qt-Designer</b>"""
                 """<p>Start Qt-Designer.</p>"""
             ))
-            self.designer4Act.triggered.connect(self.__designer4)
+            self.designer4Act.triggered.connect(self.__designer)
             self.actions.append(self.designer4Act)
         else:
             self.designer4Act = None
@@ -2235,7 +2235,7 @@
                 """<b>Qt-Linguist</b>"""
                 """<p>Start Qt-Linguist.</p>"""
             ))
-            self.linguist4Act.triggered.connect(self.__linguist4)
+            self.linguist4Act.triggered.connect(self.__linguist)
             self.actions.append(self.linguist4Act)
         else:
             self.linguist4Act = None
@@ -4873,43 +4873,16 @@
         """
         self.__unittest()
         self.unittestDialog.startTests(failedOnly=True)
-        
-    def __designer(self, fn=None, version=0):
+    
+    @pyqtSlot()
+    @pyqtSlot(str)
+    def __designer(self, fn=None):
         """
         Private slot to start the Qt-Designer executable.
         
         @param fn filename of the form to be opened
         @type str
-        @param version indication for the requested version (4 = Qt 4/5)
-        @type int
-        """
-        if fn is not None and version == 0:
-            # determine version from file, if not specified
-            try:
-                f = open(fn, "r", encoding="utf-8")
-                found = False
-                while not found:
-                    uiLine = f.readline()
-                    found = uiLine.lower().startswith("<ui ")
-                f.close()
-                if uiLine.lower().find("version") == -1:
-                    # it is an old version 3 UI file
-                    version = 3
-                else:
-                    if uiLine.split('"')[1].startswith("4."):
-                        version = 4
-                    else:
-                        version = 3
-            except IOError:
-                pass
-        
-        if version == 3:
-            E5MessageBox.information(
-                self,
-                self.tr("Qt 3 support"),
-                self.tr("""Qt v.3 is not supported by eric6."""))
-            return
-
+        """
         args = []
         if fn is not None:
             try:
@@ -4936,47 +4909,45 @@
         
         if Utilities.isMacPlatform():
             designer, args = Utilities.prepareQtMacBundle(
-                "designer", version, args)
+                "designer", args)
         else:
-            if version == 4:
-                designer = os.path.join(
-                    Utilities.getQtBinariesPath(),
-                    Utilities.generateQtToolName("designer"))
+            designer = os.path.join(
+                Utilities.getQtBinariesPath(),
+                Utilities.generateQtToolName("designer"))
             if Utilities.isWindowsPlatform():
                 designer += '.exe'
         
-        proc = QProcess()
-        if not proc.startDetached(designer, args):
+        if designer:
+            proc = QProcess()
+            if not proc.startDetached(designer, args):
+                E5MessageBox.critical(
+                    self,
+                    self.tr('Process Generation Error'),
+                    self.tr(
+                        '<p>Could not start Qt-Designer.<br>'
+                        'Ensure that it is available as <b>{0}</b>.</p>'
+                    ).format(designer)
+                )
+        else:
             E5MessageBox.critical(
                 self,
                 self.tr('Process Generation Error'),
                 self.tr(
-                    '<p>Could not start Qt-Designer.<br>'
-                    'Ensure that it is available as <b>{0}</b>.</p>'
-                ).format(designer))
-        
-    def __designer4(self):
-        """
-        Private slot to start the Qt-Designer 4/5 executable.
-        """
-        self.__designer(version=4)
-        
-    def __linguist(self, fn=None, version=0):
+                    '<p>Could not find the Qt-Designer executable.<br>'
+                    'Ensure that it is installed and optionally configured on'
+                    ' the Qt configuration page.</p>'
+                )
+            )
+    
+    @pyqtSlot()
+    @pyqtSlot(str)
+    def __linguist(self, fn=None):
         """
         Private slot to start the Qt-Linguist executable.
         
         @param fn filename of the translation file to be opened
         @type str
-        @param version indication for the requested version (4 = Qt 4/5)
-        @type int
-        """
-        if version < 4:
-            E5MessageBox.information(
-                self,
-                self.tr("Qt 3 support"),
-                self.tr("""Qt v.3 is not supported by eric6."""))
-            return
-
+        """
         args = []
         if fn is not None:
             fn = fn.replace('.qm', '.ts')
@@ -5008,83 +4979,79 @@
         
         if Utilities.isMacPlatform():
             linguist, args = Utilities.prepareQtMacBundle(
-                "linguist", version, args)
+                "linguist", args)
         else:
-            if version == 4:
-                linguist = os.path.join(
-                    Utilities.getQtBinariesPath(),
-                    Utilities.generateQtToolName("linguist"))
+            linguist = os.path.join(
+                Utilities.getQtBinariesPath(),
+                Utilities.generateQtToolName("linguist"))
             if Utilities.isWindowsPlatform():
                 linguist += '.exe'
         
-        proc = QProcess()
-        if not proc.startDetached(linguist, args):
+        if linguist:
+            proc = QProcess()
+            if not proc.startDetached(linguist, args):
+                E5MessageBox.critical(
+                    self,
+                    self.tr('Process Generation Error'),
+                    self.tr(
+                        '<p>Could not start Qt-Linguist.<br>'
+                        'Ensure that it is available as <b>{0}</b>.</p>'
+                    ).format(linguist)
+                )
+        else:
             E5MessageBox.critical(
                 self,
                 self.tr('Process Generation Error'),
                 self.tr(
-                    '<p>Could not start Qt-Linguist.<br>'
-                    'Ensure that it is available as <b>{0}</b>.</p>'
-                ).format(linguist))
+                    '<p>Could not find the Qt-Linguist executable.<br>'
+                    'Ensure that it is installed and optionally configured on'
+                    ' the Qt configuration page.</p>'
+                )
+            )
     
-    @pyqtSlot()
-    @pyqtSlot(str)
-    def __linguist4(self, fn=None):
-        """
-        Private slot to start the Qt-Linguist 4/5 executable.
-        
-        @param fn filename of the translation file to be opened
-        """
-        self.__linguist(fn, version=4)
-
-    def __assistant(self, home=None, version=0):
+    def __assistant(self, home=None):
         """
         Private slot to start the Qt-Assistant executable.
         
         @param home full pathname of a file to display
         @type str
-        @param version indication for the requested version (4 = Qt 4/5)
-        @type int
-        """
-        if version < 4:
-            E5MessageBox.information(
-                self,
-                self.tr("Qt 3 support"),
-                self.tr("""Qt v.3 is not supported by eric6."""))
-            return
-
+        """
         args = []
         if home:
-            if version == 4:
-                args.append('-showUrl')
+            args.append('-showUrl')
             args.append(home)
         
         if Utilities.isMacPlatform():
             assistant, args = Utilities.prepareQtMacBundle(
-                "assistant", version, args)
+                "assistant", args)
         else:
-            if version == 4:
-                assistant = os.path.join(
-                    Utilities.getQtBinariesPath(),
-                    Utilities.generateQtToolName("assistant"))
+            assistant = os.path.join(
+                Utilities.getQtBinariesPath(),
+                Utilities.generateQtToolName("assistant"))
             if Utilities.isWindowsPlatform():
                 assistant += '.exe'
         
-        proc = QProcess()
-        if not proc.startDetached(assistant, args):
+        if assistant:
+            proc = QProcess()
+            if not proc.startDetached(assistant, args):
+                E5MessageBox.critical(
+                    self,
+                    self.tr('Process Generation Error'),
+                    self.tr(
+                        '<p>Could not start Qt-Assistant.<br>'
+                        'Ensure that it is available as <b>{0}</b>.</p>'
+                    ).format(assistant)
+                )
+        else:
             E5MessageBox.critical(
                 self,
                 self.tr('Process Generation Error'),
                 self.tr(
-                    '<p>Could not start Qt-Assistant.<br>'
-                    'Ensure that it is available as <b>{0}</b>.</p>'
-                ).format(assistant))
-        
-    def __assistant4(self):
-        """
-        Private slot to start the Qt-Assistant 4/5 executable.
-        """
-        self.__assistant(version=4)
+                    '<p>Could not find the Qt-Assistant executable.<br>'
+                    'Ensure that it is installed and optionally configured on'
+                    ' the Qt configuration page.</p>'
+                )
+            )
     
     def __startWebBrowser(self):
         """
@@ -5566,7 +5533,7 @@
                 self.launchHelpViewer(home)
             elif hvType == 2:
                 if home.startswith("qthelp://"):
-                    self.__assistant(home, version=4)
+                    self.__assistant(home)
                 else:
                     self.__webBrowser(home)
             elif hvType == 3:
@@ -5629,7 +5596,7 @@
                 self.launchHelpViewer(home)
             elif hvType == 2:
                 if home.startswith("qthelp://"):
-                    self.__assistant(home, version=4)
+                    self.__assistant(home)
                 else:
                     self.__webBrowser(home)
             elif hvType == 3:
@@ -5695,7 +5662,7 @@
             self.launchHelpViewer(home)
         elif hvType == 2:
             if home.startswith("qthelp://"):
-                self.__assistant(home, version=4)
+                self.__assistant(home)
             else:
                 self.__webBrowser(home)
         elif hvType == 3:
@@ -5757,7 +5724,7 @@
             self.launchHelpViewer(home)
         elif hvType == 2:
             if home.startswith("qthelp://"):
-                self.__assistant(home, version=4)
+                self.__assistant(home)
             else:
                 self.__webBrowser(home)
         elif hvType == 3:
@@ -5821,7 +5788,7 @@
             self.launchHelpViewer(home)
         elif hvType == 2:
             if home.startswith("qthelp://"):
-                self.__assistant(home, version=4)
+                self.__assistant(home)
             else:
                 self.__webBrowser(home)
         elif hvType == 3:
@@ -5858,7 +5825,7 @@
             self.launchHelpViewer(home)
         elif hvType == 2:
             if home.startswith("qthelp://"):
-                self.__assistant(home, version=4)
+                self.__assistant(home)
             else:
                 self.__webBrowser(home)
         elif hvType == 3:
@@ -5924,7 +5891,7 @@
             self.launchHelpViewer(home)
         elif hvType == 2:
             if home.startswith("qthelp://"):
-                self.__assistant(home, version=4)
+                self.__assistant(home)
             else:
                 self.__webBrowser(home)
         elif hvType == 3:

eric ide

mercurial