emsm.core.plugins

exception emsm.core.plugins.PluginException[source]

Bases: Exception

Base class for all exceptions in this module.

exception emsm.core.plugins.PluginImplementationError(plugin, msg)[source]

Bases: emsm.core.plugins.PluginException

Raised if a plugin is not correct implemented.

exception emsm.core.plugins.PluginOutdatedError(plugin)[source]

Bases: emsm.core.plugins.PluginException

Raised if the version of the plugin is not compatible with the EMSM version.

class emsm.core.plugins.PluginManager(app)[source]

Bases: object

Loads and manages all plugins.

If you want to write a plugin and search for the docs, take a look at the hellodolly plugin.

See also

finish()[source]

Calls finish() for each loaded plugin.

get_all_plugins()[source]

Returns all currently loaded plugin instances.

get_module(plugin_name)[source]

Returns the Python module object that contains the plugin with the name plugin_name or None if there is no plugin with that name.

get_plugin(plugin_name)[source]

Returns the instance of the plugin with the name plugin_name that is currently loaded and used by the EMSM.

get_plugin_names()[source]

Returns the names of all loaded plugins.

get_plugin_type(plugin_name)[source]

Returns the plugin class for the plugin with the name plugin_name or None, if there is no plugin with that name.

import_from_directory(directory)[source]

Imports all Python modules in the directory.

Files that do not contain a valid EMSM plugin, are ignored. You can check the log files to see which plugins have been ignored.

See also

import_plugin(path)[source]

Loads the plugin located at path.

Note

The path is no longer added to sys.path (EMSM Vers. >= 3).

Raises:

See also

  • _plugin_is_outdated()
init_plugins()[source]

Creates a plugin instance for each loaded plugin class.

When you call this method multiple times, only plugins that have not been initialised already, will be initialised.

plugin_is_available(plugin_name)[source]

Returns True, if the plugin with the name plugin_name is available.

remove_plugin(plugin_name, call_finish=False)[source]

Unloads the plugin with the name plugin_name.

Parameters:
  • plugin_name (str) – The name of the plugin that should be unloaded.
  • call_finish (bool) – If true, the finish() method of the plugin is called, before it is unloaded.
run()[source]

Calls run() of the plugin that has been selected by the command line arguments.

setup()[source]

Imports all plugins from the application’s plugin directory.