plugins package¶
Submodules¶
plugins.manager module¶
- filename
sppas.src.plugins.manager.py
- author
Brigitte Bigi
- contact
- summary
The plugins manager: manage the list of plugins.
- class plugins.manager.sppasPluginsManager[source]¶
Bases:
threading.Thread
Class to manage the list of plugins into SPPAS.
- append(plugin_folder)[source]¶
Append a plugin in the list of plugins.
It is supposed that the given plugin folder name is a folder of the plugin directory.
- Parameters
plugin_folder – (str) The folder name of the plugin.
- delete(plugin_id)[source]¶
Delete a plugin of the plugins directory.
- Parameters
plugin_id – (str) Identifier of the plugin to delete.
- get_plugin(plugin_id)[source]¶
Get the sppasPluginParam from a plugin identifier.
- Returns
sppasPluginParam matching the plugin_id or None
- install(plugin_archive, plugin_folder)[source]¶
Install a plugin into the plugin directory.
- Parameters
plugin_archive – (str) File name of the plugin to be installed (ZIP).
plugin_folder – (str) Destination folder name of the plugin to be installed.
- load()[source]¶
Load all installed plugins in the SPPAS directory.
A plugin is not loaded if:
a configuration file is not defined or corrupted,
the platform system of the command does not match.
plugins.plugin module¶
- filename
sppas.src.plugins.plugin.py
- author
Brigitte Bigi
- contact
- summary
Data structure of one plugin of SPPAS.
- class plugins.plugin.sppasPluginParam(directory, config_file)[source]¶
Bases:
object
Class to represent the set of parameters of a plugin.
The set of parameters of a plugin is made of a directory name, a configuration file name and a sppasPluginParser. This latter allows to get all information related to the plugin from the configuration file name:
the plugin configuration: identifier, name, description and icon;
the commands for windows, macos and linux;
a set of options, each one containing at least an identifier,
and optionally a type, a value and a description text.
plugins.pluginsexc module¶
- filename
sppas.src.plugins.pluginexc.py
- author
Brigitte Bigi
- contact
- summary
Exceptions for plugins package.
- exception plugins.pluginsexc.CommandExecError(command_name)[source]¶
Bases:
OSError
:ERROR 4070:.
{command_name} is not a valid command on your operating system.
- exception plugins.pluginsexc.CommandSystemError(current_system, supported_systems=[])[source]¶
Bases:
OSError
:ERROR 4075:.
No command was defined for the system: {:s}. Supported systems of this plugin are: {:s}.
- exception plugins.pluginsexc.OptionKeyError(key)[source]¶
Bases:
KeyError
:ERROR 4080:.
No option with key {:s}.
- exception plugins.pluginsexc.PluginArchiveFileError[source]¶
Bases:
Exception
:ERROR 4020:.
Unsupported plugin file type.
- exception plugins.pluginsexc.PluginArchiveIOError[source]¶
Bases:
OSError
:ERROR 4024:.
Unsupported plugin file type.
- exception plugins.pluginsexc.PluginConfigFileError[source]¶
Bases:
OSError
:ERROR 4010:.
Missing plugin configuration file.
- exception plugins.pluginsexc.PluginDuplicateError[source]¶
Bases:
OSError
:ERROR 4030:.
A plugin with the same name is already existing in the plugins folder.
- exception plugins.pluginsexc.PluginFolderError(plugin_folder)[source]¶
Bases:
OSError
:ERROR 4050:.
No such plugin folder: {:s}.
- exception plugins.pluginsexc.PluginIdError(plugin_id)[source]¶
Bases:
ValueError
:ERROR 4040:.
No plugin with identifier {plugin_id} is available.
- exception plugins.pluginsexc.PluginKeyError[source]¶
Bases:
KeyError
:ERROR 4060:.
A plugin with the same key is already existing or plugin already loaded.
plugins.process module¶
- filename
sppas.src.plugins.process.py
- author
Brigitte Bigi
- contact
- summary
Process to execute a plugin of SPPAS.
- class plugins.process.sppasPluginProcess(plugin_param)[source]¶
Bases:
object
Process one plugin (and only one).
- __init__(plugin_param)[source]¶
Create a new sppasPluginProcess instance.
- Parameters
plugin_param – (sppasPluginParam)
- communicate()[source]¶
Wait for the process and get output messages (if any).
- Returns
output message
Module contents¶
- filename
sppas.src.plugins.__init__.py
- author
Brigitte Bigi
- contact
- summary
Package for plugins of SPPAS.
plugins: access and manage external programs.¶
This package includes classes to manage external program to plug into SPPAS.
- Example
>>> # Create a plugin manager (it will explore the installed plugins).
>>> manager = sppasPluginsManager()
>>> # Install a plugin
>>> plugin_id = manager.install(plugin_zip_filename,
>>> plugin_destination_folder_name)
>>> # Get a plugin
>>> p = manager.get_plugin(plugin_id)
>>> # Apply a plugin on a list of files
>>> message = manager.run_plugin(plugin_id, [some_filename1, some_filename2])
>>> print(message)
>>> # Delete an installed plugin
>>> manager.delete(plugin_id)
Requires the following other packages:
config
utils
structs
- class plugins.sppasPluginParam(directory, config_file)[source]¶
Bases:
object
Class to represent the set of parameters of a plugin.
The set of parameters of a plugin is made of a directory name, a configuration file name and a sppasPluginParser. This latter allows to get all information related to the plugin from the configuration file name:
the plugin configuration: identifier, name, description and icon;
the commands for windows, macos and linux;
a set of options, each one containing at least an identifier,
and optionally a type, a value and a description text.
- class plugins.sppasPluginProcess(plugin_param)[source]¶
Bases:
object
Process one plugin (and only one).
- __init__(plugin_param)[source]¶
Create a new sppasPluginProcess instance.
- Parameters
plugin_param – (sppasPluginParam)
- communicate()[source]¶
Wait for the process and get output messages (if any).
- Returns
output message
- class plugins.sppasPluginsManager[source]¶
Bases:
threading.Thread
Class to manage the list of plugins into SPPAS.
- append(plugin_folder)[source]¶
Append a plugin in the list of plugins.
It is supposed that the given plugin folder name is a folder of the plugin directory.
- Parameters
plugin_folder – (str) The folder name of the plugin.
- delete(plugin_id)[source]¶
Delete a plugin of the plugins directory.
- Parameters
plugin_id – (str) Identifier of the plugin to delete.
- get_plugin(plugin_id)[source]¶
Get the sppasPluginParam from a plugin identifier.
- Returns
sppasPluginParam matching the plugin_id or None
- install(plugin_archive, plugin_folder)[source]¶
Install a plugin into the plugin directory.
- Parameters
plugin_archive – (str) File name of the plugin to be installed (ZIP).
plugin_folder – (str) Destination folder name of the plugin to be installed.
- load()[source]¶
Load all installed plugins in the SPPAS directory.
A plugin is not loaded if:
a configuration file is not defined or corrupted,
the platform system of the command does not match.