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