pluginmanager module
- class pluginmanager.Plugin[source]
Bases:
object
Interface methods to customize behavior for different backup steps
Back In Time allows to inform plugins (implemented in Python files) about different steps (“events”) in the backup process. Plugins may implement special behavior to predefined “events” that are declared in this interface class as methods.
To implement a new plugin create a new class that inherits from this one and implement all methods.
Plugins are loaded by calling
PluginManager.load()
.- appExit()[source]
Called when the GUI of Back In Time is closed
- Returns:
None
(return value will be ignored anyhow)
- appStart()[source]
Called when the GUI of Back In Time was started.
Not called when only the CLI command was started without the GUI.
- Returns:
None
(return value will be ignored anyhow)
- error(code, message)[source]
Indicates errors during the backup process
Called to send errors in the backup process (while taking a snapshot) to plugins.
- Parameters:
code –
A Back In Time error code
Known error codes:
- 1: No or no valid configuration
(check the configuration file)
- 2: A backup process is already running.
Make sure that automatic and manual backups do not run at once.
- 3: Snapshots directory not found
(eg. when a removable drive is not mounted)
- 4: The requested snapshot for “now” already exists.
message
contains the SID (snapshot ID) then.- 5: Error while taking a snapshot.
message
contains more information (as string).- 6: New snapshot taken but with errors.
message
contains the SID (snapshot ID) then.
message – The error message for the code (mostly an empty string by default)
- Returns:
None
(return value will be ignored anyhow)
- isGui()[source]
Indicates a GUI-related plugin
The return value shall indicate if the plugin is related to the Back In Time GUI. Loaded GUI-related plugins are called before non-GUI-related plugins by the PluginManager.
- Returns:
True if plugin is GUI-related, otherwise False
- message(profile_id, profile_name, level, message, timeout)[source]
Called to send snapshot-related messages to plugins
- Parameters:
profile_id – Profile ID from configuration
profile_name – Profile name from the configuration
level – 0 = INFO, 1 = ERROR
message – Message text
timeout – Requested timeout in seconds to process the message. Not used at the moment. (default -1 means “no timeout”)
- Returns:
None
(return value will be ignored anyhow)
- mount(profileID=None)[source]
Called when mounting a filesystem for the profile may be necessary.
- Parameters:
profileID – Profile ID from the configuration
- Returns:
None
(return value will be ignored anyhow)
- newSnapshot(snapshot_id, snapshot_path)[source]
Called when the backup process has taken a new snapshot.
A new snapshot is only taken by the backup process if required (as configured).
- Parameters:
snapshot_id – The id of the new snapshot
snapshot_path – The path to the new snapshot
- Returns:
None
(return value will be ignored anyhow)
- processBegin()[source]
Called before a backup process is started.
A new snapshot is only taken if required (as configured).
- Returns:
None
(return value will be ignored anyhow)
- class pluginmanager.PluginManager[source]
Bases:
object
Central interface for loading plugins and calling their API
Back In Time allows to inform plugins (implemented in Python files) about different steps (“events”) in the backup process.
Use this class to load installed plugin classes and call their methods (see the interface declared by
Plugin
).Plugins are loaded by calling
PluginManager.load()
.When you call a plugin function of the PluginManager it will call this plugin function for all loaded plugins.
- load(snapshots=None, cfg=None, force=False)[source]
Loads plugins
Loads all plugins from python source code files that are stored in one of these plugin sub folders in the installation root folder:
‘plugins’, ‘common/plugins’, ‘qt/plugins’
Plugins must inherit from
Plugin
otherwise they are silently ignored.- Parameters:
snapshots (snapshots.Snapshots) – Snapshot info
cfg (config.Config) – Current configuration
force (bool) –
True
to enforce reloading all plugins (False
does only load if not already done)
- Returns:
None