# 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.
DocumentationViewerWidget | Class implementing a 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
__selectProvider | Private method to select a provider programmatically.
__setupUi | Private method to generate the UI layout.
__showDisabledMessage | Private method to show a message giving the reason for being disabled.
__unregisterTimerTimeout | Private slot handling the timeout signal of the unregister timer.
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.__selectProvider

__selectProvider(provider)

Private method to select a provider programmatically.

provider (str)
  name of the provider to be selected

#### 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.__unregisterTimerTimeout

__unregisterTimerTimeout()

Private slot handling the timeout signal of the unregister timer.

#### 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 contain these (optional) keys and data:

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

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

## DocumentationViewerWidget

Class implementing a rich text documentation viewer.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

DocumentationViewerWidget | 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

#### DocumentationViewerWidget (Constructor)

DocumentationViewerWidget(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### DocumentationViewerWidget.__showLink

__showLink(urlStr)

Private slot to show the hovered link in a tooltip.

urlStr (str)
  hovered URL

#### DocumentationViewerWidget.clear

clear()

Public method to clear the shown contents.

#### DocumentationViewerWidget.setHtml

setHtml(html)

Public method to set the HTML text of the widget.

html (str)
  HTML text to be shown

Up