Uranium
Application Framework
 All Classes Namespaces Files Functions Variables Pages
UM.Settings.ContainerStack.ContainerStack Class Reference

A stack of setting containers to handle setting value retrieval. More...

Inheritance diagram for UM.Settings.ContainerStack.ContainerStack:
UM.PluginObject.PluginObject

Public Member Functions

def __init__
 Constructor. More...
 
def getId
 
def getName
 
def setName
 Set the name of this stack. More...
 
def isReadOnly
 
def setReadOnly
 
def getMetaData
 
def getMetaDataEntry
 
def addMetaDataEntry
 
def setMetaDataEntry
 
def removeMetaDataEntry
 
def isDirty
 
def setDirty
 
def getProperty
 
def getRawProperty
 Retrieve a property of a setting by key and property name. More...
 
def hasProperty
 
def serialize
 
def deserialize
 
def getAllKeys
 Get all keys known to this container stack. More...
 
def getContainers
 Get a list of all containers in this stack. More...
 
def getContainerIndex
 
def getContainer
 Get a container by index. More...
 
def getTop
 Get the container at the top of the stack. More...
 
def getBottom
 Get the container at the bottom of the stack. More...
 
def getPath
 
def setPath
 
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
 Get the next stack. More...
 
def setNextStack
 Set the next stack. More...
 
def sendPostponedEmits
 Send postponed emits These emits are collected from the option postpone_emit. More...
 
def hasErrors
 Check if the container stack has errors.
 
def getErrorKeys
 Get all the keys that are in an error state in this stack.
 
- Public Member Functions inherited from UM.PluginObject.PluginObject
def __init__
 
def getPluginId
 
def setPluginId
 

Static Public Attributes

int Version = 3
 
tuple nameChanged = Signal()
 Emitted whenever the name of this stack changes. More...
 
tuple containersChanged = Signal()
 
tuple metaDataChanged = Signal()
 
tuple propertyChanged = Signal(Signal.Queued)
 
tuple propertiesChanged = Signal(Signal.Queued)
 

Detailed Description

A stack of setting containers to handle setting value retrieval.

Constructor & Destructor Documentation

def UM.Settings.ContainerStack.ContainerStack.__init__ (   self,
  stack_id,
  args,
  kwargs 
)

Constructor.

Parameters
stack_idstring A unique, machine readable/writable ID.

Member Function Documentation

def UM.Settings.ContainerStack.ContainerStack.addContainer (   self,
  container 
)

Add a container to the top of the stack.

Parameters
containerThe container to add to the stack.
def UM.Settings.ContainerStack.ContainerStack.deserialize (   self,
  serialized 
)

Reimplemented from ContainerInterface

TODO: Expand documentation here, include the fact that this should not include all containers

def UM.Settings.ContainerStack.ContainerStack.findContainer (   self,
  criteria = None,
  container_type = None,
  kwargs,
  Optional,
  ContainerInterface 
)

Find a container matching certain criteria.

Parameters
filterdict 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_typeclass An optional type of container to filter on.
Returns
The first container that matches the filter criteria or None if not found.
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.

Returns
A set of all setting keys in this container stack.
def UM.Settings.ContainerStack.ContainerStack.getBottom (   self,
  ContainerInterface 
)

Get the container at the bottom of the stack.

This is a convenience method that will always return the bottom of the stack.

Returns
The container at the bottom of the stack, or None if no containers have been added.
def UM.Settings.ContainerStack.ContainerStack.getContainer (   self,
  index 
)

Get a container by index.

Parameters
indexint The index of the container to get.
Returns
The container at the specified index.
Exceptions
IndexErrorRaised 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.

Returns
list A list of all containers in this stack.
def UM.Settings.ContainerStack.ContainerStack.getId (   self,
  str 
)

Reimplemented from ContainerInterface

def UM.Settings.ContainerStack.ContainerStack.getMetaData (   self)

Reimplemented from ContainerInterface

def UM.Settings.ContainerStack.ContainerStack.getMetaDataEntry (   self,
  entry,
  default = None 
)

Reimplemented from ContainerInterface

def UM.Settings.ContainerStack.ContainerStack.getName (   self,
  str 
)

Reimplemented from ContainerInterface

def UM.Settings.ContainerStack.ContainerStack.getNextStack (   self)

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.

Returns
ContainerStack The next stack or None if not set.
def UM.Settings.ContainerStack.ContainerStack.getPath (   self)

Reimplemented from ContainerInterface

def UM.Settings.ContainerStack.ContainerStack.getProperty (   self,
  key 
)

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,
  property_name,
  use_next = True,
  skip_until_container = None 
)

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.

Parameters
keyThe key to get the property value of.
property_nameThe name of the property to get the value of.
use_nextTrue if the value should be retrieved from the next stack if not found in this stack. False if not.
skip_until_containerA 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.
Returns
The raw property value of the property, or None if not found. Note that the value might be a SettingFunction instance.
def UM.Settings.ContainerStack.ContainerStack.getTop (   self,
  ContainerInterface 
)

Get the container at the top of the stack.

This is a convenience method that will always return the top of the stack.

Returns
The container at the top of the stack, or None if no containers have been added.
def UM.Settings.ContainerStack.ContainerStack.hasProperty (   self,
  key 
)

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,
  container 
)

Insert a container into the stack.

Parameters
indexint The index of to insert the container at. A negative index counts from the bottom
containerThe container to add to the stack.
def UM.Settings.ContainerStack.ContainerStack.isReadOnly (   self)

Reimplemented from ContainerInterface

def UM.Settings.ContainerStack.ContainerStack.removeContainer (   self,
  index = 0 
)

Remove a container from the stack.

Parameters
indexint The index of the container to remove.
Exceptions
IndexErrorRaised when the specified index is out of bounds.
def UM.Settings.ContainerStack.ContainerStack.replaceContainer (   self,
  index,
  container,
  postpone_emit = False 
)

Replace a container in the stack.

Parameters
indexint The index of the container to replace.
containerThe container to replace the existing entry with.
postpone_emitDuring stack manipulation you may want to emit later.
Exceptions
IndexErrorRaised when the specified index is out of bounds.
Exceptionwhen trying to replace container ContainerStack.
def UM.Settings.ContainerStack.ContainerStack.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 stack.

def UM.Settings.ContainerStack.ContainerStack.serialize (   self)

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.

Parameters
namestring The new name of the stack.
def UM.Settings.ContainerStack.ContainerStack.setNextStack (   self,
  stack 
)

Set the next stack.

Parameters
stackContainerStack The next stack to set. Can be None. Raises Exception when trying to set itself as next stack (to prevent infinite loops)
See also
getNextStack
def UM.Settings.ContainerStack.ContainerStack.setPath (   self,
  path 
)

Reimplemented from ContainerInterface

Member Data Documentation

tuple UM.Settings.ContainerStack.ContainerStack.nameChanged = Signal()
static

Emitted whenever the name of this stack changes.


The documentation for this class was generated from the following file: