--- a/UI/UserInterface.py Mon Jul 09 19:09:19 2018 +0200 +++ b/UI/UserInterface.py Mon Jul 09 19:10:09 2018 +0200 @@ -131,7 +131,7 @@ self.buffer += str(s) self.__nWrite(self.__bufferedWrite()) -# TODO: make "Code Docu Viewer", "Cooperation" and "IRC" configurable +# TODO: make "Cooperation" and "IRC" configurable class UserInterface(E5MainWindow): """ Class implementing the main user interface. @@ -267,6 +267,8 @@ splash.showMessage(self.tr("Generating Main User Interface...")) + self.codeDocumentationViewer = None + # Create the main window now so that we can connect QActions to it. logging.debug("Creating Layout...") self.__createLayout(debugServer) @@ -488,8 +490,10 @@ self.preferencesChanged.connect(self.cooperation.preferencesChanged) self.preferencesChanged.connect( self.backgroundService.preferencesOrProjectChanged) - self.preferencesChanged.connect( - self.codeDocumentationViewer.preferencesChanged) + + if self.codeDocumentationViewer: + self.preferencesChanged.connect( + self.codeDocumentationViewer.preferencesChanged) self.viewmanager.editorSaved.connect(self.project.repopulateItem) self.viewmanager.lastEditorClosed.connect(self.__lastEditorClosed) @@ -572,7 +576,8 @@ e5App().registerObject("IRC", self.irc) e5App().registerObject("Symbols", self.symbolsViewer) e5App().registerObject("Numbers", self.numbersViewer) - e5App().registerObject("DocuViewer", self.codeDocumentationViewer) + if self.codeDocumentationViewer: + e5App().registerObject("DocuViewer", self.codeDocumentationViewer) # list of web addresses serving the versions file self.__httpAlternatives = Preferences.getUI("VersionsUrls6") @@ -642,8 +647,9 @@ self.toolbarManager.restoreState( Preferences.getUI("ToolbarManagerState")) - # finalize the initialization of the code documentation viewer - self.codeDocumentationViewer.finalizeSetup() + if self.codeDocumentationViewer: + # finalize the initialization of the code documentation viewer + self.codeDocumentationViewer.finalizeSetup() # now activate the initial view profile splash.showMessage(self.tr("Setting View Profile...")) @@ -792,14 +798,15 @@ self.lToolbox.addItem(self.templateViewer, UI.PixmapCache.getIcon("templateViewer.png"), self.tr("Template-Viewer")) - - # Create the code documentation viewer - logging.debug("Creating Code Documentation Viewer...") - from .CodeDocumentationViewer import CodeDocumentationViewer - self.codeDocumentationViewer = CodeDocumentationViewer(self) - self.rToolbox.addItem(self.codeDocumentationViewer, - UI.PixmapCache.getIcon("codeDocuViewer.png"), - self.tr("Code Documentation Viewer")) + + if Preferences.getUI("ShowCodeDocumentationViewer"): + # Create the code documentation viewer + logging.debug("Creating Code Documentation Viewer...") + from .CodeDocumentationViewer import CodeDocumentationViewer + self.codeDocumentationViewer = CodeDocumentationViewer(self) + self.rToolbox.addItem(self.codeDocumentationViewer, + UI.PixmapCache.getIcon("codeDocuViewer.png"), + self.tr("Code Documentation Viewer")) # Create the debug viewer maybe without the embedded shell logging.debug("Creating Debug Viewer...") @@ -926,14 +933,15 @@ UI.PixmapCache.getIcon("templateViewer.png"), self.tr("Template-Viewer")) - # Create the code documentation viewer - logging.debug("Creating Code Documentation Viewer...") - from .CodeDocumentationViewer import CodeDocumentationViewer - self.codeDocumentationViewer = CodeDocumentationViewer(self) - self.rightSidebar.addTab( - self.codeDocumentationViewer, - UI.PixmapCache.getIcon("codeDocuViewer.png"), - self.tr("Code Documentation Viewer")) + if Preferences.getUI("ShowCodeDocumentationViewer"): + # Create the code documentation viewer + logging.debug("Creating Code Documentation Viewer...") + from .CodeDocumentationViewer import CodeDocumentationViewer + self.codeDocumentationViewer = CodeDocumentationViewer(self) + self.rightSidebar.addTab( + self.codeDocumentationViewer, + UI.PixmapCache.getIcon("codeDocuViewer.png"), + self.tr("Code Documentation Viewer")) # Create the debug viewer maybe without the embedded shell logging.debug("Creating Debug Viewer...") @@ -2729,7 +2737,6 @@ self.__menus["subwindow"] = QMenu(self.tr("&Windows"), self.__menus["window"]) self.__menus["subwindow"].setTearOffEnabled(True) - # TODO: insert separators between the different sides # left side try: self.__menus["subwindow"].addSection(self.tr("Left Side")) @@ -2757,9 +2764,10 @@ # Qt4 self.__menus["subwindow"].addSeparator() # right side - self.__menus["subwindow"].addAction( - self.tr("Code Documentation Viewer"), - self.activateCodeDocumentationViewer) + if self.codeDocumentationViewer: + self.__menus["subwindow"].addAction( + self.tr("Code Documentation Viewer"), + self.activateCodeDocumentationViewer) self.__menus["subwindow"].addAction(self.debugViewerActivateAct) self.__menus["subwindow"].addAction(self.cooperationViewerActivateAct) self.__menus["subwindow"].addAction(self.ircActivateAct) @@ -4287,16 +4295,19 @@ @param switchFocus flag indicating to transfer the input focus @type bool """ - if self.layoutType == "Toolboxes": - self.rToolboxDock.show() - self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) - elif self.layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.codeDocumentationViewer) - else: - self.codeDocumentationViewer.show() - if switchFocus: - self.codeDocumentationViewer.setFocus(Qt.ActiveWindowFocusReason) + if self.codeDocumentationViewer: + if self.layoutType == "Toolboxes": + self.rToolboxDock.show() + self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) + elif self.layoutType == "Sidebars": + self.rightSidebar.show() + self.rightSidebar.setCurrentWidget( + self.codeDocumentationViewer) + else: + self.codeDocumentationViewer.show() + if switchFocus: + self.codeDocumentationViewer.setFocus( + Qt.ActiveWindowFocusReason) def __toggleWindow(self, w): """ @@ -6439,7 +6450,8 @@ if sessionCreated and not self.__disableCrashSession: self.__deleteCrashSession() - self.codeDocumentationViewer.shutdown() + if self.codeDocumentationViewer: + self.codeDocumentationViewer.shutdown() self.__previewer.shutdown()