723 elif self.layout == "FloatingWindows": |
723 elif self.layout == "FloatingWindows": |
724 logging.debug("Creating floating windows...") |
724 logging.debug("Creating floating windows...") |
725 self.__createFloatingWindowsLayout(debugServer) |
725 self.__createFloatingWindowsLayout(debugServer) |
726 |
726 |
727 else: |
727 else: |
728 raise RuntimeError("wrong layout type given (%s)" % self.layout) |
728 raise RuntimeError("wrong layout type given ({0})".format(self.layout)) |
729 logging.debug("Created Layout") |
729 logging.debug("Created Layout") |
730 |
730 |
731 def __createFloatingWindowsLayout(self, debugServer): |
731 def __createFloatingWindowsLayout(self, debugServer): |
732 """ |
732 """ |
733 Private method to create the FloatingWindows layout. |
733 Private method to create the FloatingWindows layout. |
1346 .format(self.capProject, self.capEditor, Program)) |
1346 .format(self.capProject, self.capEditor, Program)) |
1347 else: |
1347 else: |
1348 if not self.capProject and not self.capEditor: |
1348 if not self.capProject and not self.capEditor: |
1349 self.setWindowTitle(Program) |
1349 self.setWindowTitle(Program) |
1350 elif self.capProject and not self.capEditor: |
1350 elif self.capProject and not self.capEditor: |
1351 self.setWindowTitle("%s - %s" % (self.capProject, Program)) |
1351 self.setWindowTitle("{0} - {1}".format(self.capProject, Program)) |
1352 elif not self.capProject and self.capEditor: |
1352 elif not self.capProject and self.capEditor: |
1353 self.setWindowTitle("%s - %s" % (self.capEditor, Program)) |
1353 self.setWindowTitle("{0} - {1}".format(self.capEditor, Program)) |
1354 else: |
1354 else: |
1355 self.setWindowTitle("%s - %s - %s" % \ |
1355 self.setWindowTitle("{0} - {1} - {2}".format( |
1356 (self.capProject, self.capEditor, Program)) |
1356 self.capProject, self.capEditor, Program)) |
1357 |
1357 |
1358 def __initActions(self): |
1358 def __initActions(self): |
1359 """ |
1359 """ |
1360 Private method to define the user interface actions. |
1360 Private method to define the user interface actions. |
1361 """ |
1361 """ |
1869 self.utProjectAct.setEnabled(False) |
1869 self.utProjectAct.setEnabled(False) |
1870 self.actions.append(self.utProjectAct) |
1870 self.actions.append(self.utProjectAct) |
1871 |
1871 |
1872 # check for Qt4 designer and linguist |
1872 # check for Qt4 designer and linguist |
1873 designerExe = Utilities.isWindowsPlatform() and \ |
1873 designerExe = Utilities.isWindowsPlatform() and \ |
1874 "%s.exe" % Utilities.generateQtToolName("designer") or \ |
1874 "{0}.exe".format(Utilities.generateQtToolName("designer")) or \ |
1875 Utilities.generateQtToolName("designer") |
1875 Utilities.generateQtToolName("designer") |
1876 if Utilities.isinpath(designerExe): |
1876 if Utilities.isinpath(designerExe): |
1877 self.designer4Act = E5Action(self.trUtf8('Qt-Designer 4'), |
1877 self.designer4Act = E5Action(self.trUtf8('Qt-Designer 4'), |
1878 UI.PixmapCache.getIcon("designer4.png"), |
1878 UI.PixmapCache.getIcon("designer4.png"), |
1879 self.trUtf8('&Designer 4...'), 0, 0, self, 'qt_designer4') |
1879 self.trUtf8('&Designer 4...'), 0, 0, self, 'qt_designer4') |
1886 self.actions.append(self.designer4Act) |
1886 self.actions.append(self.designer4Act) |
1887 else: |
1887 else: |
1888 self.designer4Act = None |
1888 self.designer4Act = None |
1889 |
1889 |
1890 linguistExe = Utilities.isWindowsPlatform() and \ |
1890 linguistExe = Utilities.isWindowsPlatform() and \ |
1891 "%s.exe" % Utilities.generateQtToolName("linguist") or \ |
1891 "{0}.exe".format(Utilities.generateQtToolName("linguist")) or \ |
1892 Utilities.generateQtToolName("linguist") |
1892 Utilities.generateQtToolName("linguist") |
1893 if Utilities.isinpath(linguistExe): |
1893 if Utilities.isinpath(linguistExe): |
1894 self.linguist4Act = E5Action(self.trUtf8('Qt-Linguist 4'), |
1894 self.linguist4Act = E5Action(self.trUtf8('Qt-Linguist 4'), |
1895 UI.PixmapCache.getIcon("linguist4.png"), |
1895 UI.PixmapCache.getIcon("linguist4.png"), |
1896 self.trUtf8('&Linguist 4...'), 0, 0, self, 'qt_linguist4') |
1896 self.trUtf8('&Linguist 4...'), 0, 0, self, 'qt_linguist4') |
2660 category = self.trUtf8("External Tools/{0}").format(toolGroup[0]) |
2660 category = self.trUtf8("External Tools/{0}").format(toolGroup[0]) |
2661 for tool in toolGroup[1]: |
2661 for tool in toolGroup[1]: |
2662 if tool['menutext'] != '--': |
2662 if tool['menutext'] != '--': |
2663 act = QAction(UI.PixmapCache.getIcon(tool['icon']), tool['menutext'], |
2663 act = QAction(UI.PixmapCache.getIcon(tool['icon']), tool['menutext'], |
2664 self) |
2664 self) |
2665 act.setObjectName("%s@@%s" % (toolGroup[0], |
2665 act.setObjectName("{0}@@{1}".format(toolGroup[0], |
2666 tool['menutext'])) |
2666 tool['menutext'])) |
2667 self.connect(act, SIGNAL("triggered()"), self.__toolActionTriggered) |
2667 self.connect(act, SIGNAL("triggered()"), self.__toolActionTriggered) |
2668 self.toolGroupActions[act.objectName()] = act |
2668 self.toolGroupActions[act.objectName()] = act |
2669 |
2669 |
2670 self.toolbarManager.addAction(act, category) |
2670 self.toolbarManager.addAction(act, category) |
2672 def __updateExternalToolsActions(self): |
2672 def __updateExternalToolsActions(self): |
2673 """ |
2673 """ |
2674 Private method to update the external tools actions for the current tool group. |
2674 Private method to update the external tools actions for the current tool group. |
2675 """ |
2675 """ |
2676 toolGroup = self.toolGroups[self.currentToolGroup] |
2676 toolGroup = self.toolGroups[self.currentToolGroup] |
2677 groupkey = "%s@@" % toolGroup[0] |
2677 groupkey = "{0}@@".format(toolGroup[0]) |
2678 groupActionKeys = [] |
2678 groupActionKeys = [] |
2679 # step 1: get actions for this group |
2679 # step 1: get actions for this group |
2680 for key in self.toolGroupActions: |
2680 for key in self.toolGroupActions: |
2681 if key.startswith(groupkey): |
2681 if key.startswith(groupkey): |
2682 groupActionKeys.append(key) |
2682 groupActionKeys.append(key) |
2683 |
2683 |
2684 # step 2: build keys for all actions i.a.w. current configuration |
2684 # step 2: build keys for all actions i.a.w. current configuration |
2685 ckeys = [] |
2685 ckeys = [] |
2686 for tool in toolGroup[1]: |
2686 for tool in toolGroup[1]: |
2687 if tool['menutext'] != '--': |
2687 if tool['menutext'] != '--': |
2688 ckeys.append("%s@@%s" % (toolGroup[0], tool['menutext'])) |
2688 ckeys.append("{0}@@{1}".format(toolGroup[0], tool['menutext'])) |
2689 |
2689 |
2690 # step 3: remove all actions not configured any more |
2690 # step 3: remove all actions not configured any more |
2691 for key in groupActionKeys: |
2691 for key in groupActionKeys: |
2692 if key not in ckeys: |
2692 if key not in ckeys: |
2693 self.toolbarManager.removeAction(self.toolGroupActions[key]) |
2693 self.toolbarManager.removeAction(self.toolGroupActions[key]) |
2697 |
2697 |
2698 # step 4: add all newly configured tools |
2698 # step 4: add all newly configured tools |
2699 category = self.trUtf8("External Tools/{0}").format(toolGroup[0]) |
2699 category = self.trUtf8("External Tools/{0}").format(toolGroup[0]) |
2700 for tool in toolGroup[1]: |
2700 for tool in toolGroup[1]: |
2701 if tool['menutext'] != '--': |
2701 if tool['menutext'] != '--': |
2702 key = "%s@@%s" % (toolGroup[0], tool['menutext']) |
2702 key = "{0}@@{1}".format(toolGroup[0], tool['menutext']) |
2703 if key not in groupActionKeys: |
2703 if key not in groupActionKeys: |
2704 act = QAction(UI.PixmapCache.getIcon(tool['icon']), tool['menutext'], |
2704 act = QAction(UI.PixmapCache.getIcon(tool['icon']), tool['menutext'], |
2705 self) |
2705 self) |
2706 act.setObjectName(key) |
2706 act.setObjectName(key) |
2707 self.connect(act, SIGNAL("triggered()"), self.__toolActionTriggered) |
2707 self.connect(act, SIGNAL("triggered()"), self.__toolActionTriggered) |
2866 body = f.read() |
2866 body = f.read() |
2867 f.close() |
2867 f.close() |
2868 if deleteAttachFile: |
2868 if deleteAttachFile: |
2869 os.remove(attachFile) |
2869 os.remove(attachFile) |
2870 else: |
2870 else: |
2871 body = "\r\n----\r\n%s----\r\n%s----\r\n%s" % \ |
2871 body = "\r\n----\r\n{0}----\r\n{1}----\r\n{2}".format( |
2872 (Utilities.generateVersionInfo("\r\n"), |
2872 Utilities.generateVersionInfo("\r\n"), |
2873 Utilities.generatePluginsVersionInfo("\r\n"), |
2873 Utilities.generatePluginsVersionInfo("\r\n"), |
2874 Utilities.generateDistroInfo("\r\n")) |
2874 Utilities.generateDistroInfo("\r\n")) |
2875 |
2875 |
2876 url = QUrl("mailto:%s" % address) |
2876 url = QUrl("mailto:{0}".format(address)) |
2877 url.addQueryItem("subject", subject) |
2877 url.addQueryItem("subject", subject) |
2878 url.addQueryItem("body", body) |
2878 url.addQueryItem("body", body) |
2879 QDesktopServices.openUrl(url) |
2879 QDesktopServices.openUrl(url) |
2880 |
2880 |
2881 def checkForErrorLog(self): |
2881 def checkForErrorLog(self): |
3045 @param toolbar reference to the toolbar to be registered (QToolBar) |
3045 @param toolbar reference to the toolbar to be registered (QToolBar) |
3046 @exception KeyError raised, if a toolbar with the given name was |
3046 @exception KeyError raised, if a toolbar with the given name was |
3047 already registered |
3047 already registered |
3048 """ |
3048 """ |
3049 if name in self.__toolbars: |
3049 if name in self.__toolbars: |
3050 raise KeyError("Toolbar '%s' already registered." % name) |
3050 raise KeyError("Toolbar '{0}' already registered.".format(name)) |
3051 |
3051 |
3052 self.__toolbars[name] = [text, toolbar] |
3052 self.__toolbars[name] = [text, toolbar] |
3053 |
3053 |
3054 def reregisterToolbar(self, name, text): |
3054 def reregisterToolbar(self, name, text): |
3055 """ |
3055 """ |
4529 |
4529 |
4530 if toolProcData[0] is None or \ |
4530 if toolProcData[0] is None or \ |
4531 toolProcData[1] not in ["insert", "replaceSelection"]: |
4531 toolProcData[1] not in ["insert", "replaceSelection"]: |
4532 # not connected to an editor or wrong mode |
4532 # not connected to an editor or wrong mode |
4533 while toolProc.canReadLine(): |
4533 while toolProc.canReadLine(): |
4534 s = "%s - " % program |
4534 s = "{0} - ".format(program) |
4535 output = str(toolProc.readLine(), ioEncoding, 'replace') |
4535 output = str(toolProc.readLine(), ioEncoding, 'replace') |
4536 s.append(output) |
4536 s.append(output) |
4537 self.appendToStdout(s) |
4537 self.appendToStdout(s) |
4538 else: |
4538 else: |
4539 if toolProcData[1] == "insert": |
4539 if toolProcData[1] == "insert": |
4552 # loop through all running tool processes |
4552 # loop through all running tool processes |
4553 for program, toolProc, toolProcData in self.toolProcs: |
4553 for program, toolProc, toolProcData in self.toolProcs: |
4554 toolProc.setReadChannel(QProcess.StandardError) |
4554 toolProc.setReadChannel(QProcess.StandardError) |
4555 |
4555 |
4556 while toolProc.canReadLine(): |
4556 while toolProc.canReadLine(): |
4557 s = "%s - " % program |
4557 s = "{0} - ".format(program) |
4558 error = str(toolProc.readLine(), ioEncoding, 'replace') |
4558 error = str(toolProc.readLine(), ioEncoding, 'replace') |
4559 s.append(error) |
4559 s.append(error) |
4560 self.appendToStderr(s) |
4560 self.appendToStderr(s) |
4561 |
4561 |
4562 def __toolFinished(self, exitCode, exitStatus): |
4562 def __toolFinished(self, exitCode, exitStatus): |
4603 if not os.path.splitext(pythonDocDir)[1]: |
4603 if not os.path.splitext(pythonDocDir)[1]: |
4604 home = Utilities.normjoinpath(pythonDocDir, 'index.html') |
4604 home = Utilities.normjoinpath(pythonDocDir, 'index.html') |
4605 |
4605 |
4606 if Utilities.isWindowsPlatform() and not os.path.exists(home): |
4606 if Utilities.isWindowsPlatform() and not os.path.exists(home): |
4607 pyversion = sys.hexversion >> 16 |
4607 pyversion = sys.hexversion >> 16 |
4608 vers = "%d%d" % ((pyversion >> 8) & 0xff, pyversion & 0xff) |
4608 vers = "{0:d}{1:d}".format((pyversion >> 8) & 0xff, pyversion & 0xff) |
4609 home = os.path.join(pythonDocDir, "python%s.chm" % vers) |
4609 home = os.path.join(pythonDocDir, "python{0}.chm".format(vers)) |
4610 else: |
4610 else: |
4611 home = pythonDocDir |
4611 home = pythonDocDir |
4612 |
4612 |
4613 if not os.path.exists(home): |
4613 if not os.path.exists(home): |
4614 QMessageBox.warning(None, |
4614 QMessageBox.warning(None, |