Uranium
Application Framework
|
A stack of setting containers to handle setting value retrieval. More...
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | __getnewargs__ (self) |
For pickle support. | |
def | __getstate__ (self) |
For pickle support. | |
def | __setstate__ |
For pickle support. | |
def | getId (self) |
Get the ID of the container. More... | |
def | getName (self) |
Get the human-readable name of this container. More... | |
def | setName |
Set the name of this stack. More... | |
def | isReadOnly (self) |
def | setReadOnly |
def | getMetaData (self) |
Get all metadata of this container. More... | |
def | setMetaData |
Set the complete set of metadata. | |
def | getMetaDataEntry |
Get the value of a single metadata entry. More... | |
def | setMetaDataEntry |
def | removeMetaDataEntry |
def | isDirty (self) |
def | setDirty |
def | getProperty |
Get the value of a property of the container item. More... | |
def | getRawProperty |
Retrieve a property of a setting by key and property name. More... | |
def | hasProperty |
Get whether the container item has a specific property. More... | |
def | serialize |
Serialize this container to a string. More... | |
def | getConfigurationTypeFromSerialized |
def | getVersionFromSerialized |
def | deserialize |
Deserialize the container from a string representation. More... | |
def | deserializeMetadata |
Gets the metadata of a container stack from a serialised format. More... | |
def | getAllKeys (self) |
Get all keys known to this container stack. More... | |
def | getContainers (self) |
Get a list of all containers in this stack. More... | |
def | getContainerIndex |
def | getContainer |
Get a container by index. More... | |
def | getTop (self) |
Get the container at the top of the stack. More... | |
def | getBottom (self) |
Get the container at the bottom of the stack. More... | |
def | getPath (self) |
def | setPath |
Set the path used to create this InstanceContainer. More... | |
def | getSettingDefinition |
Get the SettingDefinition object for a specified key. | |
def | findContainer |
Find a container matching certain criteria. More... | |
def | addContainer |
Add a container to the top of the stack. More... | |
def | insertContainer |
Insert a container into the stack. More... | |
def | replaceContainer |
Replace a container in the stack. More... | |
def | removeContainer |
Remove a container from the stack. More... | |
def | getNextStack (self) |
Get the next stack. More... | |
def | setNextStack |
Set the next stack. More... | |
def | sendPostponedEmits (self) |
Send postponed emits These emits are collected from the option postpone_emit. More... | |
def | hasErrors (self) |
Check if the container stack has errors. | |
def | getErrorKeys (self) |
Get all the keys that are in an error state in this stack. | |
def | __str__ (self) |
![]() | |
def | __init__ (self, args, kwargs) |
def | getId (self) |
Get the ID of the container. More... | |
def | getName (self) |
Get the human-readable name of this container. More... | |
def | getMetaData (self) |
Get all metadata of this container. More... | |
def | getMetaDataEntry |
Get the value of a single metadata entry. More... | |
def | getProperty |
Get the value of a property of the container item. More... | |
def | hasProperty |
Get whether the container item has a specific property. More... | |
def | getAllKeys (self) |
Get all the setting keys known to this container. More... | |
def | serialize |
Serialize this container to a string. More... | |
def | setProperty |
Change a property of a container item. More... | |
def | deserialize |
Deserialize the container from a string representation. More... | |
def | deserializeMetadata |
Deserialize just the metadata from a string representation. More... | |
def | getLoadingPriority (cls) |
def | getConfigurationTypeFromSerialized |
Gets the configuration type of the given serialized data. More... | |
def | getVersionFromSerialized |
Gets the version of the given serialized data. More... | |
def | getPath (self) |
Get the path used to create this InstanceContainer. More... | |
def | setPath |
Set the path used to create this InstanceContainer. | |
![]() | |
def | __init__ (self) |
def | getPluginId (self) |
def | setPluginId (self, plugin_id) |
def | setVersion |
def | getVersion (self) |
Static Public Attributes | |
int | Version = 4 |
id = pyqtProperty(str, fget = getId, constant = True) | |
nameChanged = pyqtSignal() | |
Emitted whenever the name of this stack changes. More... | |
name = pyqtProperty(str, fget = getName, fset = setName, notify = nameChanged) | |
readOnlyChanged = pyqtSignal() | |
readOnly = pyqtProperty(bool, fget = isReadOnly, fset = setReadOnly, notify = readOnlyChanged) | |
metaDataChanged = pyqtSignal(QObject) | |
metaData = pyqtProperty("QVariantMap", fget = getMetaData, fset = setMetaData, notify = metaDataChanged) | |
containersChanged = Signal() | |
propertyChanged = Signal(Signal.Queued) | |
propertiesChanged = Signal(Signal.Queued) | |
![]() | |
propertyChanged = None | |
metaDataChanged = None | |
A stack of setting containers to handle setting value retrieval.
def UM.Settings.ContainerStack.ContainerStack.__init__ | ( | self, | |
stack_id | |||
) |
Constructor.
stack_id | A unique, machine readable/writable ID. |
def UM.Settings.ContainerStack.ContainerStack.addContainer | ( | self, | |
container | |||
) |
Add a container to the top of the stack.
container | The container to add to the stack. |
def UM.Settings.ContainerStack.ContainerStack.deserialize | ( | self, | |
serialized | |||
) |
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
TODO: Expand documentation here, include the fact that this should not include all containers
def UM.Settings.ContainerStack.ContainerStack.deserializeMetadata | ( | cls, | |
serialized | |||
) |
Gets the metadata of a container stack 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 that we're getting the metadata of, as obtained from the file name. |
def UM.Settings.ContainerStack.ContainerStack.findContainer | ( | self, | |
criteria | |||
) |
Find a container matching certain criteria.
criteria | A dictionary containing key and value pairs that need to match the container. Note that the value of "*" can be used as a wild card. This will ensure that any container that has the specified key in the meta data is found. |
container_type | An optional type of container to filter on. |
def UM.Settings.ContainerStack.ContainerStack.getAllKeys | ( | self, | |
Set, | |||
str | |||
) |
Get all keys known to this container stack.
In combination with getProperty(), you can obtain the current property values of all settings.
def UM.Settings.ContainerStack.ContainerStack.getBottom | ( | self, | |
Optional, | |||
ContainerInterface | |||
) |
Get the container at the bottom of the stack.
This is a convenience method that will always return the bottom of the stack.
def UM.Settings.ContainerStack.ContainerStack.getContainer | ( | self, | |
index | |||
) |
Get a container by index.
index | int The index of the container to get. |
IndexError | Raised when the specified index is out of bounds. |
def UM.Settings.ContainerStack.ContainerStack.getContainers | ( | self, | |
List, | |||
ContainerInterface | |||
) |
Get a list of all containers in this stack.
Note that it returns a shallow copy of the container list, as it's only allowed to change the order or entries in this list by the proper functions.
def UM.Settings.ContainerStack.ContainerStack.getId | ( | self, | |
str | |||
) |
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
def UM.Settings.ContainerStack.ContainerStack.getMetaData | ( | self, | |
Dict, | |||
str, | |||
Any | |||
) |
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
def UM.Settings.ContainerStack.ContainerStack.getMetaDataEntry | ( | self, | |
entry | |||
) |
Get the value of a single metadata entry.
entry | 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
def UM.Settings.ContainerStack.ContainerStack.getName | ( | self, | |
str | |||
) |
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
def UM.Settings.ContainerStack.ContainerStack.getNextStack | ( | self, | |
Optional, | |||
ContainerStack | |||
) |
Get the next stack.
The next stack is the stack that is searched for a setting value if the bottom of the stack is reached when searching for a value.
def UM.Settings.ContainerStack.ContainerStack.getPath | ( | self, | |
str | |||
) |
Reimplemented from ContainerInterface
def UM.Settings.ContainerStack.ContainerStack.getProperty | ( | self, | |
key | |||
) |
Get the value of a property of the container item.
key | The key of the item to retrieve a property from. |
property_name | The name of the property to retrieve. |
Reimplemented from ContainerInterface.
getProperty will start at the top of the stack and try to get the property specified. If that container returns no value, the next container on the stack will be tried and so on until the bottom of the stack is reached. If a next stack is defined for this stack it will then try to get the value from that stack. If no next stack is defined, None will be returned.
Note that if the property value is a function, this method will return the result of evaluating that property with the current stack. If you need the actual function, use getRawProperty()
def UM.Settings.ContainerStack.ContainerStack.getRawProperty | ( | self, | |
key | |||
) |
Retrieve a property of a setting by key and property name.
This method does the same as getProperty() except it does not perform any special handling of the result, instead the raw stored value is returned.
key | The key to get the property value of. |
property_name | The name of the property to get the value of. |
use_next | True if the value should be retrieved from the next stack if not found in this stack. False if not. |
skip_until_container | A container ID to skip to. If set, it will be as if all containers above the specified container are empty. If the container is not in the stack, it'll try to find it in the next stack. |
def UM.Settings.ContainerStack.ContainerStack.getTop | ( | self, | |
Optional, | |||
ContainerInterface | |||
) |
Get the container at the top of the stack.
This is a convenience method that will always return the top of the stack.
def UM.Settings.ContainerStack.ContainerStack.hasProperty | ( | self, | |
key | |||
) |
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.
hasProperty will check if any of the containers in the stack has the specified property. If it does, it stops and returns True. If it gets to the end of the stack, it returns False.
def UM.Settings.ContainerStack.ContainerStack.insertContainer | ( | self, | |
index | |||
) |
Insert a container into the stack.
index | The index of to insert the container at. A negative index counts from the bottom |
container | The container to add to the stack. |
def UM.Settings.ContainerStack.ContainerStack.isReadOnly | ( | self, | |
bool | |||
) |
Reimplemented from ContainerInterface
def UM.Settings.ContainerStack.ContainerStack.removeContainer | ( | self, | |
index | |||
) |
Remove a container from the stack.
index | int The index of the container to remove. |
IndexError | Raised when the specified index is out of bounds. |
def UM.Settings.ContainerStack.ContainerStack.replaceContainer | ( | self, | |
index | |||
) |
Replace a container in the stack.
index | int The index of the container to replace. |
container | The container to replace the existing entry with. |
postpone_emit | During stack manipulation you may want to emit later. |
IndexError | Raised when the specified index is out of bounds. |
Exception | when trying to replace container ContainerStack. |
def UM.Settings.ContainerStack.ContainerStack.sendPostponedEmits | ( | self, | |
None | |||
) |
Send postponed emits These emits are collected from the option postpone_emit.
Note: the option can be implemented for all functions modifying the stack.
def UM.Settings.ContainerStack.ContainerStack.serialize | ( | self, | |
ignored_metadata_keys | |||
) |
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
TODO: Expand documentation here, include the fact that this should not include all containers
def UM.Settings.ContainerStack.ContainerStack.setName | ( | self, | |
name | |||
) |
Set the name of this stack.
name | string The new name of the stack. |
def UM.Settings.ContainerStack.ContainerStack.setNextStack | ( | self, | |
stack | |||
) |
Set the next stack.
stack | ContainerStack The next stack to set. Can be None. Raises Exception when trying to set itself as next stack (to prevent infinite loops) |
def UM.Settings.ContainerStack.ContainerStack.setPath | ( | self, | |
path | |||
) |
Set the path used to create this InstanceContainer.
Reimplemented from ContainerInterface
|
static |
Emitted whenever the name of this stack changes.