IPlugin

class mobase.IPlugin

Bases: abc.ABC

Base class for all plugins.

Methods Summary

author()

returns

The name of the plugin author.

description()

returns

The description for this plugin.

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()

returns

A list of settings for this plugin.

version()

returns

The version of this plugin.

Methods Documentation

abstract author()
Returns

The name of the plugin author.

Return type

str

abstract description()
Returns

The description for this plugin.

Return type

str

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():

  • name()

  • see IPluginGame for more.

Parameters

organizer – The main organizer interface.

Returns

True if the plugin was initialized correctly, False otherwise.

Return type

bool

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.

Returns

The localized name of the plugin.

Return type

str

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.

Returns

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

Return type

str

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().

Returns

The name of the plugin.

Return type

str

requirements()

Retrieve the requirements for this plugin.

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

Returns

The list of requirements for this plugin.

Return type

List[IPluginRequirement]

abstract settings()
Returns

A list of settings for this plugin.

Return type

List[PluginSetting]

abstract version()
Returns

The version of this plugin.

Return type

VersionInfo