--- a/eric6/UI/UserInterface.py Fri May 08 18:02:25 2020 +0200 +++ b/eric6/UI/UserInterface.py Fri May 08 18:10:05 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( @@ -497,7 +497,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) @@ -2221,7 +2221,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 @@ -2247,7 +2247,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 @@ -4885,43 +4885,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: @@ -4948,47 +4921,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') @@ -5020,83 +4991,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): """ @@ -5578,7 +5545,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: @@ -5641,7 +5608,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: @@ -5707,7 +5674,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: @@ -5769,7 +5736,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: @@ -5833,7 +5800,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: @@ -5870,7 +5837,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: @@ -5936,7 +5903,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: