core.components.plugin module

class core.components.plugin.Plugin(name, module)[source]

Bases: object

class core.components.plugin.PluginManager(base_folders=None)[source]

Bases: object

Yapsy semi-compatible plugin manager.

collectPlugins()[source]
getAllPlugins()[source]
setPluginPlaces(plugin_folders)[source]
core.components.plugin.get_available_methods(plugin_manager)[source]

Gets the available methods in a dictionary of plugins.

Parameters:plugin_manager (yapsy.PluginManager) – A dictionary of modules.
Return type:Dictionary
Returns:A dictionary containing the methods from loaded plugins.

Example

>>> plugins = core.components.plugin.load_directory("core/components/menu")
{'player_facing': <module 'player_facing' from 'core/components/event/player_facing.pyc'>}
>>> core.components.plugin.get_available_methods(plugins)
{'do_nothing': {'method': <function do_nothing at 0x7f20e1bec398>,
                'module': 'player_facing'},
 'player_facing': {'method': <function player_facing at 0x7f20e1bec320>,
                   'module': 'player_facing'}}
core.components.plugin.load_directory(plugin_folder)[source]

Loads and imports a directory of plugins.

Parameters:plugin_folder (String) – The folder to look for plugin files.
Return type:Dictionary
Returns:A dictionary of imported plugins.