# eric6.UI.CodeDocumentationViewer

Module implementing a widget to show some source code information provided by plug-ins.

### Global Attributes

None

### Classes

CodeDocumentationViewer | Class implementing a widget to show some source code information provided by plug-ins.
PlainTextDocumentationViewer | Class implementing the plain text documentation viewer.
WebViewDocumentationViewer | Class implementing the rich text documentation viewer.

### Functions

None

## CodeDocumentationViewer

Class implementing a widget to show some source code information provided by plug-ins.

### Signals

providerAdded()
  emitted to indicate the availability of a new provider
providerRemoved()
  emitted to indicate the removal of a provider

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

CodeDocumentationViewer | Constructor
__setHtml | Private slot to set the prepared HTML text.
__setHtmlWarning | Private slot to set a display message.
__setupUi | Private method to generate the UI layout.
__showDisabledMessage | Private method to show a message giving the reason for being disabled.
__showTextViewer | Private slot to show the selected viewer.
documentationReady | Public method to provide the documentation info to the viewer.
finalizeSetup | Public method to finalize the setup of the documentation viewer.
getProviders | Public method to get a list of providers and their visible strings.
isSupportedLanguage | Public method to check, if the given language is supported by the selected provider.
on_providerComboBox_currentIndexChanged | Private slot to handle the selection of a provider.
preferencesChanged | Public slot to handle a change of preferences.
registerProvider | Public method register a source docu provider.
showInfo | Public method to request code documentation data from a provider.
shutdown | Public method to perform shutdown actions.
unregisterProvider | Public method register a source docu provider.

### Static Methods

None

#### CodeDocumentationViewer (Constructor)

CodeDocumentationViewer(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### CodeDocumentationViewer.__setHtml

__setHtml(html)

Private slot to set the prepared HTML text.

html (str)
  prepared HTML text

#### CodeDocumentationViewer.__setHtmlWarning

__setHtmlWarning(warningText)

Private slot to set a display message.

warningText (str)
  text to be shown as a warning

#### CodeDocumentationViewer.__setupUi

__setupUi()

Private method to generate the UI layout.

#### CodeDocumentationViewer.__showDisabledMessage

__showDisabledMessage()

Private method to show a message giving the reason for being disabled.

#### CodeDocumentationViewer.__showTextViewer

__showTextViewer(richText)

Private slot to show the selected viewer.

richText (bool)
  flag indicating the rich text viewer

#### CodeDocumentationViewer.documentationReady

documentationReady(documentationInfo, isWarning=False, isDocWarning=False)

Public method to provide the documentation info to the viewer.

If documentationInfo is a dictionary, it should contains these keys and data:

name: the name of the inspected object argspec: its argspec note: A phrase describing the type of object (function or method) and the module it belongs to. docstring: its documentation string

documentationInfo (dict or str)
  dictionary containing the source docu data
isWarning (bool)
  flag indicating a warning page
isDocWarning (bool)
  flag indicating a documentation warning page

#### CodeDocumentationViewer.finalizeSetup

finalizeSetup()

Public method to finalize the setup of the documentation viewer.

#### CodeDocumentationViewer.getProviders

getProviders()

Public method to get a list of providers and their visible strings.

Returns:
  list containing the providers and their visible strings

Return Type:
  list of tuple of (str,str)

#### CodeDocumentationViewer.isSupportedLanguage

isSupportedLanguage(language)

Public method to check, if the given language is supported by the selected provider.

language (str)
  editor programming language to check

Returns:
  flag indicating the support status

Return Type:
  bool

#### CodeDocumentationViewer.on_providerComboBox_currentIndexChanged

on_providerComboBox_currentIndexChanged(index)

Private slot to handle the selection of a provider.

index (int)
  index of the selected provider

#### CodeDocumentationViewer.preferencesChanged

preferencesChanged()

Public slot to handle a change of preferences.

#### CodeDocumentationViewer.registerProvider

registerProvider(providerName, providerDisplay, provider, supported)

Public method register a source docu provider.

providerName (str)
  name of the provider (must be unique)
providerDisplay (str)
  visible name of the provider
provider (function(editor))
  function to be called to determine source docu
supported (function(language))
  function to be called to determine, if a language is supported

Raises KeyError:
  raised if a provider with the given name was already registered

#### CodeDocumentationViewer.showInfo

showInfo(editor)

Public method to request code documentation data from a provider.

editor (Editor)
  reference to the editor to request code docu for

#### CodeDocumentationViewer.shutdown

shutdown()

Public method to perform shutdown actions.

#### CodeDocumentationViewer.unregisterProvider

unregisterProvider(providerName)

Public method register a source docu provider.

providerName (str)
  name of the provider (must be unique)

Up

## PlainTextDocumentationViewer

Class implementing the plain text documentation viewer.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

PlainTextDocumentationViewer | Constructor
clear | Public method to clear the contents.
preferencesChanged | Public slot to handle a change of preferences.
setText | Public method to set the text to be shown.

### Static Methods

None

#### PlainTextDocumentationViewer (Constructor)

PlainTextDocumentationViewer(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### PlainTextDocumentationViewer.clear

clear()

Public method to clear the contents.

#### PlainTextDocumentationViewer.preferencesChanged

preferencesChanged()

Public slot to handle a change of preferences.

#### PlainTextDocumentationViewer.setText

setText(text)

Public method to set the text to be shown.

text (str)
  text to be shown

Up

## WebViewDocumentationViewer

Class implementing the rich text documentation viewer.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

WebViewDocumentationViewer | Constructor
__showLink | Private slot to show the hovered link in a tooltip.
clear | Public method to clear the shown contents.
setHtml | Public method to set the HTML text of the widget.

### Static Methods

None

#### WebViewDocumentationViewer (Constructor)

WebViewDocumentationViewer(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### WebViewDocumentationViewer.__showLink

__showLink(urlStr)

Private slot to show the hovered link in a tooltip.

urlStr (str)
  hovered URL

#### WebViewDocumentationViewer.clear

clear()

Public method to clear the shown contents.

#### WebViewDocumentationViewer.setHtml

setHtml(html)

Public method to set the HTML text of the widget.

html (str)
  HTML text to be shown

Up