diff -r 85e126ab4ca5 -r 0174aece0923 UI/CodeDocumentationViewer.py --- a/UI/CodeDocumentationViewer.py Sun Oct 22 15:42:00 2017 +0200 +++ b/UI/CodeDocumentationViewer.py Mon Oct 23 19:41:35 2017 +0200 @@ -211,10 +211,6 @@ self.__lastDocumentation = None self.__requestingEditor = None - self.__noDocumentationString = self.tr("No documentation available") - self.__disabledString = self.tr( - "No source code documentation provider has been registered or" - " this function has been disabled.") def __setupUi(self): """ @@ -313,7 +309,7 @@ self.providerComboBox.setCurrentIndex(index) self.__selectedProvider = provider if index == 0: - self.documentationReady(self.__disabledString, isWarning=True) + self.__showDisabledMessage() # TODO: document this hook in the plug-in document def registerProvider(self, providerName, providerDisplay, provider, @@ -440,10 +436,9 @@ if not documentationInfo: if self.__selectedProvider == self.__disabledProvider: - self.documentationReady(self.__disabledString, - isWarning=True) + self.__showDisabledMessage() else: - self.documentationReady(self.__noDocumentationString, + self.documentationReady(self.tr("No documentation available"), isDocWarning=True) else: if self.__showMarkdown: @@ -491,6 +486,20 @@ self.__plainTextViewer.setText(fullText) + def __showDisabledMessage(self): + """ + Private method to show a message giving the reason for being disabled. + """ + if len(self.__providers) == 0: + self.documentationReady( + self.tr("No source code documentation provider has been" + " registered. This function has been disabled."), + isWarning=True) + else: + self.documentationReady( + self.tr("This function has been disabled."), + isWarning=True) + def __setHtml(self, html): """ Private slot to set the prepared HTML text. @@ -525,7 +534,7 @@ provider = self.providerComboBox.itemData(index) if provider == self.__disabledProvider: - self.documentationReady(self.__disabledString, isWarning=True) + self.__showDisabledMessage() else: self.__lastDocumentation = None