356 self.viewmanager.openSourceFile) |
356 self.viewmanager.openSourceFile) |
357 self.projectBrowser.prBrowser.closeSourceWindow.connect( |
357 self.projectBrowser.prBrowser.closeSourceWindow.connect( |
358 self.viewmanager.closeWindow) |
358 self.viewmanager.closeWindow) |
359 self.projectBrowser.prBrowser.appendStderr.connect(self.appendToStderr) |
359 self.projectBrowser.prBrowser.appendStderr.connect(self.appendToStderr) |
360 |
360 |
361 self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist4) |
361 self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist) |
362 self.projectBrowser.ptBrowser.sourceFile.connect( |
362 self.projectBrowser.ptBrowser.sourceFile.connect( |
363 self.viewmanager.openSourceFile) |
363 self.viewmanager.openSourceFile) |
364 self.projectBrowser.ptBrowser.trpreview[list].connect( |
364 self.projectBrowser.ptBrowser.trpreview[list].connect( |
365 self.__TRPreviewer) |
365 self.__TRPreviewer) |
366 self.projectBrowser.ptBrowser.trpreview[list, bool].connect( |
366 self.projectBrowser.ptBrowser.trpreview[list, bool].connect( |
397 self.projectBrowser.poBrowser.svgFile.connect(self.__showSvg) |
397 self.projectBrowser.poBrowser.svgFile.connect(self.__showSvg) |
398 self.projectBrowser.poBrowser.binaryFile.connect(self.__openHexEditor) |
398 self.projectBrowser.poBrowser.binaryFile.connect(self.__openHexEditor) |
399 |
399 |
400 self.project.sourceFile.connect(self.viewmanager.openSourceFile) |
400 self.project.sourceFile.connect(self.viewmanager.openSourceFile) |
401 self.project.designerFile.connect(self.__designer) |
401 self.project.designerFile.connect(self.__designer) |
402 self.project.linguistFile.connect(self.__linguist4) |
402 self.project.linguistFile.connect(self.__linguist) |
403 self.project.projectOpened.connect(self.viewmanager.projectOpened) |
403 self.project.projectOpened.connect(self.viewmanager.projectOpened) |
404 self.project.projectClosed.connect(self.viewmanager.projectClosed) |
404 self.project.projectClosed.connect(self.viewmanager.projectClosed) |
405 self.project.projectFileRenamed.connect( |
405 self.project.projectFileRenamed.connect( |
406 self.viewmanager.projectFileRenamed) |
406 self.viewmanager.projectFileRenamed) |
407 self.project.lexerAssociationsChanged.connect( |
407 self.project.lexerAssociationsChanged.connect( |
495 self.browser.sourceFile[str, list].connect( |
495 self.browser.sourceFile[str, list].connect( |
496 self.viewmanager.openSourceFile) |
496 self.viewmanager.openSourceFile) |
497 self.browser.sourceFile[str, int, str].connect( |
497 self.browser.sourceFile[str, int, str].connect( |
498 self.viewmanager.openSourceFile) |
498 self.viewmanager.openSourceFile) |
499 self.browser.designerFile.connect(self.__designer) |
499 self.browser.designerFile.connect(self.__designer) |
500 self.browser.linguistFile.connect(self.__linguist4) |
500 self.browser.linguistFile.connect(self.__linguist) |
501 self.browser.projectFile.connect(self.project.openProject) |
501 self.browser.projectFile.connect(self.project.openProject) |
502 self.browser.multiProjectFile.connect( |
502 self.browser.multiProjectFile.connect( |
503 self.multiProject.openMultiProject) |
503 self.multiProject.openMultiProject) |
504 self.browser.pixmapEditFile.connect(self.__editPixmap) |
504 self.browser.pixmapEditFile.connect(self.__editPixmap) |
505 self.browser.pixmapFile.connect(self.__showPixmap) |
505 self.browser.pixmapFile.connect(self.__showPixmap) |
4882 Private slot to display the unittest dialog and rerun all failed tests |
4882 Private slot to display the unittest dialog and rerun all failed tests |
4883 of the last run. |
4883 of the last run. |
4884 """ |
4884 """ |
4885 self.__unittest() |
4885 self.__unittest() |
4886 self.unittestDialog.startTests(failedOnly=True) |
4886 self.unittestDialog.startTests(failedOnly=True) |
4887 |
4887 |
4888 def __designer(self, fn=None, version=0): |
4888 @pyqtSlot() |
|
4889 @pyqtSlot(str) |
|
4890 def __designer(self, fn=None): |
4889 """ |
4891 """ |
4890 Private slot to start the Qt-Designer executable. |
4892 Private slot to start the Qt-Designer executable. |
4891 |
4893 |
4892 @param fn filename of the form to be opened |
4894 @param fn filename of the form to be opened |
4893 @type str |
4895 @type str |
4894 @param version indication for the requested version (4 = Qt 4/5) |
4896 """ |
4895 @type int |
|
4896 """ |
|
4897 if fn is not None and version == 0: |
|
4898 # determine version from file, if not specified |
|
4899 try: |
|
4900 f = open(fn, "r", encoding="utf-8") |
|
4901 found = False |
|
4902 while not found: |
|
4903 uiLine = f.readline() |
|
4904 found = uiLine.lower().startswith("<ui ") |
|
4905 f.close() |
|
4906 if uiLine.lower().find("version") == -1: |
|
4907 # it is an old version 3 UI file |
|
4908 version = 3 |
|
4909 else: |
|
4910 if uiLine.split('"')[1].startswith("4."): |
|
4911 version = 4 |
|
4912 else: |
|
4913 version = 3 |
|
4914 except IOError: |
|
4915 pass |
|
4916 |
|
4917 if version == 3: |
|
4918 E5MessageBox.information( |
|
4919 self, |
|
4920 self.tr("Qt 3 support"), |
|
4921 self.tr("""Qt v.3 is not supported by eric6.""")) |
|
4922 return |
|
4923 |
|
4924 args = [] |
4897 args = [] |
4925 if fn is not None: |
4898 if fn is not None: |
4926 try: |
4899 try: |
4927 if os.path.isfile(fn) and os.path.getsize(fn): |
4900 if os.path.isfile(fn) and os.path.getsize(fn): |
4928 args.append(fn) |
4901 args.append(fn) |
4945 .format(fn)) |
4918 .format(fn)) |
4946 return |
4919 return |
4947 |
4920 |
4948 if Utilities.isMacPlatform(): |
4921 if Utilities.isMacPlatform(): |
4949 designer, args = Utilities.prepareQtMacBundle( |
4922 designer, args = Utilities.prepareQtMacBundle( |
4950 "designer", version, args) |
4923 "designer", args) |
4951 else: |
4924 else: |
4952 if version == 4: |
4925 designer = os.path.join( |
4953 designer = os.path.join( |
4926 Utilities.getQtBinariesPath(), |
4954 Utilities.getQtBinariesPath(), |
4927 Utilities.generateQtToolName("designer")) |
4955 Utilities.generateQtToolName("designer")) |
|
4956 if Utilities.isWindowsPlatform(): |
4928 if Utilities.isWindowsPlatform(): |
4957 designer += '.exe' |
4929 designer += '.exe' |
4958 |
4930 |
4959 proc = QProcess() |
4931 if designer: |
4960 if not proc.startDetached(designer, args): |
4932 proc = QProcess() |
|
4933 if not proc.startDetached(designer, args): |
|
4934 E5MessageBox.critical( |
|
4935 self, |
|
4936 self.tr('Process Generation Error'), |
|
4937 self.tr( |
|
4938 '<p>Could not start Qt-Designer.<br>' |
|
4939 'Ensure that it is available as <b>{0}</b>.</p>' |
|
4940 ).format(designer) |
|
4941 ) |
|
4942 else: |
4961 E5MessageBox.critical( |
4943 E5MessageBox.critical( |
4962 self, |
4944 self, |
4963 self.tr('Process Generation Error'), |
4945 self.tr('Process Generation Error'), |
4964 self.tr( |
4946 self.tr( |
4965 '<p>Could not start Qt-Designer.<br>' |
4947 '<p>Could not find the Qt-Designer executable.<br>' |
4966 'Ensure that it is available as <b>{0}</b>.</p>' |
4948 'Ensure that it is installed and optionally configured on' |
4967 ).format(designer)) |
4949 ' the Qt configuration page.</p>' |
4968 |
4950 ) |
4969 def __designer4(self): |
4951 ) |
4970 """ |
4952 |
4971 Private slot to start the Qt-Designer 4/5 executable. |
4953 @pyqtSlot() |
4972 """ |
4954 @pyqtSlot(str) |
4973 self.__designer(version=4) |
4955 def __linguist(self, fn=None): |
4974 |
|
4975 def __linguist(self, fn=None, version=0): |
|
4976 """ |
4956 """ |
4977 Private slot to start the Qt-Linguist executable. |
4957 Private slot to start the Qt-Linguist executable. |
4978 |
4958 |
4979 @param fn filename of the translation file to be opened |
4959 @param fn filename of the translation file to be opened |
4980 @type str |
4960 @type str |
4981 @param version indication for the requested version (4 = Qt 4/5) |
4961 """ |
4982 @type int |
|
4983 """ |
|
4984 if version < 4: |
|
4985 E5MessageBox.information( |
|
4986 self, |
|
4987 self.tr("Qt 3 support"), |
|
4988 self.tr("""Qt v.3 is not supported by eric6.""")) |
|
4989 return |
|
4990 |
|
4991 args = [] |
4962 args = [] |
4992 if fn is not None: |
4963 if fn is not None: |
4993 fn = fn.replace('.qm', '.ts') |
4964 fn = fn.replace('.qm', '.ts') |
4994 try: |
4965 try: |
4995 if ( |
4966 if ( |
5017 .format(fn)) |
4988 .format(fn)) |
5018 return |
4989 return |
5019 |
4990 |
5020 if Utilities.isMacPlatform(): |
4991 if Utilities.isMacPlatform(): |
5021 linguist, args = Utilities.prepareQtMacBundle( |
4992 linguist, args = Utilities.prepareQtMacBundle( |
5022 "linguist", version, args) |
4993 "linguist", args) |
5023 else: |
4994 else: |
5024 if version == 4: |
4995 linguist = os.path.join( |
5025 linguist = os.path.join( |
4996 Utilities.getQtBinariesPath(), |
5026 Utilities.getQtBinariesPath(), |
4997 Utilities.generateQtToolName("linguist")) |
5027 Utilities.generateQtToolName("linguist")) |
|
5028 if Utilities.isWindowsPlatform(): |
4998 if Utilities.isWindowsPlatform(): |
5029 linguist += '.exe' |
4999 linguist += '.exe' |
5030 |
5000 |
5031 proc = QProcess() |
5001 if linguist: |
5032 if not proc.startDetached(linguist, args): |
5002 proc = QProcess() |
|
5003 if not proc.startDetached(linguist, args): |
|
5004 E5MessageBox.critical( |
|
5005 self, |
|
5006 self.tr('Process Generation Error'), |
|
5007 self.tr( |
|
5008 '<p>Could not start Qt-Linguist.<br>' |
|
5009 'Ensure that it is available as <b>{0}</b>.</p>' |
|
5010 ).format(linguist) |
|
5011 ) |
|
5012 else: |
5033 E5MessageBox.critical( |
5013 E5MessageBox.critical( |
5034 self, |
5014 self, |
5035 self.tr('Process Generation Error'), |
5015 self.tr('Process Generation Error'), |
5036 self.tr( |
5016 self.tr( |
5037 '<p>Could not start Qt-Linguist.<br>' |
5017 '<p>Could not find the Qt-Linguist executable.<br>' |
5038 'Ensure that it is available as <b>{0}</b>.</p>' |
5018 'Ensure that it is installed and optionally configured on' |
5039 ).format(linguist)) |
5019 ' the Qt configuration page.</p>' |
5040 |
5020 ) |
5041 @pyqtSlot() |
5021 ) |
5042 @pyqtSlot(str) |
5022 |
5043 def __linguist4(self, fn=None): |
5023 def __assistant(self, home=None): |
5044 """ |
|
5045 Private slot to start the Qt-Linguist 4/5 executable. |
|
5046 |
|
5047 @param fn filename of the translation file to be opened |
|
5048 """ |
|
5049 self.__linguist(fn, version=4) |
|
5050 |
|
5051 def __assistant(self, home=None, version=0): |
|
5052 """ |
5024 """ |
5053 Private slot to start the Qt-Assistant executable. |
5025 Private slot to start the Qt-Assistant executable. |
5054 |
5026 |
5055 @param home full pathname of a file to display |
5027 @param home full pathname of a file to display |
5056 @type str |
5028 @type str |
5057 @param version indication for the requested version (4 = Qt 4/5) |
5029 """ |
5058 @type int |
|
5059 """ |
|
5060 if version < 4: |
|
5061 E5MessageBox.information( |
|
5062 self, |
|
5063 self.tr("Qt 3 support"), |
|
5064 self.tr("""Qt v.3 is not supported by eric6.""")) |
|
5065 return |
|
5066 |
|
5067 args = [] |
5030 args = [] |
5068 if home: |
5031 if home: |
5069 if version == 4: |
5032 args.append('-showUrl') |
5070 args.append('-showUrl') |
|
5071 args.append(home) |
5033 args.append(home) |
5072 |
5034 |
5073 if Utilities.isMacPlatform(): |
5035 if Utilities.isMacPlatform(): |
5074 assistant, args = Utilities.prepareQtMacBundle( |
5036 assistant, args = Utilities.prepareQtMacBundle( |
5075 "assistant", version, args) |
5037 "assistant", args) |
5076 else: |
5038 else: |
5077 if version == 4: |
5039 assistant = os.path.join( |
5078 assistant = os.path.join( |
5040 Utilities.getQtBinariesPath(), |
5079 Utilities.getQtBinariesPath(), |
5041 Utilities.generateQtToolName("assistant")) |
5080 Utilities.generateQtToolName("assistant")) |
|
5081 if Utilities.isWindowsPlatform(): |
5042 if Utilities.isWindowsPlatform(): |
5082 assistant += '.exe' |
5043 assistant += '.exe' |
5083 |
5044 |
5084 proc = QProcess() |
5045 if assistant: |
5085 if not proc.startDetached(assistant, args): |
5046 proc = QProcess() |
|
5047 if not proc.startDetached(assistant, args): |
|
5048 E5MessageBox.critical( |
|
5049 self, |
|
5050 self.tr('Process Generation Error'), |
|
5051 self.tr( |
|
5052 '<p>Could not start Qt-Assistant.<br>' |
|
5053 'Ensure that it is available as <b>{0}</b>.</p>' |
|
5054 ).format(assistant) |
|
5055 ) |
|
5056 else: |
5086 E5MessageBox.critical( |
5057 E5MessageBox.critical( |
5087 self, |
5058 self, |
5088 self.tr('Process Generation Error'), |
5059 self.tr('Process Generation Error'), |
5089 self.tr( |
5060 self.tr( |
5090 '<p>Could not start Qt-Assistant.<br>' |
5061 '<p>Could not find the Qt-Assistant executable.<br>' |
5091 'Ensure that it is available as <b>{0}</b>.</p>' |
5062 'Ensure that it is installed and optionally configured on' |
5092 ).format(assistant)) |
5063 ' the Qt configuration page.</p>' |
5093 |
5064 ) |
5094 def __assistant4(self): |
5065 ) |
5095 """ |
|
5096 Private slot to start the Qt-Assistant 4/5 executable. |
|
5097 """ |
|
5098 self.__assistant(version=4) |
|
5099 |
5066 |
5100 def __startWebBrowser(self): |
5067 def __startWebBrowser(self): |
5101 """ |
5068 """ |
5102 Private slot to start the eric6 web browser. |
5069 Private slot to start the eric6 web browser. |
5103 """ |
5070 """ |