|
Uranium
Application Framework
|
Public Member Functions | |
| None | __init__ (self, str container_id, QObject parent=None, *Any args, **Any kwargs) |
| int | __hash__ (self) |
| "InstanceContainer" | __deepcopy__ (self, Dict[int, object] memo) |
| bool | __eq__ (self, object other) |
| bool | __ne__ (self, object other) |
| Tuple[str] | __getnewargs__ (self) |
| Dict[str, Any] | __getstate__ (self) |
| None | __setstate__ (self, Dict[str, Any] state) |
| "InstanceContainer" | createMergedInstanceContainer (cls, "InstanceContainer" instance_container1, "InstanceContainer" instance_container2) |
| str | getId (self) |
| None | setCachedValues (self, Dict[str, Any] cached_values) |
| int | getLoadingPriority (cls) |
| str | getPath (self) |
| None | setPath (self, str path) |
| str | getName (self) |
| None | setName (self, str name) |
| bool | getReadOnly (self) |
| int | getNumInstances (self) |
| Dict[str, Any] | getMetaData (self) |
| None | setMetaData (self, Dict[str, Any] metadata) |
| Any | getMetaDataEntry (self, str entry, default=None) |
| None | setMetaDataEntry (self, str key, Any value) |
| bool | isDirty (self) |
| None | setDirty (self, bool dirty) |
| Any | getProperty (self, str key, str property_name, PropertyEvaluationContext context=None) |
| bool | hasProperty (self, str key, str property_name) |
| None | setProperty (self, str key, str property_name, Any property_value, ContainerInterface container=None, bool set_from_cache=False) |
| None | clear (self) |
| Set[str] | getAllKeys (self) |
| "InstanceContainer" | duplicate (self, str new_id, str new_name=None) |
| str | serialize (self, Optional[Set[str]] ignored_metadata_keys=None) |
| Optional[str] | getConfigurationTypeFromSerialized (cls, str serialized) |
| int | getVersionFromSerialized (cls, str serialised) |
| str | deserialize (self, str serialized, Optional[str] file_name=None) |
| List[Dict[str, Any]] | deserializeMetadata (cls, str serialized, str container_id) |
| List[SettingInstance] | findInstances (self, **Any kwargs) |
| Optional[SettingInstance] | getInstance (self, str key) |
| None | addInstance (self, SettingInstance instance) |
| None | removeInstance (self, str key, bool postpone_emit=False) |
| None | update (self) |
| DefinitionContainerInterface | getDefinition (self) |
| None | setDefinition (self, str definition_id) |
| bool | __lt__ (self, object other) |
| str | __str__ (self) |
| str | __repr__ (self) |
| None | sendPostponedEmits (self) |
| Public Member Functions inherited from UM.Settings.Interfaces.ContainerInterface | |
| __init__ (self, *args, **kwargs) | |
| Public Member Functions inherited from UM.PluginObject.PluginObject | |
| None | __init__ (self, *args, **kwags) |
| None | setPluginId (self, str plugin_id) |
| str | getPluginId (self) |
| None | setVersion (self, str version) |
| str | getVersion (self) |
Static Public Attributes | |
| int | Version = 4 |
| version_regex = re.compile(r"\nversion ?= ?(\d+)") | |
| setting_version_regex = re.compile(r"\nsetting_version ?= ?(\d+)") | |
| type_regex = re.compile(r"\ntype ?= ?(\w+)") | |
| 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) | |
| metaData = pyqtProperty("QVariantMap", fget = getMetaData, fset = setMetaData, notify = metaDataChanged) | |
| Static Public Attributes inherited from UM.Settings.Interfaces.ContainerInterface | |
| propertyChanged = None | |
| metaDataChanged = None | |
Protected Member Functions | |
| None | _instantiateMissingSettingInstancesInCache (self) |
| FastConfigParser | _readAndValidateSerialized (cls, str serialized) |
| bool | _trustHook (self, Optional[str] file_name) |
| None | _instantiateCachedValues (self) |
| Protected Member Functions inherited from UM.Settings.Interfaces.ContainerInterface | |
| str | _updateSerialized (cls, str serialized, Optional[str] file_name=None) |
Protected Attributes | |
| dict | _instances = {} |
| bool | _read_only = False |
| bool | _dirty = False |
| str | _path = "" |
| list | _postponed_emits = [] |
| _definition = None | |
| _cached_values = None | |
| Protected Attributes inherited from UM.PluginObject.PluginObject | |
| _plugin_id = None | |
| _version = None | |
| dict | _metadata = {} |
| _name = None | |
A container for SettingInstance objects.
| None UM.Settings.InstanceContainer.InstanceContainer.__init__ | ( | self, | |
| str | container_id, | ||
| QObject | parent = None, | ||
| *Any | args, | ||
| **Any | kwargs ) |
Constructor :param container_id: A unique, machine readable/writable ID for this container.
| Tuple[str] UM.Settings.InstanceContainer.InstanceContainer.__getnewargs__ | ( | self | ) |
For pickle support
| Dict[str, Any] UM.Settings.InstanceContainer.InstanceContainer.__getstate__ | ( | self | ) |
For pickle support
| None UM.Settings.InstanceContainer.InstanceContainer.__setstate__ | ( | self, | |
| Dict[str, Any] | state ) |
For pickle support
| str UM.Settings.InstanceContainer.InstanceContainer.__str__ | ( | self | ) |
Simple string representation for debugging.
|
protected |
Instance containers are lazy loaded. This function ensures that it happened.
|
protected |
Creates SettingInstances that are missing in this InstanceContainer from the cache if any. This function will **ONLY instantiate SettingInstances. The cached values will not be applied.**
|
protected |
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| None UM.Settings.InstanceContainer.InstanceContainer.addInstance | ( | self, | |
| SettingInstance | instance ) |
Add a new instance to this container.
| None UM.Settings.InstanceContainer.InstanceContainer.clear | ( | self | ) |
Remove all instances from this container.
| "InstanceContainer" UM.Settings.InstanceContainer.InstanceContainer.createMergedInstanceContainer | ( | cls, | |
| "InstanceContainer" | instance_container1, | ||
| "InstanceContainer" | instance_container2 ) |
Create a new container with container 2 as base and container 1 written over it.
| str UM.Settings.InstanceContainer.InstanceContainer.deserialize | ( | self, | |
| str | serialized, | ||
| Optional[str] | file_name = None ) |
:copydoc ContainerInterface::deserialize 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. :param serialized: A CFG document, serialised as a string. :param container_id: The ID of the container to get the metadata of, as obtained from the file name. :return: A dictionary of metadata that was in the CFG document in a singleton list. If anything went wrong, this returns an empty list instead.
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| "InstanceContainer" UM.Settings.InstanceContainer.InstanceContainer.duplicate | ( | self, | |
| str | new_id, | ||
| str | new_name = None ) |
Create a new InstanceContainer with the same contents as this container :param new_id: The new ID of the container :param new_name: The new name of the container. Defaults to None to indicate the name should not change. :return: A new InstanceContainer with the same contents as this container.
| List[SettingInstance] UM.Settings.InstanceContainer.InstanceContainer.findInstances | ( | self, | |
| **Any | kwargs ) |
Find instances matching certain criteria. :param kwargs: A dictionary of keyword arguments with key-value pairs that should match properties of the instances.
| Set[str] UM.Settings.InstanceContainer.InstanceContainer.getAllKeys | ( | self | ) |
Get all the keys of the instances of this container :returns: list of keys
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| 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.
| DefinitionContainerInterface UM.Settings.InstanceContainer.InstanceContainer.getDefinition | ( | self | ) |
Get the DefinitionContainer used for new instance creation.
| str UM.Settings.InstanceContainer.InstanceContainer.getId | ( | self | ) |
:copydoc ContainerInterface::getId Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| Optional[SettingInstance] UM.Settings.InstanceContainer.InstanceContainer.getInstance | ( | self, | |
| str | key ) |
Get an instance by key
| int UM.Settings.InstanceContainer.InstanceContainer.getLoadingPriority | ( | cls | ) |
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| Dict[str, Any] UM.Settings.InstanceContainer.InstanceContainer.getMetaData | ( | self | ) |
:copydoc ContainerInterface::getMetaData Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| Any UM.Settings.InstanceContainer.InstanceContainer.getMetaDataEntry | ( | self, | |
| str | entry, | ||
| default = None ) |
:copydoc ContainerInterface::getMetaDataEntry Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| str UM.Settings.InstanceContainer.InstanceContainer.getName | ( | self | ) |
:copydoc ContainerInterface::getName Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| str UM.Settings.InstanceContainer.InstanceContainer.getPath | ( | self | ) |
:copydoc ContainerInterface::getPath. Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| Any UM.Settings.InstanceContainer.InstanceContainer.getProperty | ( | self, | |
| str | key, | ||
| str | property_name, | ||
| PropertyEvaluationContext | context = None ) |
:copydoc ContainerInterface::getProperty Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| int UM.Settings.InstanceContainer.InstanceContainer.getVersionFromSerialized | ( | cls, | |
| str | serialised ) |
Gets the version number from a config file. In all config files that concern this version upgrade, the version number is stored in general/version, so get the data from that key. :param serialised: The contents of a config file. :return: The version number of that config file.
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| bool UM.Settings.InstanceContainer.InstanceContainer.hasProperty | ( | self, | |
| str | key, | ||
| str | property_name ) |
:copydoc ContainerInterface::hasProperty Reimplemented from ContainerInterface.
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| bool UM.Settings.InstanceContainer.InstanceContainer.isDirty | ( | self | ) |
Check if this container is dirty, that is, if it changed from deserialization.
Reimplemented from UM.Settings.Interfaces.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
| None UM.Settings.InstanceContainer.InstanceContainer.sendPostponedEmits | ( | self | ) |
Send the 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[str]] | ignored_metadata_keys = None ) |
:copydoc ContainerInterface::serialize Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| None 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.
| None UM.Settings.InstanceContainer.InstanceContainer.setDirty | ( | self, | |
| bool | dirty ) |
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| None UM.Settings.InstanceContainer.InstanceContainer.setMetaData | ( | self, | |
| Dict[str, Any] | metadata ) |
Reimplemented from UM.PluginObject.PluginObject.
| None UM.Settings.InstanceContainer.InstanceContainer.setMetaDataEntry | ( | self, | |
| str | key, | ||
| Any | value ) |
Set a metadata entry to a certain value. :param key: The key of the metadata entry to set. :param value: The new value of the metadata. :note This does nothing if the key is not already added to the metadata.
| None UM.Settings.InstanceContainer.InstanceContainer.setPath | ( | self, | |
| str | path ) |
:copydoc ContainerInterface::setPath Reimplemented from ContainerInterface
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| None UM.Settings.InstanceContainer.InstanceContainer.setProperty | ( | self, | |
| str | key, | ||
| str | property_name, | ||
| Any | property_value, | ||
| ContainerInterface | container = None, | ||
| bool | 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. :param key: The key of the setting to set a property of. :param property_name: The name of the property to set. :param property_value: The new value of the property. :param container: The container to use for retrieving values when changing the property triggers property updates. Defaults to None, which means use the current container. :param 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. :note If no definition container is set for this container, new instances cannot be created and this method will do nothing.
Reimplemented from UM.Settings.Interfaces.ContainerInterface.
| None UM.Settings.InstanceContainer.InstanceContainer.update | ( | self | ) |
Update all instances from this container.