Uranium
Application Framework
|
A container for SettingInstance objects. More...
Public Member Functions | |
def | __init__ (self, str container_id, *args, **kwargs) |
Constructor. More... | |
def | __hash__ (self) |
def | __deepcopy__ (self, memo) |
def | __eq__ (self, other) |
def | __ne__ (self, other) |
def | __getnewargs__ (self) |
For pickle support. | |
def | __getstate__ (self) |
For pickle support. | |
def | __setstate__ (self, state) |
For pickle support. | |
str | getId (self) |
Get the ID of the container. More... | |
def | setCachedValues (self, cached_values) |
int | getLoadingPriority (cls) |
def | getPath (self) |
def | setPath (self, path) |
Set the path used to create this InstanceContainer. More... | |
str | getName (self) |
Get the human-readable name of this container. More... | |
def | setName (self, name) |
bool | getReadOnly (self) |
def | getMetaData (self) |
Get all metadata of this container. More... | |
def | setMetaData (self, metadata) |
def | getMetaDataEntry (self, entry, default=None) |
Get the value of a single metadata entry. More... | |
def | addMetaDataEntry (self, key, value) |
Add a new entry to the metadata of this container. More... | |
def | setMetaDataEntry (self, key, value) |
Set a metadata entry to a certain value. More... | |
def | isDirty (self) |
Check if this container is dirty, that is, if it changed from deserialization. | |
def | setDirty (self, dirty) |
def | getProperty (self, key, property_name, context=None) |
Get the value of a property of the container item. More... | |
def | hasProperty (self, key, property_name) |
Get whether the container item has a specific property. More... | |
def | setProperty (self, key, property_name, property_value, container=None, set_from_cache=False) |
Set the value of a property of a SettingInstance. More... | |
def | clear (self) |
Remove all instances from this container. | |
def | getAllKeys (self) |
Get all the keys of the instances of this container. More... | |
def | duplicate (self, str new_id, str new_name=None) |
Create a new InstanceContainer with the same contents as this container. More... | |
str | serialize (self, Optional[set] ignored_metadata_keys=None) |
Serialize this container to a string. More... | |
Optional[str] | getConfigurationTypeFromSerialized (cls, str serialized) |
Gets the configuration type of the given serialized data. More... | |
Optional[int] | getVersionFromSerialized (cls, str serialized) |
Gets the version of the given serialized data. More... | |
str | deserialize (self, str serialized, Optional[str] file_name=None) |
Deserialize the container from a string representation. More... | |
List[Dict[str, Any]] | deserializeMetadata (cls, str serialized, str container_id) |
Gets the metadata of an instance container from a serialised format. More... | |
List[SettingInstance] | findInstances (self, **kwargs) |
Find instances matching certain criteria. More... | |
Optional[SettingInstance] | getInstance (self, str key) |
Get an instance by key. | |
None | addInstance (self, SettingInstance instance) |
Add a new instance to this container. | |
None | removeInstance (self, str key, bool postpone_emit=False) |
Remove an instance from this container. More... | |
def | update (self) |
Update all instances from this container. | |
DefinitionContainerInterface | getDefinition (self) |
Get the DefinitionContainer used for new instance creation. | |
def | setDefinition (self, str definition_id) |
Set the DefinitionContainer to use for new instance creation. More... | |
def | __lt__ (self, other) |
def | __str__ (self) |
Simple string representation for debugging. | |
def | sendPostponedEmits (self) |
Send postponed emits These emits are collected from the option postpone_emit. More... | |
![]() | |
Any | getMetaDataEntry (self, str entry, Any default=None) |
Get the value of a single metadata entry. More... | |
Any | getProperty (self, str key, str property_name, Optional[PropertyEvaluationContext] context=None) |
Get the value of a property of the container item. More... | |
bool | hasProperty (self, str key, str property_name) |
Get whether the container item has a specific property. More... | |
None | setPath (self, str path) |
Set the path used to create this InstanceContainer. | |
![]() | |
def | __init__ (self) |
def | getPluginId (self) |
def | setPluginId (self, plugin_id) |
Static Public Attributes | |
int | Version = 2 |
id = pyqtProperty(str, fget = getId, constant = True) | |
pyqtNameChanged = pyqtSignal() | |
nameChanged = Signal() | |
name = pyqtProperty(str, fget = getName, fset = setName, notify = pyqtNameChanged) | |
readOnly = pyqtProperty(bool, fget = getReadOnly) | |
metaDataChanged = pyqtSignal(QObject) | |
metaData = pyqtProperty("QVariantMap", fget = getMetaData, fset = setMetaData, notify = metaDataChanged) | |
propertyChanged = Signal() | |
![]() | |
propertyChanged = None | |
metaDataChanged = None | |
A container for SettingInstance objects.
def UM.Settings.InstanceContainer.InstanceContainer.__init__ | ( | self, | |
str | container_id, | ||
* | args, | ||
** | kwargs | ||
) |
Constructor.
container_id | A unique, machine readable/writable ID for this container. |
def UM.Settings.InstanceContainer.InstanceContainer.addMetaDataEntry | ( | self, | |
key, | |||
value | |||
) |
Add a new entry to the metadata of this container.
key | str The key of the new entry. |
value | The value of the new entry. |
str UM.Settings.InstanceContainer.InstanceContainer.deserialize | ( | self, | |
str | serialized, | ||
Optional[str] | file_name = None |
||
) |
Deserialize the container from a string representation.
This should replace the contents of this container with those in the serialized representation.
serialized | A serialized string containing a container that should be deserialized. |
Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
List[Dict[str, Any]] UM.Settings.InstanceContainer.InstanceContainer.deserializeMetadata | ( | cls, | |
str | serialized, | ||
str | container_id | ||
) |
Gets the metadata of an instance container from a serialised format.
This parses the entire CFG document and only extracts the metadata from it.
serialized | A CFG document, serialised as a string. |
container_id | The ID of the container to get the metadata of, as obtained from the file name. |
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.duplicate | ( | self, | |
str | new_id, | ||
str | new_name = None |
||
) |
Create a new InstanceContainer with the same contents as this container.
new_id | str The new ID of the container |
new_name | str The new name of the container. Defaults to None to indicate the name should not change. |
List[SettingInstance] UM.Settings.InstanceContainer.InstanceContainer.findInstances | ( | self, | |
** | kwargs | ||
) |
Find instances matching certain criteria.
kwargs | dict A dictionary of keyword arguments with key-value pairs that should match properties of the instances. |
def UM.Settings.InstanceContainer.InstanceContainer.getAllKeys | ( | self | ) |
Get all the keys of the instances of this container.
Optional[str] UM.Settings.InstanceContainer.InstanceContainer.getConfigurationTypeFromSerialized | ( | cls, | |
str | serialized | ||
) |
Gets the configuration type of the given serialized data.
(used by __updateSerialized())
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
str UM.Settings.InstanceContainer.InstanceContainer.getId | ( | self | ) |
Get the ID of the container.
The ID should be unique, machine readable and machine writable. It is intended to be used for example when referencing the container in configuration files or when writing a file to disk.
Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.getMetaData | ( | self | ) |
Get all metadata of this container.
This returns a dictionary containing all the metadata for this container. How this metadata is used depends on the application.
Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.getMetaDataEntry | ( | self, | |
entry, | |||
default = None |
|||
) |
Get the value of a single metadata entry.
entry | string The key of the metadata to retrieve. |
default | The default value to return if the entry cannot be found. |
name
, or default
when the entry could not be found.Reimplemented from ContainerInterface
str UM.Settings.InstanceContainer.InstanceContainer.getName | ( | self | ) |
Get the human-readable name of this container.
This should return a human-readable name for the container, that can be used in the interface.
Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.getPath | ( | self | ) |
Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.getProperty | ( | self, | |
key, | |||
property_name, | |||
context = None |
|||
) |
Get the value of a property of the container item.
key | string The key of the item to retrieve a property from. |
name | string The name of the property to retrieve. |
Reimplemented from ContainerInterface
Optional[int] UM.Settings.InstanceContainer.InstanceContainer.getVersionFromSerialized | ( | cls, | |
str | serialized | ||
) |
Gets the version of the given serialized data.
(used by __updateSerialized())
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.hasProperty | ( | self, | |
key, | |||
property_name | |||
) |
Get whether the container item has a specific property.
key | The key of the item to check the property from. |
name | The name of the property to check for. |
Reimplemented from ContainerInterface.
None UM.Settings.InstanceContainer.InstanceContainer.removeInstance | ( | self, | |
str | key, | ||
bool | postpone_emit = False |
||
) |
Remove an instance from this container.
/param postpone_emit postpone emit until calling sendPostponedEmits
def UM.Settings.InstanceContainer.InstanceContainer.sendPostponedEmits | ( | self | ) |
Send postponed emits These emits are collected from the option postpone_emit.
Note: the option can be implemented for all functions modifying the container.
str UM.Settings.InstanceContainer.InstanceContainer.serialize | ( | self, | |
Optional[set] | ignored_metadata_keys = None |
||
) |
Serialize this container to a string.
The serialized representation of the container can be used to write the container to disk or send it over the network.
ignored_metadata_keys | A set of keys that should be ignored when it serializes the metadata. |
Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.setDefinition | ( | self, | |
str | definition_id | ||
) |
Set the DefinitionContainer to use for new instance creation.
Since SettingInstance needs a SettingDefinition to work properly, we need some way of figuring out what SettingDefinition to use when creating a new SettingInstance.
def UM.Settings.InstanceContainer.InstanceContainer.setMetaDataEntry | ( | self, | |
key, | |||
value | |||
) |
Set a metadata entry to a certain value.
key | The key of the metadata entry to set. |
value | The new value of the metadata. |
def UM.Settings.InstanceContainer.InstanceContainer.setPath | ( | self, | |
path | |||
) |
Set the path used to create this InstanceContainer.
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.setProperty | ( | self, | |
key, | |||
property_name, | |||
property_value, | |||
container = None , |
|||
set_from_cache = False |
|||
) |
Set the value of a property of a SettingInstance.
This will set the value of the specified property on the SettingInstance corresponding to key. If no instance has been created for the specified key, a new one will be created and inserted into this instance.
key | string The key of the setting to set a property of. |
property_name | string The name of the property to set. |
property_value | The new value of the property. |
container | The container to use for retrieving values when changing the property triggers property updates. Defaults to None, which means use the current container. |
set_from_cache | Flag to indicate that the property was set from cache. This triggers the behavior that the read_only and setDirty are ignored. |