IPlugin

class mobase.IPlugin

Bases: ABC

Base class for all plugins.

Methods Summary

author()

rtype:

str

description()

rtype:

str

enabledByDefault()

Check whether this plugin should be enabled by default.

init(organizer)

Initialize this plugin.

localizedName()

Retrieve the localized name of the plugin.

master()

Retrieve the master plugin of this plugin.

name()

Retrieve the name of the plugin.

requirements()

Retrieve the requirements for this plugin.

settings()

rtype:

Sequence[PluginSetting]

version()

rtype:

VersionInfo

Methods Documentation

abstract author()
Return type:

str

Returns:

The name of the plugin author.

abstract description()
Return type:

str

Returns:

The description for this plugin.

enabledByDefault()

Check whether this plugin should be enabled by default.

Return type:

bool

Returns:

True if this plugin should be enabled by default, False otherwise.

abstract init(organizer)

Initialize this plugin.

Note that this function may never be called if no IOrganizer is available at that time, such as when creating the first instance in MO.

Plugins will probably want to store the organizer pointer. It is guaranteed to be valid as long as the plugin is loaded.

These functions may be called before init(): :rtype: bool

  • name()

  • see IPluginGame for more.

Parameters:

organizer – The main organizer interface.

Returns:

True if the plugin was initialized correctly, False otherwise.

localizedName()

Retrieve the localized name of the plugin.

Unlike name(), this method can (and should!) return a localized name for the plugin. This method returns name() by default.

Return type:

str

Returns:

The localized name of the plugin.

master()

Retrieve the master plugin of this plugin.

It is often easier to implement a functionality as multiple plugins in MO2, but ship the plugins together, e.g. as a Python module or using createFunctions(). In this case, having a master plugin (one of the plugin, or a separate one) tells MO2 that these plugins are linked and should also be displayed together in the UI. If MO2 ever implements automatic updates for plugins, the master() plugin will also be used for this purpose.

Return type:

str

Returns:

The master plugin of this plugin, or a null pointer if this plugin does not have a master.

abstract name()

Retrieve the name of the plugin.

The name of the plugin is used for internal storage purpose so it should not change, and it should be static. In particular, you should not use a localized string (tr()) for the plugin name.

In the future, we will provide a way to localized plugin names using a distinct method, such as localizedName().

Return type:

str

Returns:

The name of the plugin.

requirements()

Retrieve the requirements for this plugin.

This method is called right after init() and the ownership the requirements is

Return type:

List[IPluginRequirement]

Returns:

The list of requirements for this plugin.

abstract settings()
Return type:

Sequence[PluginSetting]

Returns:

A list of settings for this plugin.

abstract version()
Return type:

VersionInfo

Returns:

The version of this plugin.