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