Package peppy :: Package yapsy :: Module PluginManager :: Class PluginManager
[frames] | no frames]

Class PluginManager

object --+
         |
        PluginManager


    Manage several plugins by ordering them in several categories.

    The mechanism for searching and loading the plugins is already
    implemented in this class so that it can be used directly (hence
    it can be considered as a bit more than a mere interface)

    The file describing a plugin should be written in the sytax
    compatible with Python's ConfigParser module as in the following
    example:
    
    '
     [Core Information]
     Name= My plugin Name
     Module=the_name_of_the_pluginto_load_with_no_py_ending

     [Documentation]
     Description=What my plugin broadly does
     Author= My very own name
     Website= My very own website
     Version=the_version_number_of_the_plugin       
'
    

Instance Methods
 
__init__(self, categories_filter={'Default': <class 'peppy.yapsy.IPlugin.IPlugin'>}, directories_list=['/home/rob/src/peppy-git/peppy-0.7.2.5/peppy/yapsy'], plugin_info_ext='yapsy-plugin')
Initialize the mapping of the categories and set the list of directories where plugins may be.
 
setCategoriesFilter(self, categories_filter)
Set the categories of plugins to be looked for as well as the way to recognise them.
 
setPluginInfoClass(self, picls)
Set the class that holds PluginInfo.
 
getPluginInfoClass(self)
Get the class that holds PluginInfo.
 
setPluginPlaces(self, directories_list)
Set the list of directories where to look for plugin places.
 
setPluginInfoExtension(self, plugin_info_ext)
Set the extension that identifies a plugin info file.
 
getCategories(self)
Return the list of all categories.
 
getPluginsOfCategory(self, category_name)
Return the list of all plugins belonging to a category.
 
locatePlugins(self)
Walk through the plugins' places and look for plugins.
 
loadPlugins(self, callback=None)
Load the candidate plugins that have been identified through a previous call to locatePlugins.
 
collectPlugins(self)
Walk through the plugins' places and look for plugins.
 
activatePluginByName(self, category, name)
Activate a plugin corresponding to a given category + name.
 
deactivatePluginByName(self, category, name)
Desactivate a plugin corresponding to a given category + name.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, categories_filter={'Default': <class 'peppy.yapsy.IPlugin.IPlugin'>}, directories_list=['/home/rob/src/peppy-git/peppy-0.7.2.5/peppy/yapsy'], plugin_info_ext='yapsy-plugin')
(Constructor)

 

Initialize the mapping of the categories and set the list of directories where plugins may be. This can also be set by direct call the methods:

  • ``setCategoriesFilter`` for ``categories_filter``
  • ``setPluginPlaces`` for ``directories_list``
  • ``setPluginInfoExtension`` for ``plugin_info_ext``

You may look at these function's documentation for the meaning of each corresponding arguments.

Overrides: object.__init__

setCategoriesFilter(self, categories_filter)

 

Set the categories of plugins to be looked for as well as the way to recognise them.

The ``categories_filter`` first defines the various categories in which the plugins will be stored via its keys and it also defines the interface tha has to be inherited by the actual plugin class belonging to each category.

setPluginInfoClass(self, picls)

 

Set the class that holds PluginInfo. The class should inherit from ``PluginInfo``.

getPluginInfoClass(self)

 

Get the class that holds PluginInfo. The class should inherit from ``PluginInfo``.

setPluginInfoExtension(self, plugin_info_ext)

 

Set the extension that identifies a plugin info file.

The ``plugin_info_ext`` is the extension that will have the informative files describing the plugins and that are used to actually detect the presence of a plugin (see ``collectPlugins``).

locatePlugins(self)

 

Walk through the plugins' places and look for plugins.

Return the number of plugins found.

loadPlugins(self, callback=None)

 

Load the candidate plugins that have been identified through a previous call to locatePlugins. For each plugin candidate look for its category, load it and store it in the appropriate slot of the category_mapping.

If a callback function is specified, call it before every load attempt. The plugin_info instance is passed as an argument to the callback.

collectPlugins(self)

 

Walk through the plugins' places and look for plugins. Then for each plugin candidate look for its category, load it and stores it in the appropriate slot of the category_mapping.