octoprint.plugin¶
This module represents OctoPrint’s plugin subsystem. This includes management and helper methods as well as the registered plugin types.
-
octoprint.plugin.
plugin_manager
(init=False, plugin_folders=None, plugin_bases=None, plugin_entry_points=None, plugin_disabled_list=None, plugin_blacklist=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None, plugin_validators=None)¶ Factory method for initially constructing and consecutively retrieving the
PluginManager
singleton.Parameters: - init (boolean) – A flag indicating whether this is the initial call to construct the singleton (True) or not
(False, default). If this is set to True and the plugin manager has already been initialized, a
ValueError
will be raised. The same will happen if the plugin manager has not yet been initialized and this is set to False. - plugin_folders (list) – A list of folders (as strings containing the absolute path to them) in which to look for
potential plugin modules. If not provided this defaults to the configured
plugins
base folder andsrc/plugins
within OctoPrint’s code base. - plugin_bases (list) – A list of recognized plugin base classes for which to look for provided implementations. If not
provided this defaults to
OctoPrintPlugin
. - plugin_entry_points (list) – A list of entry points pointing to modules which to load as plugins. If not provided
this defaults to the entry point
octoprint.plugin
. - plugin_disabled_list (list) – A list of plugin identifiers that are currently disabled. If not provided this
defaults to all plugins for which
enabled
is set toFalse
in the settings. - plugin_blacklist (list) – A list of plugin identifiers/identifier-version tuples that are currently blacklisted.
- plugin_restart_needing_hooks (list) – A list of hook namespaces which cause a plugin to need a restart in order be enabled/disabled. Does not have to contain full hook identifiers, will be matched with startswith similar to logging handlers
- plugin_obsolete_hooks (list) – A list of hooks that have been declared obsolete. Plugins implementing them will not be enabled since they might depend on functionality that is no longer available.
- plugin_validators (list) – A list of additional plugin validators through which to process each plugin.
Returns: - A fully initialized
PluginManager
instance to be used for plugin management tasks.
Return type: Raises: ValueError
–init
was True although the plugin manager was already initialized, or it was False although the plugin manager was not yet initialized.- init (boolean) – A flag indicating whether this is the initial call to construct the singleton (True) or not
(False, default). If this is set to True and the plugin manager has already been initialized, a
-
octoprint.plugin.
plugin_settings
(plugin_key, defaults=None, get_preprocessors=None, set_preprocessors=None, settings=None)¶ Factory method for creating a
PluginSettings
instance.Parameters: - plugin_key (string) – The plugin identifier for which to create the settings instance.
- defaults (dict) – The default settings for the plugin, if different from get_settings_defaults.
- get_preprocessors (dict) – The getter preprocessors for the plugin.
- set_preprocessors (dict) – The setter preprocessors for the plugin.
- settings (octoprint.settings.Settings) – The settings instance to use.
Returns: - A fully initialized
PluginSettings
instance to be used to access the plugin’s settings
Return type:
-
octoprint.plugin.
call_plugin
(types, method, args=None, kwargs=None, callback=None, error_callback=None, sorting_context=None, initialized=True)¶ Helper method to invoke the indicated
method
on all registered plugin implementations implementing the indicatedtypes
. Allows providing method arguments and registering callbacks to call in case of success and/or failure of each call which can be used to return individual results to the calling code.Example:
def my_success_callback(name, plugin, result): print("{name} was called successfully and returned {result!r}".format(**locals())) def my_error_callback(name, plugin, exc): print("{name} raised an exception: {exc!s}".format(**locals())) octoprint.plugin.call_plugin( [octoprint.plugin.StartupPlugin], "on_startup", args=(my_host, my_port), callback=my_success_callback, error_callback=my_error_callback )
Parameters: - types (list) – A list of plugin implementation types to match against.
- method (string) – Name of the method to call on all matching implementations.
- args (tuple) – A tuple containing the arguments to supply to the called
method
. Optional. - kwargs (dict) – A dictionary containing the keyword arguments to supply to the called
method
. Optional. - callback (function) – A callback to invoke after an implementation has been called successfully. Will be called
with the three arguments
name
,plugin
andresult
.name
will be the plugin identifier,plugin
the plugin implementation instance itself andresult
the result returned from themethod
invocation. - error_callback (function) – A callback to invoke after the call of an implementation resulted in an exception.
Will be called with the three arguments
name
,plugin
andexc
.name
will be the plugin identifier,plugin
the plugin implementation instance itself andexc
the caught exception. - initialized (boolean) – Ignored.
-
class
octoprint.plugin.
PluginSettings
(settings, plugin_key, defaults=None, get_preprocessors=None, set_preprocessors=None)¶ The
PluginSettings
class is the interface for plugins to their own or globally defined settings.It provides some convenience methods for directly accessing plugin settings via the regular
octoprint.settings.Settings
interfaces as well as means to access plugin specific folder locations.All getter and setter methods will ensure that plugin settings are stored in their correct location within the settings structure by modifying the supplied paths accordingly.
Parameters: -
get
(path, merged=False, asdict=False)¶ Retrieves a raw value from the settings for
path
, optionally merging the raw value with the default settings ifmerged
is set to True.Parameters: - path (list, tuple) – The path for which to retrieve the value.
- merged (boolean) – Whether to merge the returned result with the default settings (True) or not (False, default).
Returns: The retrieved settings value.
Return type: object
-
get_int
(path, min=None, max=None)¶ Like
get()
but tries to convert the retrieved value toint
. Ifmin
is provided and the retrieved value is less than it, it will be returned instead of the value. Likewise formax
- it will be returned if the value is greater than it.
-
get_float
(path, min=None, max=None)¶ Like
get()
but tries to convert the retrieved value tofloat
. Ifmin
is provided and the retrieved value is less than it, it will be returned instead of the value. Likewise formax
- it will be returned if the value is greater than it.
-
set
(path, value, force=False)¶ Sets the raw value on the settings for
path
.Parameters: - path (list, tuple) – The path for which to retrieve the value.
- value (object) – The value to set.
- force (boolean) – If set to True, the modified configuration will even be written back to disk if the value didn’t change.
-
set_int
(path, value, force=False, min=None, max=None)¶ Like
set()
but ensures the value is anint
through attempted conversion before setting it. Ifmin
and/ormax
are provided, it will also be ensured that the value is greater than or equal tomin
and less than or equal tomax
. If that is not the case, the limit value (min
if less than that,max
if greater than that) will be set instead.
-
set_float
(path, value, force=False, min=None, max=None)¶ Like
set()
but ensures the value is anfloat
through attempted conversion before setting it. Ifmin
and/ormax
are provided, it will also be ensured that the value is greater than or equal tomin
and less than or equal tomax
. If that is not the case, the limit value (min
if less than that,max
if greater than that) will be set instead.
-
set_boolean
(path, value, force=False)¶ Like
set()
but ensures the value is anboolean
through attempted conversion before setting it.
-
save
(force=False, trigger_event=False)¶ Saves the settings to
config.yaml
if there are active changes. Ifforce
is set toTrue
the settings will be saved even if there are no changes. Settingstrigger_event
toTrue
will cause aSettingsUpdated
event to get triggered.Parameters: - force (boolean) – Force saving to
config.yaml
even if there are no changes. - trigger_event (boolean) – Trigger the
SettingsUpdated
event on save.
- force (boolean) – Force saving to
-
getPluginLogfilePath
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
get_plugin_logfile_path()
-
get_plugin_data_folder
(*args, **kwargs)¶ Deprecated since version 1.2.0: Replaced by
get_plugin_data_folder()
-
get_plugin_logfile_path
(postfix=None)¶ Retrieves the path to a logfile specifically for the plugin. If
postfix
is not supplied, the logfile will be namedplugin_<plugin identifier>.log
and located within the configuredlogs
folder. If a postfix is supplied, the name will beplugin_<plugin identifier>_<postfix>.log
at the same location.Plugins may use this for specific logging tasks. For example, a
SlicingPlugin
might want to create a log file for logging the output of the slicing engine itself if some debug flag is set.Parameters: postfix (str) – Postfix of the logfile for which to create the path. If set, the file name of the log file will be plugin_<plugin identifier>_<postfix>.log
, if not it will beplugin_<plugin identifier>.log
.Returns: Absolute path to the log file, directly usable by the plugin. Return type: str
-
globalGet
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_get()
-
globalGetBaseFolder
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_get_basefolder()
-
globalGetBoolean
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_get_boolean()
-
globalGetFloat
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_get_float()
-
globalGetInt
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_get_int()
-
globalSet
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_set()
-
globalSetBoolean
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_set_boolean()
-
globalSetFloat
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_set_float()
-
globalSetInt
(*args, **kwargs)¶ Deprecated since version 1.2.0-dev-546: Replaced by
global_set_int()
-
global_get
(path, **kwargs)¶ Getter for retrieving settings not managed by the plugin itself from the core settings structure. Use this to access global settings outside of your plugin.
Directly forwards to
octoprint.settings.Settings.get()
.
-
global_get_basefolder
(folder_type, **kwargs)¶ Retrieves a globally defined basefolder of the given
folder_type
. Directly forwards tooctoprint.settings.Settings.getBaseFolder()
.
-
global_get_boolean
(path, **kwargs)¶ Like
global_get()
but directly orwards tooctoprint.settings.Settings.getBoolean()
.
-
global_get_float
(path, **kwargs)¶ Like
global_get()
but directly forwards tooctoprint.settings.Settings.getFloat()
.
-
global_get_int
(path, **kwargs)¶ Like
global_get()
but directly forwards tooctoprint.settings.Settings.getInt()
.
-
global_set
(path, value, **kwargs)¶ Setter for modifying settings not managed by the plugin itself on the core settings structure. Use this to modify global settings outside of your plugin.
Directly forwards to
octoprint.settings.Settings.set()
.
-
global_set_boolean
(path, value, **kwargs)¶ Like
global_set()
but directly forwards tooctoprint.settings.Settings.setBoolean()
.
-
global_set_float
(path, value, **kwargs)¶ Like
global_set()
but directly forwards tooctoprint.settings.Settings.setFloat()
.
-
global_set_int
(path, value, **kwargs)¶ Like
global_set()
but directly forwards tooctoprint.settings.Settings.setInt()
.
-
octoprint.plugin.core¶
In this module resides the core data structures and logic of the plugin system. It is implemented in an OctoPrint-agnostic way and could be extracted into a separate Python module in the future.
-
class
octoprint.plugin.core.
PluginManager
(plugin_folders, plugin_bases, plugin_entry_points, logging_prefix=None, plugin_disabled_list=None, plugin_blacklist=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None, plugin_validators=None)¶ The
PluginManager
is the central component for finding, loading and accessing plugins provided to the system.It is able to discover plugins both through possible file system locations as well as customizable entry points.
-
get_filtered_implementations
(f, *types, **kwargs)¶ Get all mixin implementations that implement all of the provided
types
and match the provided filter f.Parameters: - f (callable) – A filter function returning True for implementations to return and False for those to exclude.
- types (one or more type) – The types a mixin implementation needs to implement in order to be returned.
Returns: A list of all found and matching implementations.
Return type: list
-
get_helpers
(name, *helpers)¶ Retrieves the named
helpers
for the plugin with identifiername
.If the plugin is not available, returns None. Otherwise returns a
dict
with the requested plugin helper names mapped to the method - if a helper could not be resolved, it will be missing from the dict.Parameters: - name (str) – Identifier of the plugin for which to look up the
helpers
. - helpers (one or more str) – Identifiers of the helpers of plugin
name
to return.
Returns: - A dictionary of all resolved helpers, mapped by their identifiers, or None if the plugin was not
registered with the system.
Return type: dict
- name (str) – Identifier of the plugin for which to look up the
-
get_hooks
(hook)¶ Retrieves all registered handlers for the specified hook.
Parameters: hook (str) – The hook for which to retrieve the handlers. Returns: A dict containing all registered handlers mapped by their plugin’s identifier. Return type: dict
-
get_implementations
(*types, **kwargs)¶ Get all mixin implementations that implement all of the provided
types
.Parameters: types (one or more type) – The types a mixin implementation needs to implement in order to be returned. Returns: A list of all found implementations Return type: list
-
get_plugin
(identifier, require_enabled=True)¶ Retrieves the module of the plugin identified by
identifier
. If the plugin is not registered or disabled andrequired_enabled
is True (the default) None will be returned.Parameters: - identifier (str) – The identifier of the plugin to retrieve.
- require_enabled (boolean) – Whether to only return the plugin if is enabled (True, default) or also if it’s disabled.
Returns: The requested plugin module or None
Return type: module
-
get_plugin_info
(identifier, require_enabled=True)¶ Retrieves the
PluginInfo
instance identified byidentifier
. If the plugin is not registered or disabled andrequired_enabled
is True (the default) None will be returned.Parameters: - identifier (str) – The identifier of the plugin to retrieve.
- require_enabled (boolean) – Whether to only return the plugin if is enabled (True, default) or also if it’s disabled.
Returns: The requested
PluginInfo
or NoneReturn type: PluginInfo
-
static
has_any_of_hooks
(plugin, *hooks)¶ Tests if the
plugin
contains any of the providedhooks
.Uses
octoprint.plugin.core.PluginManager.hook_matches_hooks()
.Parameters: - plugin – plugin to test hooks for
- *hooks – hooks to test against
Returns: - True if any of the plugin’s hooks match the provided hooks,
False otherwise.
Return type: (bool)
-
static
has_any_of_mixins
(plugin, *mixins)¶ Tests if the
plugin
has an implementation implementing any of the providedmixins
.Parameters: - plugin – plugin for which to check the implementation
- *mixins – mixins to test against
Returns: - True if the plugin’s implementation implements any of the
provided mixins, False otherwise.
Return type: (bool)
-
static
hook_matches_hooks
(hook, *hooks)¶ Tests if
hook
matches any of the providedhooks
to test for.hook
is expected to be an exact hook name.hooks
is expected to be a list containing one or more hook names or patterns. That can be either an exact hook name or anfnmatch.fnmatch()
pattern.Parameters: - hook – the hook to test
- hooks – the hook name patterns to test against
Returns: True if the
hook
matches any of thehooks
, False otherwise.Return type: (bool)
-
register_message_receiver
(client)¶ Registers a
client
for receiving plugin messages. Theclient
needs to be a callable accepting two input arguments,plugin
(the sending plugin’s identifier) anddata
(the message itself).
-
send_plugin_message
(plugin, data)¶ Sends
data
in the name ofplugin
to all currently registered message receivers by invoking them with the two arguments.Parameters: - plugin (str) – The sending plugin’s identifier.
- data (object) – The message.
-
unregister_message_receiver
(client)¶ Unregisters a
client
for receiving plugin messages.
-
-
class
octoprint.plugin.core.
PluginInfo
(key, location, instance, name=None, version=None, description=None, author=None, url=None, license=None, parsed_metadata=None)¶ The
PluginInfo
class wraps all available information about a registered plugin.This includes its meta data (like name, description, version, etc) as well as the actual plugin extensions like implementations, hooks and helpers.
It works on Python module objects and extracts the relevant data from those via accessing the control properties.
Parameters: - key (str) – Identifier of the plugin
- location (str) – Installation folder of the plugin
- instance (module) – Plugin module instance - this may be
None
if the plugin has been blacklisted! - name (str) – Human readable name of the plugin
- version (str) – Version of the plugin
- description (str) – Description of the plugin
- author (str) – Author of the plugin
- url (str) – URL of the website of the plugin
- license (str) – License of the plugin
Module attribute from which to retrieve the plugin’s author.
-
attr_check
= '__plugin_check__'¶ Module attribute which to call to determine if the plugin can be loaded.
-
attr_description
= '__plugin_description__'¶ Module attribute from which to retrieve the plugin’s description.
-
attr_disable
= '__plugin_disable__'¶ Module attribute which to call when disabling the plugin.
-
attr_disabling_discouraged
= '__plugin_disabling_discouraged__'¶ Module attribute from which to retrieve the reason why disabling the plugin is discouraged. Only effective if
self.bundled
is True.
-
attr_enable
= '__plugin_enable__'¶ Module attribute which to call when enabling the plugin.
-
attr_helpers
= '__plugin_helpers__'¶ Module attribute from which to retrieve the plugin’s provided helpers.
-
attr_hooks
= '__plugin_hooks__'¶ Module attribute from which to retrieve the plugin’s provided hooks.
-
attr_implementation
= '__plugin_implementation__'¶ Module attribute from which to retrieve the plugin’s provided mixin implementation.
-
attr_implementations
= '__plugin_implementations__'¶ Module attribute from which to retrieve the plugin’s provided implementations.
This deprecated attribute will only be used if a plugin does not yet offer
attr_implementation
. Only the first entry will be evaluated.Deprecated since version 1.2.0-dev-694: Use
attr_implementation
instead.
-
attr_init
= '__plugin_init__'¶ Module attribute which to call when loading the plugin.
This deprecated attribute will only be used if a plugin does not yet offer
attr_load
.Deprecated since version 1.2.0-dev-720: Use
attr_load
instead.
-
attr_license
= '__plugin_license__'¶ Module attribute from which to retrieve the plugin’s license.
-
attr_load
= '__plugin_load__'¶ Module attribute which to call when loading the plugin.
-
attr_name
= '__plugin_name__'¶ Module attribute from which to retrieve the plugin’s human readable name.
-
attr_unload
= '__plugin_unload__'¶ Module attribute which to call when unloading the plugin.
-
attr_url
= '__plugin_url__'¶ Module attribute from which to retrieve the plugin’s website URL.
-
attr_version
= '__plugin_version__'¶ Module attribute from which to retrieve the plugin’s version.
Author of the plugin. Will be taken from the author attribute of the plugin module as defined in
attr_author
if available, otherwise from theauthor
supplied during construction. May be None.Returns: Author of the plugin. Return type: str or None
-
check
¶ Method for pre-load check of plugin. Will be taken from the check attribute of the plugin module as defined in
attr_check
if available, otherwise a lambda always returning True is returned.Returns: - Check method for the plugin module which should return True if the plugin can be loaded, False
- otherwise.
Return type: callable
-
description
¶ Description of the plugin. Will be taken from the description attribute of the plugin module as defined in
attr_description
if available, otherwise from thedescription
supplied during construction. May be None.Returns: Description of the plugin. Return type: str or None
-
disable
¶ Method for disabling the plugin module. Will be taken from the disable attribute of the plugin module as defined in
attr_disable
if available, otherwise a no-operation lambda will be returned.Returns: Disable method for the plugin module. Return type: callable
-
disabling_discouraged
¶ Reason why disabling of this plugin is discouraged. Only evaluated for bundled plugins! Will be taken from the disabling_discouraged attribute of the plugin module as defined in
attr_disabling_discouraged
if available. False if unset or plugin not bundled.Returns: Reason why disabling this plugin is discouraged (only for bundled plugins) Return type: str or None
-
enable
¶ Method for enabling the plugin module. Will be taken from the enable attribute of the plugin module as defined in
attr_enable
if available, otherwise a no-operation lambda will be returned.Returns: Enable method for the plugin module. Return type: callable
-
get_hook
(hook)¶ Parameters: hook (str) – Hook to return. Returns: Handler for the requested hook
or None if no handler is registered.Return type: callable or None
-
get_implementation
(*types)¶ Parameters: types (list) – List of Plugin
sub classes all returned implementations need to implement.Returns: The plugin’s implementation if it matches all of the requested types
, None otherwise.Return type: object
-
helpers
¶ Helpers provided by the plugin. Will be taken from the helpers attribute of the plugin module as defined in
attr_helpers
if available, otherwise an empty list is returned.Returns: Helpers provided by the plugin. Return type: dict
-
hooks
¶ Hooks provided by the plugin. Will be taken from the hooks attribute of the plugin module as defiend in
attr_hooks
if available, otherwise an empty dictionary is returned.Returns: Hooks provided by the plugin. Return type: dict
-
implementation
¶ Implementation provided by the plugin. Will be taken from the implementation attribute of the plugin module as defined in
attr_implementation
if available, otherwise None is returned.Returns: Implementation provided by the plugin. Return type: object
-
license
¶ License of the plugin. Will be taken from the license attribute of the plugin module as defined in
attr_license
if available, otherwise from thelicense
supplied during construction. May be None.Returns: License of the plugin. Return type: str or None
-
load
¶ Method for loading the plugin module. Will be taken from the load attribute of the plugin module as defined in
attr_load
if available, otherwise a no-operation lambda will be returned.Returns: Load method for the plugin module. Return type: callable
-
long_str
(show_bundled=False, bundled_strs=(u' [B]', u''), show_location=False, location_str=u' - {location}', show_enabled=False, enabled_strs=(u'* ', u' ', u'X '))¶ Long string representation of the plugin’s information. Will return a string of the format
<enabled><str(self)><bundled><location>
.enabled
,bundled
andlocation
will only be displayed if the corresponding flags are set toTrue
. The will be filled fromenabled_str
,bundled_str
andlocation_str
as follows:enabled_str
- a 3-tuple, the first entry being the string to insert when the plugin is enabled, the second entry the string to insert when it is not, the third entry the string when it is blacklisted.
bundled_str
- a 2-tuple, the first entry being the string to insert when the plugin is bundled, the second entry the string to insert when it is not.
location_str
- a format string (to be parsed with
str.format
), the{location}
placeholder will be replaced with the plugin’s installation folder on disk.
Parameters: - show_enabled (boolean) – whether to show the
enabled
part - enabled_strs (tuple) – the 2-tuple containing the two possible strings to use for displaying the enabled state
- show_bundled (boolean) – whether to show the
bundled
part - bundled_strs (tuple) – the 2-tuple containing the two possible strings to use for displaying the bundled state
- show_location (boolean) – whether to show the
location
part - location_str (str) – the format string to use for displaying the plugin’s installation location
Returns: The long string representation of the plugin as described above
Return type: str
-
name
¶ Human readable name of the plugin. Will be taken from name attribute of the plugin module if available, otherwise from the
name
supplied during construction with a fallback tokey
.Returns: Name of the plugin, fallback is the plugin’s identifier. Return type: str
-
unload
¶ Method for unloading the plugin module. Will be taken from the unload attribute of the plugin module as defined in
attr_unload
if available, otherwise a no-operation lambda will be returned.Returns: Unload method for the plugin module. Return type: callable
-
url
¶ Website URL for the plugin. Will be taken from the url attribute of the plugin module as defined in
attr_url
if available, otherwise from theurl
supplied during construction. May be None.Returns: Website URL for the plugin. Return type: str or None
-
version
¶ Version of the plugin. Will be taken from the version attribute of the plugin module as defined in
attr_version
if available, otherwise from theversion
supplied during construction. May be None.Returns: Version of the plugin. Return type: str or None
-
class
octoprint.plugin.core.
Plugin
¶ The parent class of all plugin implementations.
-
_identifier
¶ The identifier of the plugin. Injected by the plugin core system upon initialization of the implementation.
-
_plugin_name
¶ The name of the plugin. Injected by the plugin core system upon initialization of the implementation.
-
_plugin_version
¶ The version of the plugin. Injected by the plugin core system upon initialization of the implementation.
-
_basefolder
¶ The base folder of the plugin. Injected by the plugin core system upon initialization of the implementation.
-
_logger
¶ The logger instance to use, with the logging name set to the
PluginManager.logging_prefix
of thePluginManager
concatenated with_identifier
. Injected by the plugin core system upon initialization of the implementation.
-
initialize
()¶ Called by the plugin core after performing all injections. Override this to initialize your implementation.
-
-
class
octoprint.plugin.core.
RestartNeedingPlugin
¶ Mixin for plugin types that need a restart after enabling/disabling them.
-
class
octoprint.plugin.core.
SortablePlugin
¶ Mixin for plugin types that are sortable.
-
get_sorting_key
(context=None)¶ Returns the sorting key to use for the implementation in the specified
context
.May return
None
if order is irrelevant.Implementations returning None will be ordered by plugin identifier after all implementations which did return a sorting key value that was not None sorted by that.
Parameters: context (str) – The sorting context for which to provide the sorting key value. Returns: - An integer signifying the sorting key value of the plugin
- (sorting will be done ascending), or None if the implementation doesn’t care about calling order.
Return type: int or None
-
octoprint.plugin.types¶
This module bundles all of OctoPrint’s supported plugin implementation types as well as their common parent
class, OctoPrintPlugin
.
Please note that the plugin implementation types are documented in the section Available plugin mixins.
-
class
octoprint.plugin.types.
OctoPrintPlugin
¶ Bases:
octoprint.plugin.core.Plugin
The parent class of all OctoPrint plugin mixins.
-
_plugin_manager
¶ The
PluginManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_printer_profile_manager
¶ The
PrinterProfileManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_event_bus
¶ The
EventManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_analysis_queue
¶ The
AnalysisQueue
instance. Injected by the plugin core system upon initialization of the implementation.
-
_slicing_manager
¶ The
SlicingManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_file_manager
¶ The
FileManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_printer
¶ The
PrinterInterface
instance. Injected by the plugin core system upon initialization of the implementation.
-
_app_session_manager
¶ The
SessionManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_plugin_lifecycle_manager
¶ The
LifecycleManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_user_manager
¶ The
UserManager
instance. Injected by the plugin core system upon initialization of the implementation.
-
_connectivity_checker
¶ The
ConnectivityChecker
instance. Injected by the plugin core system upon initialization of the implementation.
-
_data_folder
¶ Path to the data folder for the plugin to use for any data it might have to persist. Should always be accessed through
get_plugin_data_folder()
since that function will also ensure that the data folder actually exists and if not creating it before returning it. Injected by the plugin core system upon initialization of the implementation.
-
get_plugin_data_folder
()¶ Retrieves the path to a data folder specifically for the plugin, ensuring it exists and if not creating it before returning it.
Plugins may use this folder for storing additional data they need for their operation.
-
-
class
octoprint.plugin.types.
ReloadNeedingPlugin
¶ Bases:
octoprint.plugin.core.Plugin
Mixin for plugin types that need a reload of the UI after enabling/disabling them.