emsm.core.base_plugin

class emsm.core.base_plugin.BasePlugin(app, name)[source]

Bases: object

This is the base class for all plugins.

If you want to know, how to implement your own plugin, you should also take a look at the plugins.hellodolly plugin.

DESCRIPTION = ''

This string is displayed when the --long-help argument is used.

DOWNLOAD_URL = ''

The plugin package can be downloaded from this url.

See also

FINISH_PRIORITY = 0

Integer with the finish priority of the plugin. A higher value results in a later call of the finish method.

HIDDEN = False

If True, the plugin has no argparser() and can therefore not be invoked from the command line.

INIT_PRIORITY = 0

Integer with the init priority of the plugin. A higher value results in a later initialisation.

VERSION = '0.0.0'

The last version number of the EMSM version that worked correctly with that plugin.

app()[source]

Returns the parent EMSM Application that owns this plugin.

argparser()[source]

Returns the argparse.ArgumentParser that is used by this plugin.

If HIDDEN is True, None is returned, since the plugin has no argument parser.

conf()[source]

Returns a dictionary like object that contains the configuration of the plugin.

Deprecated since version 4.0.16-beta: This method has been replaced by global_conf() to clarify the difference to world_conf().

data_dir(create=True)[source]

Returns the directory that contains all data created by the plugin to manage its EMSM job.

Parameters:create (bool) – If the directory does not exist, it will be created.

See also

  • emsm.core.paths.Pathsystem.plugin_data_dir()
finish()[source]

Called when the EMSM application is about to finish. This method can be used for background jobs or clean up stuff.

Subclass:

  • You may override this method.
global_conf()[source]

Returns a dictionary like object, that contains the global configuration of the plugin (plugins.conf).

Seealso:world_conf()
name()[source]

Returns the name of the plugin.

plugin_uninstalled = <blinker.base.NamedSignal object at 0x7fafff4fee10; 'plugin_uninstalled'>

Signal, that is emitted, when a plugin has been uninstalled.

run(args)[source]

The main method of the plugin. This method is called if the plugin has been invoked by the command line arguments.

Params argparse.Namespace args:
 is an argparse.Namespace instance that contains the values of the parsed command line arguments.

Subclass:

  • You may override this method.
uninstall()[source]

Called when the plugin should be uninstalled. This method is interactive and requires the user to confirm if and which data should be removed.

The BasePlugin removes:

  • the plugin module (the .py file in plugins)
  • the plugin data directory
  • the plugin configuration

Subclass:

Subclasses should override the _uninstall() method.

Signals:

See also

world_conf(world)[source]

Returns a dictionary like object, that contains the world specific configuration of the plugin (foo.world.conf).

Seealso:global_conf()
Parameters:world – The WorldWrapper of the world or the world’s name (str).