eric4.PluginManager.PluginManager

Module implementing the Plugin Manager.

Global Attributes

None

Classes

PluginManager Class implementing the Plugin Manager.

Functions

None


PluginManager

Class implementing the Plugin Manager.

Signals

allPlugginsActivated()
emitted at startup after all plugins have been activated
pluginAboutToBeActivated(modulName, pluginObject)
emitted just before a plugin is activated
pluginAboutToBeDeactivated(modulName, pluginObject)
emitted just before a plugin is deactivated
pluginActivated(modulName, pluginObject)
emitted just after a plugin was activated
pluginDeactivated(modulName, pluginObject)
emitted just after a plugin was deactivated
shutdown()
emitted at shutdown of the IDE

Derived from

QObject

Class Attributes

None

Methods

PluginManager Constructor
__canActivatePlugin Private method to check, if a plugin can be activated.
__canDeactivatePlugin Private method to check, if a plugin can be deactivated.
__checkPluginsDownloadDirectory Private slot to check for the existance of the plugins download directory.
__getShortInfo Private method to extract the short info from a module.
__insertPluginsPaths Private method to insert the valid plugin paths intos the search path.
__loadPlugins Private method to load the plugins found.
__pluginDirectoriesExist Private method to check, if the plugin folders exist.
__pluginModulesExist Private method to check, if there are plugins available.
activatePlugin Public method to activate a plugin.
activatePlugins Public method to activate all plugins having the "autoactivate" attribute set to True.
deactivatePlugin Public method to deactivate a plugin.
deactivateVcsPlugins Public method to deactivated all activated VCS plugins.
finalizeSetup Public method to finalize the setup of the plugin manager.
getPluginApiFiles Public method to get the list of API files installed by a plugin.
getPluginConfigData Public method to get the config data of all active, non on-demand plugins used by the configuration dialog.
getPluginDetails Public method to get detailed information about a plugin.
getPluginDir Public method to get the path of a plugin directory.
getPluginDisplayStrings Public method to get the display strings of all plugins of a specific type.
getPluginExeDisplayData Public method to get data to display information about a plugins external tool.
getPluginInfos Public method to get infos about all loaded plugins.
getPluginModules Public method to get a list of plugin modules.
getPluginObject Public method to activate an ondemand plugin given by type and typename.
getPluginPreviewPixmap Public method to get a preview pixmap of a plugin of a specific type.
getVcsSystemIndicators Public method to get the Vcs System indicators.
initOnDemandPlugin Public method to create a plugin object for the named on demand plugin.
initOnDemandPlugins Public method to create plugin objects for all on demand plugins.
isPluginActive Public method to check, if a certain plugin is active.
isPluginLoaded Public method to check, if a certain plugin is loaded.
isValidPluginName Public methode to check, if a file name is a valid plugin name.
loadPlugin Public method to load a plugin module.
preferencesChanged Public slot to react to changes in configuration.
removePluginFromSysModules Public method to remove a plugin and all related modules from sys.modules.
shutdown Public method called to perform actions upon shutdown of the IDE.
unloadPlugin Public method to unload a plugin module.

PluginManager (Constructor)

PluginManager(parent = None, doLoadPlugins = True, develPlugin = None)

Constructor

The Plugin Manager deals with three different plugin directories. The first is the one, that is part of eric4 (eric4/Plugins). The second one is the global plugin directory called 'eric4plugins', which is located inside the site-packages directory. The last one is the user plugin directory located inside the .eric4 directory of the users home directory.

parent
reference to the parent object (QObject)
doLoadPlugins=
flag indicating, that plugins should be loaded (boolean)
develPlugin=
filename of a plugin to be loaded for development (string)

PluginManager.__canActivatePlugin

__canActivatePlugin(module)

Private method to check, if a plugin can be activated.

module
reference to the module to be activated
Returns:
flag indicating, if the module satisfies all requirements for being activated (boolean)

PluginManager.__canDeactivatePlugin

__canDeactivatePlugin(module)

Private method to check, if a plugin can be deactivated.

module
reference to the module to be deactivated
Returns:
flag indicating, if the module satisfies all requirements for being deactivated (boolean)

PluginManager.__checkPluginsDownloadDirectory

__checkPluginsDownloadDirectory()

Private slot to check for the existance of the plugins download directory.

PluginManager.__getShortInfo

__getShortInfo(module)

Private method to extract the short info from a module.

module
module to extract short info from
Returns:
short info as a tuple giving plugin name (string), short description (string), error flag (boolean) and version (string)

PluginManager.__insertPluginsPaths

__insertPluginsPaths()

Private method to insert the valid plugin paths intos the search path.

PluginManager.__loadPlugins

__loadPlugins()

Private method to load the plugins found.

PluginManager.__pluginDirectoriesExist

__pluginDirectoriesExist()

Private method to check, if the plugin folders exist.

If the plugin folders don't exist, they are created (if possible).

Returns:
tuple of a flag indicating existence of any of the plugin directories (boolean) and a message (QString)

PluginManager.__pluginModulesExist

__pluginModulesExist()

Private method to check, if there are plugins available.

Returns:
flag indicating the availability of plugins (boolean)

PluginManager.activatePlugin

activatePlugin(name, onDemand = False)

Public method to activate a plugin.

name
name of the module to be activated
onDemand=
flag indicating activation of an on demand plugin (boolean)
Returns:
reference to the initialized plugin object

PluginManager.activatePlugins

activatePlugins()

Public method to activate all plugins having the "autoactivate" attribute set to True.

PluginManager.deactivatePlugin

deactivatePlugin(name, onDemand = False)

Public method to deactivate a plugin.

name
name of the module to be deactivated
onDemand=
flag indicating deactivation of an on demand plugin (boolean)

PluginManager.deactivateVcsPlugins

deactivateVcsPlugins()

Public method to deactivated all activated VCS plugins.

PluginManager.finalizeSetup

finalizeSetup()

Public method to finalize the setup of the plugin manager.

PluginManager.getPluginApiFiles

getPluginApiFiles(language)

Public method to get the list of API files installed by a plugin.

language
language of the requested API files (QString)
Returns:
list of API filenames (list of string)

PluginManager.getPluginConfigData

getPluginConfigData()

Public method to get the config data of all active, non on-demand plugins used by the configuration dialog.

Plugins supporting this functionality must provide the plugin module function 'getConfigData' returning a dictionary with unique keys of lists with the following list contents:

display string
string shown in the selection area of the configuration page. This should be a localized string
pixmap name
filename of the pixmap to be shown next to the display string
page creation function
plugin module function to be called to create the configuration page. The page must be subclasses from Preferences.ConfigurationPages.ConfigurationPageBase and must implement a method called 'save' to save the settings. A parent entry will be created in the selection list, if this value is None.
parent key
dictionary key of the parent entry or None, if this defines a toplevel entry.
reference to configuration page
This will be used by the configuration dialog and must always be None

PluginManager.getPluginDetails

getPluginDetails(name)

Public method to get detailed information about a plugin.

name
name of the module to get detailed infos about (string)
Returns:
details of the plugin as a dictionary

PluginManager.getPluginDir

getPluginDir(key)

Public method to get the path of a plugin directory.

Returns:
path of the requested plugin directory (string)

PluginManager.getPluginDisplayStrings

getPluginDisplayStrings(type_)

Public method to get the display strings of all plugins of a specific type.

type_
type of the plugins (string)
Returns:
dictionary with name as key and display string as value (dictionary of QString)

PluginManager.getPluginExeDisplayData

getPluginExeDisplayData()

Public method to get data to display information about a plugins external tool.

Returns:
list of dictionaries containing the data. Each dictionary must either contain data for the determination or the data to be displayed.
A dictionary of the first form must have the following entries: A dictionary of the second form must have the following entries:

PluginManager.getPluginInfos

getPluginInfos()

Public method to get infos about all loaded plugins.

Returns:
list of tuples giving module name (string), plugin name (string), version (string), autoactivate (boolean), active (boolean), short description (string), error flag (boolean)

PluginManager.getPluginModules

getPluginModules(pluginPath)

Public method to get a list of plugin modules.

pluginPath
name of the path to search (string)
Returns:
list of plugin module names (list of string)

PluginManager.getPluginObject

getPluginObject(type_, typename, maybeActive = False)

Public method to activate an ondemand plugin given by type and typename.

type_
type of the plugin to be activated (string)
typename
name of the plugin within the type category (string)
maybeActive=
flag indicating, that the plugin may be active already (boolean)
Returns:
reference to the initialized plugin object

PluginManager.getPluginPreviewPixmap

getPluginPreviewPixmap(type_, name)

Public method to get a preview pixmap of a plugin of a specific type.

type_
type of the plugin (string)
name
name of the plugin type (string)
Returns:
preview pixmap (QPixmap)

PluginManager.getVcsSystemIndicators

getVcsSystemIndicators()

Public method to get the Vcs System indicators.

Plugins supporting this functionality must support the module function getVcsSystemIndicator returning a dictionary with indicator as key and a tuple with the vcs name (string) and vcs display string (QString).

Returns:
dictionary with indicator as key and a list of tuples as values. Each tuple contains the vcs name (string) and vcs display string (QString).

PluginManager.initOnDemandPlugin

initOnDemandPlugin(name)

Public method to create a plugin object for the named on demand plugin.

Note: The plugin is not activated.

PluginManager.initOnDemandPlugins

initOnDemandPlugins()

Public method to create plugin objects for all on demand plugins.

Note: The plugins are not activated.

PluginManager.isPluginActive

isPluginActive(pluginName)

Public method to check, if a certain plugin is active.

pluginName
name of the plugin to check for (string or QString)
Returns:
flag indicating, if the plugin is active (boolean)

PluginManager.isPluginLoaded

isPluginLoaded(pluginName)

Public method to check, if a certain plugin is loaded.

pluginName
name of the plugin to check for (string or QString)
Returns:
flag indicating, if the plugin is loaded (boolean)

PluginManager.isValidPluginName

isValidPluginName(pluginName)

Public methode to check, if a file name is a valid plugin name.

Plugin modules must start with "Plugin" and have the extension ".py".

pluginName
name of the file to be checked (string)
Returns:
flag indicating a valid plugin name (boolean)

PluginManager.loadPlugin

loadPlugin(name, directory, reload_ = False)

Public method to load a plugin module.

Initially all modules are inactive. Modules that are requested on demand are sorted out and are added to the on demand list. Some basic validity checks are performed as well. Modules failing these checks are added to the failed modules list.

name
name of the module to be loaded (string)
directory
name of the plugin directory (string)
reload_
flag indicating to reload the module (boolean)

PluginManager.preferencesChanged

preferencesChanged()

Public slot to react to changes in configuration.

PluginManager.removePluginFromSysModules

removePluginFromSysModules(pluginName, package, internalPackages)

Public method to remove a plugin and all related modules from sys.modules.

pluginName
name of the plugin module (string)
package
name of the plugin package (string)
internalPackages
list of intenal packages (list of string)
Returns:
flag indicating the plugin module was found in sys.modules (boolean)

PluginManager.shutdown

shutdown()

Public method called to perform actions upon shutdown of the IDE.

PluginManager.unloadPlugin

unloadPlugin(name, directory)

Public method to unload a plugin module.

name
name of the module to be unloaded (string)
directory
name of the plugin directory (string)
Returns:
flag indicating success (boolean)
Up