55 |
55 |
56 from Tasks.TaskViewer import TaskViewer |
56 from Tasks.TaskViewer import TaskViewer |
57 |
57 |
58 from Templates.TemplateViewer import TemplateViewer |
58 from Templates.TemplateViewer import TemplateViewer |
59 |
59 |
60 from Browser import Browser |
60 from .Browser import Browser |
61 from Info import * |
61 from .Info import * |
62 import Config |
62 from . import Config |
63 from EmailDialog import EmailDialog |
63 from .EmailDialog import EmailDialog |
64 from DiffDialog import DiffDialog |
64 from .DiffDialog import DiffDialog |
65 from CompareDialog import CompareDialog |
65 from .CompareDialog import CompareDialog |
66 from LogView import LogViewer |
66 from .LogView import LogViewer |
67 from FindFileDialog import FindFileDialog |
67 from .FindFileDialog import FindFileDialog |
68 from FindFileNameDialog import FindFileNameDialog |
68 from .FindFileNameDialog import FindFileNameDialog |
69 from AuthenticationDialog import AuthenticationDialog |
69 from .AuthenticationDialog import AuthenticationDialog |
70 |
70 |
71 from E4Gui.E4SingleApplication import E4SingleApplicationServer |
71 from E4Gui.E4SingleApplication import E4SingleApplicationServer |
72 from E4Gui.E4Action import E4Action, createActionGroup |
72 from E4Gui.E4Action import E4Action, createActionGroup |
73 from E4Gui.E4ToolBarManager import E4ToolBarManager |
73 from E4Gui.E4ToolBarManager import E4ToolBarManager |
74 from E4Gui.E4ToolBarDialog import E4ToolBarDialog |
74 from E4Gui.E4ToolBarDialog import E4ToolBarDialog |
609 Private slot to set the style of the interface. |
609 Private slot to set the style of the interface. |
610 """ |
610 """ |
611 # step 1: set the style |
611 # step 1: set the style |
612 style = None |
612 style = None |
613 styleName = Preferences.getUI("Style") |
613 styleName = Preferences.getUI("Style") |
614 if styleName != "System" and styleName in QStyleFactory.keys(): |
614 if styleName != "System" and styleName in list(QStyleFactory.keys()): |
615 style = QStyleFactory.create(styleName) |
615 style = QStyleFactory.create(styleName) |
616 if style is None: |
616 if style is None: |
617 style = QStyleFactory.create(self.defaultStyleName) |
617 style = QStyleFactory.create(self.defaultStyleName) |
618 if style is not None: |
618 if style is not None: |
619 QApplication.setStyle(style) |
619 QApplication.setStyle(style) |
620 |
620 |
621 # step 2: set a style sheet |
621 # step 2: set a style sheet |
622 styleSheetFile = Preferences.getUI("StyleSheet") |
622 styleSheetFile = Preferences.getUI("StyleSheet") |
623 if styleSheetFile: |
623 if styleSheetFile: |
624 try: |
624 try: |
625 f = open(styleSheetFile, "rb") |
625 f = open(styleSheetFile, "r") |
626 styleSheet = f.read() |
626 styleSheet = f.read() |
627 f.close() |
627 f.close() |
628 except IOError, msg: |
628 except IOError as msg: |
629 QMessageBox.warning(None, |
629 QMessageBox.warning(None, |
630 self.trUtf8("Loading Style Sheet"), |
630 self.trUtf8("Loading Style Sheet"), |
631 self.trUtf8("""<p>The Qt Style Sheet file <b>{0}</b> could""" |
631 self.trUtf8("""<p>The Qt Style Sheet file <b>{0}</b> could""" |
632 """ not be read.<br>Reason: {1}</p>""") |
632 """ not be read.<br>Reason: {1}</p>""") |
633 .format(styleSheetFile, unicode(msg)), |
633 .format(styleSheetFile, str(msg)), |
634 QMessageBox.StandardButtons(\ |
634 QMessageBox.StandardButtons(\ |
635 QMessageBox.Ok)) |
635 QMessageBox.Ok)) |
636 return |
636 return |
637 else: |
637 else: |
638 styleSheet = "" |
638 styleSheet = "" |
3118 Private slot to display the Toolbars menu. |
3118 Private slot to display the Toolbars menu. |
3119 """ |
3119 """ |
3120 self.__menus["toolbars"].clear() |
3120 self.__menus["toolbars"].clear() |
3121 |
3121 |
3122 tbList = [] |
3122 tbList = [] |
3123 for name, (text, tb) in self.__toolbars.items(): |
3123 for name, (text, tb) in list(self.__toolbars.items()): |
3124 tbList.append((text, tb, name)) |
3124 tbList.append((text, tb, name)) |
3125 |
3125 |
3126 tbList.sort() |
3126 tbList.sort() |
3127 for text, tb, name in tbList: |
3127 for text, tb, name in tbList: |
3128 act = self.__menus["toolbars"].addAction(text) |
3128 act = self.__menus["toolbars"].addAction(text) |
3140 Private method to handle the toggle of a toolbar. |
3140 Private method to handle the toggle of a toolbar. |
3141 |
3141 |
3142 @param act reference to the action that was triggered (QAction) |
3142 @param act reference to the action that was triggered (QAction) |
3143 """ |
3143 """ |
3144 if act == self.__toolbarsShowAllAct: |
3144 if act == self.__toolbarsShowAllAct: |
3145 for text, tb in self.__toolbars.values(): |
3145 for text, tb in list(self.__toolbars.values()): |
3146 tb.show() |
3146 tb.show() |
3147 if self.__menus["toolbars"].isTearOffMenuVisible(): |
3147 if self.__menus["toolbars"].isTearOffMenuVisible(): |
3148 self.__showToolbarsMenu() |
3148 self.__showToolbarsMenu() |
3149 elif act == self.__toolbarsHideAllAct: |
3149 elif act == self.__toolbarsHideAllAct: |
3150 for text, tb in self.__toolbars.values(): |
3150 for text, tb in list(self.__toolbars.values()): |
3151 tb.hide() |
3151 tb.hide() |
3152 if self.__menus["toolbars"].isTearOffMenuVisible(): |
3152 if self.__menus["toolbars"].isTearOffMenuVisible(): |
3153 self.__showToolbarsMenu() |
3153 self.__showToolbarsMenu() |
3154 else: |
3154 else: |
3155 name = act.data() |
3155 name = act.data() |
3169 """ |
3169 """ |
3170 if self.currentProfile and save: |
3170 if self.currentProfile and save: |
3171 # step 1: save the window geometries of the active profile |
3171 # step 1: save the window geometries of the active profile |
3172 if self.layout == "DockWindows": |
3172 if self.layout == "DockWindows": |
3173 state = self.saveState() |
3173 state = self.saveState() |
3174 self.profiles[self.currentProfile][1] = str(state) |
3174 self.profiles[self.currentProfile][1] = bytes(state) |
3175 elif self.layout in ["Toolboxes", "Sidebars"]: |
3175 elif self.layout in ["Toolboxes", "Sidebars"]: |
3176 state = self.saveState() |
3176 state = self.saveState() |
3177 self.profiles[self.currentProfile][4] = str(state) |
3177 self.profiles[self.currentProfile][4] = bytes(state) |
3178 if self.layout == "Sidebars": |
3178 if self.layout == "Sidebars": |
3179 state = self.horizontalSplitter.saveState() |
3179 state = self.horizontalSplitter.saveState() |
3180 self.profiles[self.currentProfile][6][0] = str(state) |
3180 self.profiles[self.currentProfile][6][0] = bytes(state) |
3181 state = self.verticalSplitter.saveState() |
3181 state = self.verticalSplitter.saveState() |
3182 self.profiles[self.currentProfile][6][1] = str(state) |
3182 self.profiles[self.currentProfile][6][1] = bytes(state) |
3183 state = self.leftSidebar.saveState() |
3183 state = self.leftSidebar.saveState() |
3184 self.profiles[self.currentProfile][6][2] = str(state) |
3184 self.profiles[self.currentProfile][6][2] = bytes(state) |
3185 state = self.bottomSidebar.saveState() |
3185 state = self.bottomSidebar.saveState() |
3186 self.profiles[self.currentProfile][6][3] = str(state) |
3186 self.profiles[self.currentProfile][6][3] = bytes(state) |
3187 elif self.layout == "FloatingWindows": |
3187 elif self.layout == "FloatingWindows": |
3188 state = self.saveState() |
3188 state = self.saveState() |
3189 self.profiles[self.currentProfile][3] = str(state) |
3189 self.profiles[self.currentProfile][3] = bytes(state) |
3190 for window, i in zip(self.windows, range(len(self.windows))): |
3190 for window, i in zip(self.windows, list(range(len(self.windows)))): |
3191 if window is not None: |
3191 if window is not None: |
3192 self.profiles[self.currentProfile][2][i] = \ |
3192 self.profiles[self.currentProfile][2][i] = \ |
3193 str(window.saveGeometry()) |
3193 bytes(window.saveGeometry()) |
3194 # step 2: save the visibility of the windows of the active profile |
3194 # step 2: save the visibility of the windows of the active profile |
3195 for window, i in zip(self.windows, range(len(self.windows))): |
3195 for window, i in zip(self.windows, list(range(len(self.windows)))): |
3196 if window is not None: |
3196 if window is not None: |
3197 self.profiles[self.currentProfile][0][i] = window.isVisible() |
3197 self.profiles[self.currentProfile][0][i] = window.isVisible() |
3198 Preferences.setUI("ViewProfiles", self.profiles) |
3198 Preferences.setUI("ViewProfiles", self.profiles) |
3199 |
3199 |
3200 def __activateViewProfile(self, name, save = True): |
3200 def __activateViewProfile(self, name, save = True): |
3235 self.__configureDockareaCornerUsage() |
3235 self.__configureDockareaCornerUsage() |
3236 elif self.layout == "FloatingWindows": |
3236 elif self.layout == "FloatingWindows": |
3237 state = QByteArray(self.profiles[name][3]) |
3237 state = QByteArray(self.profiles[name][3]) |
3238 if not state.isEmpty(): |
3238 if not state.isEmpty(): |
3239 self.restoreState(state) |
3239 self.restoreState(state) |
3240 for window, i in zip(self.windows, range(len(self.windows))): |
3240 for window, i in zip(self.windows, list(range(len(self.windows)))): |
3241 if window is not None: |
3241 if window is not None: |
3242 geo = QByteArray(self.profiles[name][2][i]) |
3242 geo = QByteArray(self.profiles[name][2][i]) |
3243 if not geo.isEmpty(): |
3243 if not geo.isEmpty(): |
3244 window.restoreGeometry(geo) |
3244 window.restoreGeometry(geo) |
3245 pass |
3245 pass |
4232 if toolProcData[0] is None or \ |
4232 if toolProcData[0] is None or \ |
4233 toolProcData[1] not in ["insert", "replaceSelection"]: |
4233 toolProcData[1] not in ["insert", "replaceSelection"]: |
4234 # not connected to an editor or wrong mode |
4234 # not connected to an editor or wrong mode |
4235 while toolProc.canReadLine(): |
4235 while toolProc.canReadLine(): |
4236 s = "%s - " % program |
4236 s = "%s - " % program |
4237 output = unicode(toolProc.readLine(), ioEncoding, 'replace') |
4237 output = str(toolProc.readLine(), ioEncoding, 'replace') |
4238 s.append(output) |
4238 s.append(output) |
4239 self.appendToStdout(s) |
4239 self.appendToStdout(s) |
4240 else: |
4240 else: |
4241 if toolProcData[1] == "insert": |
4241 if toolProcData[1] == "insert": |
4242 text = unicode(toolProc.readAll(), ioEncoding, 'replace') |
4242 text = str(toolProc.readAll(), ioEncoding, 'replace') |
4243 toolProcData[0].insert(text) |
4243 toolProcData[0].insert(text) |
4244 elif toolProcData[1] == "replaceSelection": |
4244 elif toolProcData[1] == "replaceSelection": |
4245 text = unicode(toolProc.readAll(), ioEncoding, 'replace') |
4245 text = str(toolProc.readAll(), ioEncoding, 'replace') |
4246 toolProcData[2].append(text) |
4246 toolProcData[2].append(text) |
4247 |
4247 |
4248 def __processToolStderr(self): |
4248 def __processToolStderr(self): |
4249 """ |
4249 """ |
4250 Private slot to handle the readyReadStderr signal of a tool process. |
4250 Private slot to handle the readyReadStderr signal of a tool process. |
4255 for program, toolProc, toolProcData in self.toolProcs: |
4255 for program, toolProc, toolProcData in self.toolProcs: |
4256 toolProc.setReadChannel(QProcess.StandardError) |
4256 toolProc.setReadChannel(QProcess.StandardError) |
4257 |
4257 |
4258 while toolProc.canReadLine(): |
4258 while toolProc.canReadLine(): |
4259 s = "%s - " % program |
4259 s = "%s - " % program |
4260 error = unicode(toolProc.readLine(), ioEncoding, 'replace') |
4260 error = str(toolProc.readLine(), ioEncoding, 'replace') |
4261 s.append(error) |
4261 s.append(error) |
4262 self.appendToStderr(s) |
4262 self.appendToStderr(s) |
4263 |
4263 |
4264 def __toolFinished(self, exitCode, exitStatus): |
4264 def __toolFinished(self, exitCode, exitStatus): |
4265 """ |
4265 """ |
4761 |
4761 |
4762 @param fn filename of the opened editor (string) |
4762 @param fn filename of the opened editor (string) |
4763 """ |
4763 """ |
4764 self.wizardsMenuAct.setEnabled(len(self.__menus["wizards"].actions()) > 0) |
4764 self.wizardsMenuAct.setEnabled(len(self.__menus["wizards"].actions()) > 0) |
4765 |
4765 |
4766 if fn and unicode(fn) != "None": |
4766 if fn and str(fn) != "None": |
4767 dbs = e4App().getObject("DebugServer") |
4767 dbs = e4App().getObject("DebugServer") |
4768 for language in dbs.getSupportedLanguages(): |
4768 for language in dbs.getSupportedLanguages(): |
4769 exts = dbs.getExtensions(language) |
4769 exts = dbs.getExtensions(language) |
4770 if fn.endswith(exts): |
4770 if fn.endswith(exts): |
4771 cap = dbs.getClientCapabilities(language) |
4771 cap = dbs.getClientCapabilities(language) |
5152 } |
5152 } |
5153 if self.embeddedShell: |
5153 if self.embeddedShell: |
5154 del windows["Shell"] |
5154 del windows["Shell"] |
5155 if self.embeddedFileBrowser: |
5155 if self.embeddedFileBrowser: |
5156 del windows["FileBrowser"] |
5156 del windows["FileBrowser"] |
5157 for window, i in zip(self.windows, range(len(self.windows))): |
5157 for window, i in zip(self.windows, list(range(len(self.windows)))): |
5158 if window is not None: |
5158 if window is not None: |
5159 self.profiles[self.currentProfile][2][i] = \ |
5159 self.profiles[self.currentProfile][2][i] = \ |
5160 str(window.saveGeometry()) |
5160 str(window.saveGeometry()) |
5161 |
5161 |
5162 self.browser.saveToplevelDirs() |
5162 self.browser.saveToplevelDirs() |
5293 self.__inVersionCheck = False |
5293 self.__inVersionCheck = False |
5294 if self.__versionCheckProgress is not None: |
5294 if self.__versionCheckProgress is not None: |
5295 self.__versionCheckProgress.reset() |
5295 self.__versionCheckProgress.reset() |
5296 self.__versionCheckProgress = None |
5296 self.__versionCheckProgress = None |
5297 ioEncoding = Preferences.getSystem("IOEncoding") |
5297 ioEncoding = Preferences.getSystem("IOEncoding") |
5298 versions = unicode(self.http.readAll(), ioEncoding, 'replace').splitlines() |
5298 versions = str(self.http.readAll(), ioEncoding, 'replace').splitlines() |
5299 self.__updateVersionsUrls(versions) |
5299 self.__updateVersionsUrls(versions) |
5300 if self.showAvailableVersions: |
5300 if self.showAvailableVersions: |
5301 self.__showAvailableVersionInfos(versions) |
5301 self.__showAvailableVersionInfos(versions) |
5302 else: |
5302 else: |
5303 Preferences.Prefs.settings.setValue(\ |
5303 Preferences.Prefs.settings.setValue(\ |