--- a/UI/CodeDocumentationViewer.py Tue Jun 26 18:39:14 2018 +0200 +++ b/UI/CodeDocumentationViewer.py Tue Jun 26 18:50:04 2018 +0200 @@ -269,9 +269,13 @@ self.verticalLayout.addWidget(self.__plainTextViewer) # Rich Text (Web) Viewer - self.__richTextViewer = WebViewDocumentationViewer(self) - self.__richTextViewer.setObjectName("__richTextViewer") - self.verticalLayout.addWidget(self.__richTextViewer) + try: + self.__richTextViewer = WebViewDocumentationViewer(self) + self.__richTextViewer.setObjectName("__richTextViewer") + self.verticalLayout.addWidget(self.__richTextViewer) + except ImportError: + # neither QtWebEngineWidgets nor QtWebKitWidgets is available + self.__richTextViewer = None self.__toolButton = E5ToolButton(self) self.__toolButton.setObjectName( @@ -287,11 +291,15 @@ self.__optionsActionGroup = QActionGroup(self) self.__optionsActionGroup.setExclusive(True) self.__optionsMenu = QMenu(self) - self.__richTextAct = self.__optionsMenu.addAction( - self.tr("Rich Text"), - lambda: self.__showTextViewer(True)) - self.__richTextAct.setCheckable(True) - self.__optionsActionGroup.addAction(self.__richTextAct) + if self.__richTextViewer: + self.__richTextAct = self.__optionsMenu.addAction( + self.tr("Rich Text"), + lambda: self.__showTextViewer(True)) + self.__richTextAct.setCheckable(True) + self.__optionsActionGroup.addAction(self.__richTextAct) + else: + # neither QtWebEngineWidgets nor QtWebKitWidgets is available + self.__richTextAct = None self.__plainTextAct = self.__optionsMenu.addAction( self.tr("Plain Text"), lambda: self.__showTextViewer(False)) @@ -433,7 +441,8 @@ if self.__selectedProvider != self.__disabledProvider: self.__plainTextViewer.clear() - self.__richTextViewer.clear() + if self.__richTextViewer: + self.__richTextViewer.clear() self.__providers[self.__selectedProvider][0](editor) def documentationReady(self, documentationInfo, isWarning=False, @@ -556,7 +565,8 @@ @param html prepared HTML text @type str """ - self.__richTextViewer.setHtml(html) + if self.__richTextViewer: + self.__richTextViewer.setHtml(html) def __setHtmlWarning(self, warningText): """ @@ -565,8 +575,9 @@ @param warningText text to be shown as a warning @type str """ - html = prepareDocumentationViewerHtmlWarningDocument(warningText) - self.__richTextViewer.setHtml(html) + if self.__richTextViewer: + html = prepareDocumentationViewerHtmlWarningDocument(warningText) + self.__richTextViewer.setHtml(html) @pyqtSlot(int) def on_providerComboBox_currentIndexChanged(self, index): @@ -578,7 +589,8 @@ """ if not self.__shuttingDown and not self.__startingUp: self.__plainTextViewer.clear() - self.__richTextViewer.clear() + if self.__richTextViewer: + self.__richTextViewer.clear() self.objectLineEdit.clear() provider = self.providerComboBox.itemData(index) @@ -631,13 +643,15 @@ self.__showMarkdown = richText self.__plainTextViewer.clear() - self.__richTextViewer.clear() + self.__plainTextViewer.setVisible(not richText) - self.__plainTextViewer.setVisible(not richText) - self.__richTextViewer.setVisible(richText) + if self.__richTextViewer: + self.__richTextViewer.clear() + self.__richTextViewer.setVisible(richText) self.__plainTextAct.setChecked(not richText) - self.__richTextAct.setChecked(richText) + if self.__richTextAct: + self.__richTextAct.setChecked(richText) self.documentationReady(self.__lastDocumentation)