Uranium
Application Framework
|
Public Member Functions | |
None | __init__ (self, "Application" application, QObject parent=None) |
None | setCheckIfTrusted (self, bool check_if_trusted, bool debug_mode=False) |
bool | getCheckIfTrusted (self) |
None | initializeBeforePluginsAreLoaded (self) |
None | initializeAfterPluginsAreLoaded (self) |
None | addPluginLocation (self, str location) |
bool | checkRequiredPlugins (self, List[str] required_plugins) |
None | disablePlugin (self, str plugin_id) |
None | enablePlugin (self, str plugin_id) |
List[str] | getActivePlugins (self) |
List[Dict[str, Any]] | getAllMetaData (self, **Any kwargs) |
List[str] | getDisabledPlugins (self) |
Set[str] | getCurrentSessionActivationChangedPlugins (self) |
List[str] | getInstalledPlugins (self) |
Dict[str, Any] | getMetaData (self, str plugin_id) |
Optional[Dict[str, str]] | installPlugin (self, str plugin_path) |
bool | isActivePlugin (self, str plugin_id) |
bool | isBundledPlugin (self, str plugin_id) |
None | loadPlugins (self, Optional[Dict[str, Any]] metadata=None) |
bool | isPluginApiVersionCompatible (self, "Version" plugin_api_version) |
None | loadPlugin (self, str plugin_id) |
None | removeCorruptedPluginMessage (self, str plugin_id) |
Dict[str, str] | uninstallPlugin (self, str plugin_id) |
PluginObject | getPluginObject (self, str plugin_id) |
None | addSupportedPluginExtension (self, str extension, str description) |
List[str] | supportedPluginExtensions (self) |
Optional[str] | getPluginPath (self, str plugin_id) |
None | addType (cls, str plugin_type, Callable[[Any], None] register_function) |
None | removeType (cls, str plugin_type) |
"PluginRegistry" | getInstance (cls, *args, **kwargs) |
Public Attributes | |
list | preloaded_plugins = [] |
Protected Member Functions | |
None | _savePluginData (self) |
_acceptedRemoveCorruptedPluginMessage (self, str plugin_id, Message original_message) | |
None | _installPlugin (self, str plugin_id, str plugin_path) |
None | _removePlugin (self, str plugin_id) |
List[str] | _findInstalledPlugins (self, Optional[List[str]] paths=None) |
Optional[types.ModuleType] | _findPlugin (self, str plugin_id) |
Optional[str] | _locatePlugin (self, str plugin_id, str folder) |
bool | _populateMetaData (self, str plugin_id) |
None | _addPluginObject (self, PluginObject plugin_object, str plugin_id, str plugin_type) |
Static Protected Member Functions | |
Optional[str] | _getPluginIdFromFile (str filename) |
bool | _handleCentralStorage (str file_data, str plugin_path, bool is_bundled_plugin=False) |
None | _parsePluginInfo (str plugin_id, str file_data, Dict[str, Any] meta_data) |
bool | _subsetInDict (Dict[Any, Any] dictionary, Dict[Any, Any] subset) |
Protected Attributes | |
Application | _application = application |
Version | _api_version = application.getAPIVersion() |
list | _all_plugins = [] |
dict | _metadata = {} |
list | _plugins_installed = [] |
list | _disabled_plugins = [] |
list | _outdated_plugins = [] |
Dict[str, Dict[str, str]] | _plugins_to_install = dict() |
list | _plugins_to_remove = [] |
dict | _plugins = {} |
dict | _found_plugins = {} |
dict | _plugin_objects = {} |
list | _plugin_locations = [] |
dict | _plugin_folder_cache = {} |
dict | _bundled_plugin_cache = {} |
dict | _supported_file_types = {"umplugin": "Uranium Plugin"} |
bool | _check_if_trusted = False |
list | _clean_hierarchy_sent_messages = [] |
bool | _debug_mode = False |
list | _checked_plugin_ids = [] |
list | _distrusted_plugin_ids = [] |
Optional[Trust] | _trust_checker = None |
Set[str] | _changed_activated_plugins_current_session = set() |
str | _plugin_config_filename = "" |
Static Protected Attributes | |
dict | _type_register_map = {} |
A central object to dynamically load modules as plugins. The PluginRegistry class can load modules dynamically and use them as plugins. Each plugin module is expected to be a directory with and `__init__` file defining a `getMetaData` and a `register` function. Terms for plugins used: Enabled (active): A plugin which is installed and currently enabled. Disabled: A plugin which is installed but not currently enabled. Available: A plugin which is not installed but could be. Installed: A plugin which is installed locally in Cura. For more details, see the [plugins] file. [plugins]: docs/plugins.md
|
protected |
Returns a list of all possible plugin ids in the plugin locations :param paths: :return:
|
protected |
Try to find a module implementing a plugin :param plugin_id: The name of the plugin to find :returns: module if it was found (and, if 'self._check_if_trusted' is set, also secure), None otherwise
|
staticprotected |
Plugins can indicate that they want certain things to be stored in a central location. In the case of a signed plugin you *must* do this by means of the central_storage.json file. :param file_data: The data as loaded from the file :param plugin_path: The location of the plugin on the file system :return: False if there is a security suspicion, True otherwise (even if the method otherwise fails).
|
protected |
Installs the given plugin file. It will overwrite the existing plugin if present. :param plugin_id: :param plugin_path:
|
staticprotected |
Load the plugin data from the stream and in-place update the metadata. :param plugin_id: Id of the plugin :param file_data: The data as read from the file :param meta_data: Dict with the metadata of the plugin :return:
|
protected |
Populate the list of metadata
|
protected |
Removes the given plugin. :param plugin_id: :return:
|
staticprotected |
Check if a certain dictionary contains a certain subset of key/value pairs :param dictionary: Target dictionary to search in :param subset: The subset to search for :return:
None UM.PluginRegistry.PluginRegistry.addPluginLocation | ( | self, | |
str | location ) |
Add a plugin location to the list of locations to search :param location: The location (folder) to look for
None UM.PluginRegistry.PluginRegistry.addType | ( | cls, | |
str | plugin_type, | ||
Callable[[Any], None] | register_function ) |
Add a new plugin type. This function is used to add new plugin types. Plugin types are simple string identifiers that match a certain plugin to a registration function. The callable `register_function` is responsible for handling the object. Usually it will add the object to a list of objects in the relevant class. For example, the plugin type 'tool' has Controller::addTool as register function. `register_function` will be called every time a plugin of `type` is loaded. :param plugin_type: The name of the plugin type to add. :param register_function: A callable that takes an object as parameter.
None UM.PluginRegistry.PluginRegistry.disablePlugin | ( | self, | |
str | plugin_id ) |
Remove plugin from the list of enabled plugins and save to preferences :param plugin_id: Id of the plugin to be disabled :return:
None UM.PluginRegistry.PluginRegistry.enablePlugin | ( | self, | |
str | plugin_id ) |
Add plugin to the list of enabled plugins and save to preferences: :param plugin_id: Id of the plugin to be enabled :return:
List[str] UM.PluginRegistry.PluginRegistry.getActivePlugins | ( | self | ) |
Get the list of enabled plugins :return:
List[Dict[str, Any]] UM.PluginRegistry.PluginRegistry.getAllMetaData | ( | self, | |
**Any | kwargs ) |
Get a list of all metadata matching a certain subset of metadata :param kwargs: Possible keywords: - filter: \type{dict} The subset of metadata that should be matched. - active_only: Boolean, True when only active plugin metadata should be returned. :return: List of metadata
Set[str] UM.PluginRegistry.PluginRegistry.getCurrentSessionActivationChangedPlugins | ( | self | ) |
Returns a set a plugins whom have changed their activation status in the current session, toggled between en-/disabled after the last start-up status
List[str] UM.PluginRegistry.PluginRegistry.getDisabledPlugins | ( | self | ) |
Get a list of disabled plugins :return:
List[str] UM.PluginRegistry.PluginRegistry.getInstalledPlugins | ( | self | ) |
Get a list of installed plugins: NOTE: These are plugins which have already been registered. This list is actually populated by the protected _findInstalledPlugins() method. :return:
Dict[str, Any] UM.PluginRegistry.PluginRegistry.getMetaData | ( | self, | |
str | plugin_id ) |
Get the metadata for a certain plugin NOTE: InvalidMetaDataError is raised when no metadata can be found or the metadata misses the right keys. :param plugin_id: :return: Metadata object of the plugin. Empty dict if not found.
PluginObject UM.PluginRegistry.PluginRegistry.getPluginObject | ( | self, | |
str | plugin_id ) |
Get a specific plugin object given an ID. If not loaded, load it. :param plugin_id: The ID of the plugin object to get.
Optional[str] UM.PluginRegistry.PluginRegistry.getPluginPath | ( | self, | |
str | plugin_id ) |
Get the path to a plugin. :param plugin_id: The PluginObject.getPluginId() of the plugin. :return: The absolute path to the plugin or an empty string if the plugin could not be found.
bool UM.PluginRegistry.PluginRegistry.isActivePlugin | ( | self, | |
str | plugin_id ) |
Check by ID if a plugin is active (enabled): :param plugin_id: :return:
bool UM.PluginRegistry.PluginRegistry.isPluginApiVersionCompatible | ( | self, | |
"Version" | plugin_api_version ) |
Checks if the given plugin API version is compatible with the current version. :param plugin_api_version: :return:
None UM.PluginRegistry.PluginRegistry.loadPlugin | ( | self, | |
str | plugin_id ) |
Load a single plugin by ID :param plugin_id:
None UM.PluginRegistry.PluginRegistry.loadPlugins | ( | self, | |
Optional[Dict[str, Any]] | metadata = None ) |
Load all plugins matching a certain set of metadata :param metadata: The meta data that needs to be matched. NOTE: This is the method which kicks everything off at app launch.
None UM.PluginRegistry.PluginRegistry.removeType | ( | cls, | |
str | plugin_type ) |
Remove a plugin type. :param plugin_type: The plugin type to remove.