Uranium
Application Framework
|
Public Member Functions | |
None | __init__ (self) |
ContainerInterface | __getitem__ (self, str container_id) |
bool | __lt__ (self, object other) |
bool | __eq__ (self, object other) |
None | addMetadata (self, Dict[str, Any] metadata) |
Optional[Dict[str, Any]] | getMetadata (self, str container_id) |
Optional[str] | getContainerFilePathById (self, str container_id) |
float | getLastModifiedTime (self, str container_id) |
Iterable[str] | getAllIds (self) |
bool | isReadOnly (self, str container_id) |
"ContainerInterface" | loadContainer (self, str container_id) |
Dict[str, Any] | loadMetadata (self, str container_id) |
Dict[str, Dict[str, Any]] | metadata (self) |
None | removeContainer (self, str container_id) |
Public Member Functions inherited from UM.PluginObject.PluginObject | |
None | __init__ (self, *args, **kwags) |
str | getId (self) |
None | setPluginId (self, str plugin_id) |
None | setMetaData (self, Dict[str, Any] metadata) |
Dict[str, Any] | getMetaData (self) |
str | getPluginId (self) |
None | setVersion (self, str version) |
str | getVersion (self) |
Protected Attributes | |
dict | _containers = {} |
Protected Attributes inherited from UM.PluginObject.PluginObject | |
_plugin_id = None | |
_version = None | |
dict | _metadata = {} |
_name = None |
This class serves as a database for containers. A plug-in can define a new source for containers by implementing the ``getAllIds``, ``loadMetadata`` and ``loadContainer`` methods.
None UM.Settings.ContainerProvider.ContainerProvider.__init__ | ( | self | ) |
Initialises the provider, which creates a few empty fields.
ContainerInterface UM.Settings.ContainerProvider.ContainerProvider.__getitem__ | ( | self, | |
str | container_id ) |
Gets a container with a specified ID. This should be implemented lazily. An implementation should first check :param container_id: The ID of a container to get. :return: The specified container.
bool UM.Settings.ContainerProvider.ContainerProvider.__lt__ | ( | self, | |
object | other ) |
Compares container providers by their priority so that they are easy to sort. :param other: The other container provider to compare with. :return: A positive number if this provider has lower priority than the other, or a negative number if this provider has higher priority than the other.
None UM.Settings.ContainerProvider.ContainerProvider.addMetadata | ( | self, | |
Dict[str, Any] | metadata ) |
Adds an item to the list of metadata. This is intended to be called from the implementation of ``loadMetadata``.
Iterable[str] UM.Settings.ContainerProvider.ContainerProvider.getAllIds | ( | self | ) |
Gets a list of IDs of all containers this provider provides. :return: A list of all container IDs.
Optional[str] UM.Settings.ContainerProvider.ContainerProvider.getContainerFilePathById | ( | self, | |
str | container_id ) |
Gets the container file path with for the container with the given ID. Returns None if the container/file doesn't exist. :param container_id: :return:
Optional[Dict[str, Any]] UM.Settings.ContainerProvider.ContainerProvider.getMetadata | ( | self, | |
str | container_id ) |
Gets the metadata of a specified container. If the metadata of the container doesn't exist yet, it is loaded from the container source by the implementation of the provider. Note that due to inheritance, this may also trigger the metadata of other containers to load. :param container_id: The container to get the metadata of. :return: A dictionary of metadata for this container, or ``None`` if it failed to load.
bool UM.Settings.ContainerProvider.ContainerProvider.isReadOnly | ( | self, | |
str | container_id ) |
Returns whether a container is considered read-only by this provider. Some providers don't allow modifying their containers at all. Some only allow some containers to be modified. :return: Whether the specified container is read-only.
"ContainerInterface" UM.Settings.ContainerProvider.ContainerProvider.loadContainer | ( | self, | |
str | container_id ) |
Loads the container with the specified ID. This is called lazily, so it should only request to load each container once and only when it's really needed. The container must be fully loaded after this is completed, so it may take some time. :return: The fully loaded container.
Dict[str, Any] UM.Settings.ContainerProvider.ContainerProvider.loadMetadata | ( | self, | |
str | container_id ) |
Loads the metadata of a specified container. This will be called during start-up. It should be efficient. :param container_id: The ID of the container to load the metadata of. :return: A dictionary of metadata dictionaries, indexed by their IDs.
Dict[str, Dict[str, Any]] UM.Settings.ContainerProvider.ContainerProvider.metadata | ( | self | ) |
Gets a dictionary of metadata of all containers, indexed by ID.
None UM.Settings.ContainerProvider.ContainerProvider.removeContainer | ( | self, | |
str | container_id ) |
Delete a container from this provider. This deletes the container from the source. If it's read only, this should give an exception. :param container_id: The ID of the container to remove.