A container for SettingInstance objects.
More...
|
int | Version = 2 |
|
tuple | nameChanged = Signal() |
|
tuple | metaDataChanged = Signal() |
|
tuple | propertyChanged = Signal() |
|
A container for SettingInstance objects.
def UM.Settings.InstanceContainer.InstanceContainer.__init__ |
( |
|
self, |
|
|
|
container_id, |
|
|
|
args, |
|
|
|
kwargs |
|
) |
| |
Constructor.
- Parameters
-
container_id | A unique, machine readable/writable ID for this container. |
def UM.Settings.InstanceContainer.InstanceContainer.addInstance |
( |
|
self, |
|
|
|
instance |
|
) |
| |
Add a new instance to this container.
def UM.Settings.InstanceContainer.InstanceContainer.addMetaDataEntry |
( |
|
self, |
|
|
|
key, |
|
|
|
value |
|
) |
| |
Add a new entry to the metadata of this container.
- Parameters
-
key | str The key of the new entry. |
value | The value of the new entry. |
- Note
- This does nothing if the key already exists.
def UM.Settings.InstanceContainer.InstanceContainer.clear |
( |
|
self | ) |
|
Remove all instances from this container.
def UM.Settings.InstanceContainer.InstanceContainer.deserialize |
( |
|
self, |
|
|
|
serialized |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.duplicate |
( |
|
self, |
|
|
|
new_id |
|
) |
| |
Create a new InstanceContainer with the same contents as this container.
- Parameters
-
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. |
- Returns
- A new InstanceContainer with the same contents as this container.
def UM.Settings.InstanceContainer.InstanceContainer.findInstances |
( |
|
self, |
|
|
|
kwargs, |
|
|
|
List, |
|
|
|
SettingInstance |
|
) |
| |
Find instances matching certain criteria.
- Parameters
-
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.
- Returns
- list of keys
def UM.Settings.InstanceContainer.InstanceContainer.getDefinition |
( |
|
self, |
|
|
|
DefinitionContainerInterface |
|
) |
| |
Get the DefinitionContainer used for new instance creation.
def UM.Settings.InstanceContainer.InstanceContainer.getId |
( |
|
self, |
|
|
|
str |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.getMetaData |
( |
|
self | ) |
|
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.getMetaDataEntry |
( |
|
self, |
|
|
|
entry, |
|
|
|
default = None |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.getName |
( |
|
self, |
|
|
|
str |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.getPath |
( |
|
self | ) |
|
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.getProperty |
( |
|
self, |
|
|
|
key, |
|
|
|
property_name |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.hasProperty |
( |
|
self, |
|
|
|
key, |
|
|
|
property_name |
|
) |
| |
Reimplemented from ContainerInterface.
def UM.Settings.InstanceContainer.InstanceContainer.isDirty |
( |
|
self | ) |
|
Check if this container is dirty, that is, if it changed from deserialization.
def UM.Settings.InstanceContainer.InstanceContainer.isReadOnly |
( |
|
self, |
|
|
|
bool |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.removeInstance |
( |
|
self, |
|
|
|
key |
|
) |
| |
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.
def UM.Settings.InstanceContainer.InstanceContainer.serialize |
( |
|
self, |
|
|
|
str |
|
) |
| |
Reimplemented from ContainerInterface
def UM.Settings.InstanceContainer.InstanceContainer.setDefinition |
( |
|
self, |
|
|
|
definition |
|
) |
| |
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.
- Parameters
-
key | The key of the metadata entry to set. |
value | The new value of the metadata. |
- Note
- This does nothing if the key is not already added to the metadata.
def UM.Settings.InstanceContainer.InstanceContainer.setPath |
( |
|
self, |
|
|
|
path |
|
) |
| |
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.
- Parameters
-
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. |
- Note
- If no definition container is set for this container, new instances cannot be created and this method will do nothing.
The documentation for this class was generated from the following file:
- UM/Settings/InstanceContainer.py