plugins

A collection of classes, metaclasses and functions for Plugins

As a plugin developer: Subclass from one of the JB_Plugin classes and implement the abstract functions. The plugin managers load and hold plugins.

class jukeboxcore.plugins.JB_Plugin[source]

Bases: object

Abstract Base Class for jukebox plugins.

Subclass this to create your own types of plugins. The name of the subclass will be the name of the plugin itself, so be sure to pick a unique one. Else you will override an existing plugin (maybe that is your intend, then do it). If you write a plugin, always subclass from a subclass of JB_Plugin but not JB_Plugin directly!

For subclassing: you have to implement init and uninit!

Metadata:

This class has a few public attributes. Override them to supply metadata for your plugin.

User Config:

Every Plugin can have its own userpreference file. The user preferences are ini-files that lie in the config folder inside the pipeline user directory. As a plugin developer, create a configspec file in the same folder as your plugin module. Do it only, if you need to use get_config().

Constructs a new Plugin

Returns:None
Return type:None
Raises:None
required = ()

The plugins required to run this one successfully. Set this to a list of strings with the required classnames.

author = None

The author of the plugin.

copyright = None

Copyright information.

license = None

License information.

version = None

The version of the plugin.

description = None

A descriptive text for the plugin.

init()[source]

Initialize the plugin

This function gets called when the plugin is loaded by the plugin manager. It is abstract and has to be implemented in a subclass

Returns:
Return type:
Raises:
uninit()[source]

Uninitialize the plugin

This function gets called when the plugin is unloaded by the plugin manager. It is abstract and has to be implemented in a subclass

Returns:
Return type:
Raises:
is_loaded()[source]

Return True if the plugin is loaded

Returns:Returns False if the plugin is not loaded
Return type:bool
Raises:None
get_config()[source]

Return the user config for this plugin

You have to provide a configspec, put the configspec file in the same folder as your plugin. Name it like your class and put ‘ini’ as extension.

name[source]

Return the name of the plugin. Equivalent quering __class__.__name__

Returns:The name of the plugin
Return type:str
Raises:None
class jukeboxcore.plugins.JB_StandalonePlugin[source]

Bases: jukeboxcore.plugins.JB_Plugin

Abstract plugin class for standalone addons.

Standalone addons feature a special run method an can be run with the jukebox launcher. The launcher will first initialize the plugin and then call the run method.

For subclassing: you have to implement init, unit and run!

Constructs a new Plugin

Returns:None
Return type:None
Raises:None
run()[source]

Start the plugin. This method is also called by the jukebox launcher.

Returns:None
Return type:None
Raises:None
class jukeboxcore.plugins.JB_StandaloneGuiPlugin[source]

Bases: jukeboxcore.plugins.JB_StandalonePlugin

Abstract plugin class for standalone addons that need a gui.

Standalone addons feature a special run method an can be run with the jukebox launcher. The launcher will first initialize the plugin and then call the run method. The launcher will also initialize the gui before running the plugin.

For subclassing: you have to implement init, unit and run!

Constructs a new Plugin

Returns:None
Return type:None
Raises:None
class jukeboxcore.plugins.JB_CorePlugin[source]

Bases: jukeboxcore.plugins.JB_Plugin

Core plugin class

Core plugins should be loadable at all times and not require a specific software to run.

For subclassing: you have to implement init and uninit!

Constructs a new Plugin

Returns:None
Return type:None
Raises:None
class jukeboxcore.plugins.JB_CoreStandalonePlugin[source]

Bases: jukeboxcore.plugins.JB_StandalonePlugin, jukeboxcore.plugins.JB_CorePlugin

Core plugin for standalone addons.

Standalone addons feature a special run method an can be run with the jukebox launcher. The launcher will first initialize the plugin and then call the run method.

For subclassing: you have to implement init, unit and run!

Constructs a new Plugin

Returns:None
Return type:None
Raises:None
class jukeboxcore.plugins.JB_CoreStandaloneGuiPlugin[source]

Bases: jukeboxcore.plugins.JB_StandaloneGuiPlugin, jukeboxcore.plugins.JB_CoreStandalonePlugin

Core plugin for standalone addons that also need a gui.

Standalone addons feature a special run method an can be run with the jukebox launcher. The launcher will first initialize the plugin and then call the run method.

For subclassing: you have to implement init, unit and run!

Constructs a new Plugin

Returns:None
Return type:None
Raises:None
class jukeboxcore.plugins.PluginManager[source]

Bases: object

Loads and unloads core plugins.

A plugin manager scanns the plugin directories for plugins. Only plugins types that are supported can be loaded. If you need special plugins for a software, subclass JB_Plugin. Then create a subclass of this plugin manager and override supportedTypes. Core plugins should always be supported.

The gathering of plugins is done during initialisation. To load the plugins, call load_plugins(). This will load all found plugins.

Constructs a new PluginManager, use the get method in 99% of cases!

Raises:None
instance = None

PluginManager instance when using PluginManager.get()

supportedTypes = [<class 'jukeboxcore.plugins.JB_CorePlugin'>, <class 'jukeboxcore.plugins.JB_CoreStandalonePlugin'>, <class 'jukeboxcore.plugins.JB_CoreStandaloneGuiPlugin'>]

A list of plugin classes, the manager can load. Override this list in a subclass if you want to support more than just core plugins, e.g. plugins that are meant for a specific software.

builtinpluginpath = 'h:\\projects\\jukebox-core\\src\\jukeboxcore\\addons'

String of Paths for builtin plugins, seperated by os.pathsep

classmethod get()[source]

Return a PluginManager Instance.

This will always return the same instance. If the instance is not available it will be created and returned. There should only be one pluginmanager at a time. If you create a PluginManager with get() and use get() on for example a MayaPluginManager, the PluginManager instance is returned (not a MayaPluginManager).

Returns:always the same PluginManager
Return type:PluginManager
Raises:None
find_plugins(path)[source]

Return a list with all plugins found in path

Parameters:path (str) – the directory with plugins
Returns:list of JB_Plugin subclasses
Return type:list
Raises:None
gather_plugins()[source]

Return all plugins that are found in the plugin paths

Looks in the .. PluginManager.builtinpluginpath Then in the envvar JUKEBOX_PLUGIN_PATH.

Returns:
Return type:
Raises:
load_plugins()[source]

Loads all found plugins

Returns:None
Return type:None
Raises:None
load_plugin(p)[source]

Load the specified plugin

Parameters:p (Subclass of JB_Plugin) – The plugin to load
Returns:None
Return type:None
Raises:errors.PluginInitError
unload_plugins()[source]

Unloads all loaded plugins

Returns:None
Return type:None
Raises:None
get_plugin(plugin)[source]

Return the plugin instance for the given pluginname

Parameters:plugin (str) – Name of the plugin class
Returns:the plugin that matches the name
Return type:JB_Plugin like
Raises:None
get_all_plugins()[source]

Return all plugins

Returns:a list of all plugins found by the manager