Uranium
Application Framework
|
This class serves as a database for containers. More...
Public Member Functions | |
None | __init__ (self) |
Initialises the provider, which creates a few empty fields. More... | |
ContainerInterface | __getitem__ (self, str container_id) |
Gets a container with a specified ID. More... | |
bool | __lt__ (self, object other) |
Compares container providers by their priority so that they are easy to sort. More... | |
bool | __eq__ (self, object other) |
None | addMetadata (self, Dict[str, Any] metadata) |
Adds an item to the list of metadata. More... | |
Optional[Dict[str, Any]] | getMetadata (self, str container_id) |
Gets the metadata of a specified container. More... | |
Optional[str] | getContainerFilePathById (self, str container_id) |
Iterable[str] | getAllIds (self) |
Gets a list of IDs of all containers this provider provides. More... | |
bool | isReadOnly (self, str container_id) |
Returns whether a container is considered read-only by this provider. More... | |
"ContainerInterface" | loadContainer (self, str container_id) |
Loads the container with the specified ID. More... | |
Dict[str, Any] | loadMetadata (self, str container_id) |
Loads the metadata of a specified container. More... | |
Dict[str, Dict[str, Any]] | metadata (self) |
Gets a dictionary of metadata of all containers, indexed by ID. More... | |
None | removeContainer (self, str container_id) |
Delete a container from this provider. More... | |
![]() | |
str | getPluginId (self) |
None | setPluginId (self, str plugin_id) |
None | setVersion (self, str version) |
str | getVersion (self) |
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.
Reimplemented from UM.PluginObject.PluginObject.
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
container_id | The ID of a container to get. |
bool UM.Settings.ContainerProvider.ContainerProvider.__lt__ | ( | self, | |
object | other | ||
) |
Compares container providers by their priority so that they are easy to sort.
other | The other container provider to compare with. |
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.
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.
container_id | The container to get the metadata of. |
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.
"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.
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.
container_id | The ID of the container to load the metadata of. |
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.
container_id | The ID of the container to remove. |