Class e.c.p.PluginRegistry(Loggable):

Part of elisa.core.plugin_registry View In Hierarchy

Known subclasses: elisa.core.tests.test_plugin_registry.PluginRegistryMock

The plugin registry handles plugins in Elisa as long as it is running.

DOCME more.

Line # Kind Name Docs
174 Method __init__ Undocumented
303 Method load_plugins Load plugins from self.plugin_dirs.
391 Method load_plugin Load a given plugin in elisa.
464 Method unload_plugin Unload a given plugin from elisa.
489 Method register_plugin_status_changed_callback Register a callback to be fired upon (de)activation of a plugin.
504 Method unregister_plugin_status_changed_callback Unregister a callback that was previously registered to be fired upon
530 Method enable_plugins Enable all the plugins that should be enabled.
550 Method enable_plugin Enable a plugin.
596 Method disable_plugin Disable a plugin.
639 Method get_plugins Get the list of available plugins.
651 Method get_enabled_plugins Get the list of enabled plugins.
664 Method get_plugin_names Get the names of the installed plugins.
673 Method get_plugin_by_name Return the plugin matching a given name.
686 Method get_plugin_metadata Read and populate the metadata of a plugin.
747 Method plugin_cache Undocumented
751 Method plugin_repository Undocumented
754 Method reload_cache Load the cached information about downloadable plugins.
774 Method update_cache Update the cached information about downloadable plugins.
812 Method get_downloadable_plugins The list of downloadable plugins.
829 Method download_plugin Download one plugin.
885 Method install_plugin Install a plugin from a local egg file.
932 Method update_plugin Update an installed plugin for which a newer version is available in
958 Method install_new_recommended_plugins Download and install all the recommended plugins.
1020 Method create_component Create a component given its path.
190 Method _create_config_section Undocumented
202 Method _deactivate_dist Undocumented
267 Method _fix_uninstalled_plugin Undocumented
295 Method _add_gstreamer_path Undocumented
516 Method _fire_registered_callbacks Undocumented
726 Method _deserialize_cache Here the actual deserialization is done.
1057 Method _call_hook Undocumented
def __init__(self, config=None, plugin_dirs=None):
Undocumented
def _create_config_section(self, config):
Undocumented
def _deactivate_dist(self, working_set, name='elisa'):
Undocumented
def _fix_uninstalled_plugin(self, dist, action):
Undocumented
def _add_gstreamer_path(self, path):
Undocumented
def load_plugins(self, disabled_plugins=):
Load plugins from self.plugin_dirs.
Parametersdisabled_pluginsa list of plugins that should be disabled (type: list of str )
NotesThis function runs without returning to the reactor for as long as it takes. There is no point in making it return before it is done as the plugin environment needs to be set up before any other part of elisa can run correctly.
By default, all the available plugins are enabled.
Unknown Field: attentionThis function should be called as early as possible at startup, before using any plugin.
def load_plugin(self, plugin):
Load a given plugin in elisa.
Parameterspluginthe plugin to load (type: pkg_resources.Distribution )
def unload_plugin(self, plugin):
Unload a given plugin from elisa.
Parameterspluginthe plugin to unload (type: pkg_resources.Distribution )
Returnsa deferred fired when the plugin is fully unloaded (type: twisted.internet.defer.Deferred )
def register_plugin_status_changed_callback(self, callback):
Register a callback to be fired upon (de)activation of a plugin. This callback will be passed the plugin (pkg_resources.Distribution) and the new status (bool, True for enabled, False for disabled) as parameters, and should return a deferred. The plugin status will be considered as changed (and the corresponding message emitted) only when all the resulting deferreds of the registered callbacks have fired (or errored).
Parameterscallbacka callback (type: callable )
def unregister_plugin_status_changed_callback(self, callback):
Unregister a callback that was previously registered to be fired upon (de)activation of a plugin.
Parameterscallbacka callback previously registered (type: callable )
RaisesValueErrorif the callback is not registered
def _fire_registered_callbacks(self, result, plugin, status):
Undocumented
def enable_plugins(self):
Enable all the plugins that should be enabled.
Returnsa deferred fired when all plugins have been enabled (type: twisted.internet.defer.Deferred )
Unknown Field: attentionthis method can be called only once and should be called upon startup of the application, after load_plugins.
def enable_plugin(self, plugin_name):
Enable a plugin.
Parametersplugin_namethe name of the plugin to enable (type: str )
Returnsa deferred fired when the plugin is enabled (type: twisted.internet.defer.Deferred )
def disable_plugin(self, plugin_name):
Disable a plugin.
Parametersplugin_namethe name of the plugin to disable (type: str )
Returnsa deferred fired when the plugin is disabled (type: twisted.internet.defer.Deferred )
def get_plugins(self):
Get the list of available plugins.

This call returns (plugin_name, status) tuples, where status is True if the plugin is enabled, False otherwise.

Returnsa generator yielding (plugin_name, status) tuples (type: generator )
def get_enabled_plugins(self):
Get the list of enabled plugins.
Returnsgenerator yielding plugin names (type: generator )
def get_plugin_names(self):
Get the names of the installed plugins.
Returnsa generator yielding plugin names (type: generator )
def get_plugin_by_name(self, plugin_name):
Return the plugin matching a given name.
Parametersplugin_namethe name of the plugin (type: str )
Returnsthe plugin, or None if no plugin matches the given name (type: pkg_resources.Distribution )
def get_plugin_metadata(self, plugin):
Read and populate the metadata of a plugin.
Parametersplugina plugin (type: pkg_resources.Distribution )
def _deserialize_cache(self, cache):
Here the actual deserialization is done.

The present file format is json, but that can be changed without affecting the rest of the system.

Parameterscachethe serialized data (type: str )
Returnsthe list of plugins (type: list of dict )
@property
def plugin_cache(self):
Undocumented
@property
def plugin_repository(self):
Undocumented
def reload_cache(self):
Load the cached information about downloadable plugins.
Returnswhether the loading went well. (type: bool )
def update_cache(self):
Update the cached information about downloadable plugins.

At present only one remote, hardcoded repository is supported.

Returnsa deferred triggered when the cache is updated (type: twisted.internet.defer.Deferred )
def get_downloadable_plugins(self, reload_cache=False):
The list of downloadable plugins.

Each plugin is represented as a Python dictionary.

Parametersreload_cachewhether to reload the local cache from disk (type: bool )
Returnsa list of one dict per plugin. (type: list )
def download_plugin(self, plugin):
Download one plugin.

A plugin is represented with a dictionary. Some expected keys are listed at https://elisa.fluendo.com/wiki/Specs/PluginsMetadata. Here we just rely on 'egg_name' and 'uri'. If they change, this code will simply break.

Parameterspluginthe plugin dictionary (type: dict )
Returnsa deferred triggered when done, reporting the path to the downloaded egg file (type: twisted.internet.defer.Deferred )
def install_plugin(self, egg_file, plugin_name):
Install a plugin from a local egg file.

If needed, the egg file will be copied over to the local plugins directory and the older version of the plugin will be unloaded. The plugin will then be loaded and enabled.

Parametersegg_filethe full path to the egg file on disk (type: str )
plugin_namethe internal name of the plugin (type: str )
Returnsa deferred fired when the plugin is installed (type: elisa.core.utils.defer.Deferred )
def update_plugin(self, plugin_dict):
Update an installed plugin for which a newer version is available in the plugin repository.

Updating a plugin will disable the current version if needed, unload it, download the new version, load it and enable it.

Parametersplugin_dicta dictionary representing the plugin as returned by get_downloadable_plugins (type: dict )
Returnsa deferred fired when the update is complete (type: elisa.core.utils.defer.Deferred )
Unknown Field: attentionthis code assumes that the plugin to update is currently installed and that the plugin repository actually provides a newer version. Behaviour outside of these constraints is undefined.
def install_new_recommended_plugins(self):
Download and install all the recommended plugins.

This will typically happen when first running Elisa after installation, if the user selected the 'Install Recommended Plugins' option in the installer.

Returnsa deferred fired when the installation is complete (type: elisa.core.utils.defer.Deferred )
def create_component(self, path, config=None, **kwargs):
Create a component given its path.

The path is in module:Component syntax, eg elisa.plugins.my_plugin:MyComponent.

Parameterspaththe component path (type: str )
configthe configuration to set for the component (type: elisa.core.config.Config )
Returnsan instance of the component identified by path (type: elisa.core.component.Component or a subclass )
def _call_hook(self, plugin_name, hook_name):
Undocumented
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.