Package libxyz :: Package core :: Package plugins :: Module manager :: Class PluginManager

[hide private]
[frames] | no frames]

# Class PluginManager

source code

    object --+
             |
            PluginManager

Plugin manager class It is supposed to provide easy access to plugin data

Instance Methods | [hide private]

__init__(self, xyz, dirs) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

load(self, plugin, *initargs, **initkwargs) Load and initiate required plugin | source code

reload(self, plugin, *initargs, **initkwargs) Force load plugin if it's already in cache. | source code

from_load(self, plugin, method) Load method from plugin. | source code

from_load_data(self, plugin, obj) Load data object from plugin. | source code

is_loaded(self, plugin) Check if plugin already loaded | source code

get_loaded(self, plugin=None) Return loaded and initiated inistance of plugin | source code

get_all_loaded(self) Return all currenty loaded plugins as dictionary with plugins ns path as keys and instances as values | source code

set_loaded(self, plugin, inst) Set loaded and initiated inistance of plugin | source code

del_loaded(self, plugin) Delete loaded instance from cache | source code

wait_for(self, plugin, callback, *args) Some virtual plugins are not available at the parsing time. | source code

shutdown(self, plugin=None) Run destructors on specified or all loaded plugins | source code

register(self, obj) Register new plugin. | source code

is_virtual(self, plugin) | source code

_enabled_list(self) Make list of enabled plugins | source code

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

Class Variables | [hide private]

| PLUGIN_CLASS = `u"XYZPlugin"`
| PLUGIN_FILE = `u"main"`
| VIRTUAL_NAMESPACE = `u"sys"`
| EVENT_INIT = `u"event:plugin_init"`
| EVENT_FROM_LOAD = `u"event:plugin_from_load"`
| EVENT_FROM_LOAD_DATA = `u"event:plugin_from_load_data"`
| EVENT_PREPARE = `u"event:plugin_prepare"`
| EVENT_FIN = `u"event:plugin_fin"`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, xyz, dirs)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  - `xyz` - XYZ data
  - `dirs` (list) - Plugin directories list
Overrides: object.__init__

### load(self, plugin, *initargs, **initkwargs)

source code

Load and initiate required plugin

Parameters:
  - `plugin` - Plugin namespace path
  - `initargs` - Necessary arguments to initiate plugin
  - `initkwargs` - Necessary kw arguments to initiate plugin
Decorators:
  - `@ns_transform`

### reload(self, plugin, *initargs, **initkwargs)

source code

Force load plugin if it's already in cache.

Decorators:
  - `@ns_transform`

### from_load(self, plugin, method)

source code

Load method from plugin. If plugin was not loaded before, load and initiate it first.

Parameters:
  - `plugin` - Plugin namespace path
  - `method` - Public method name
Decorators:
  - `@ns_transform`

### from_load_data(self, plugin, obj)

source code

Load data object from plugin. If plugin was not loaded before, load and initiate it first.

Parameters:
  - `plugin` - Plugin namespace path
  - `obj` - Public data object name
Decorators:
  - `@ns_transform`

### is_loaded(self, plugin)

source code

Check if plugin already loaded

Parameters:
  - `plugin` - Plugin namespace path
Decorators:
  - `@ns_transform`

### get_loaded(self, plugin=None)

source code

Return loaded and initiated inistance of plugin

Parameters:
  - `plugin` - Plugin namespace path
Decorators:
  - `@ns_transform`

### set_loaded(self, plugin, inst)

source code

Set loaded and initiated inistance of plugin

Parameters:
  - `plugin` - Plugin namespace path
  - `inst` - Plugin instance
Decorators:
  - `@ns_transform`

### del_loaded(self, plugin)

source code

Delete loaded instance from cache

Parameters:
  - `plugin` - Plugin namespace path
Decorators:
  - `@ns_transform`

### wait_for(self, plugin, callback, *args)

source code

Some virtual plugins are not available at the parsing time. This method is used to wait while plugin is loaded and then run callback. Arguments to callback: loaded plugin obj, and all optional *args passed

Decorators:
  - `@ns_transform`

### register(self, obj)

source code

Register new plugin.

Parameters:
  - `obj` - libxyz.core.BasePlugin inherited instance