Uranium
Application Framework
UM.Settings.InstanceContainer.InstanceContainer Class Reference

A container for SettingInstance objects. More...

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

Public Member Functions

def __init__ (self, container_id, args, kwargs)
 Constructor. More...
 
def __hash__ (self)
 
def __deepcopy__ (self, memo)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def getId (self)
 
def setCachedValues (self, cached_values)
 
def getPath (self)
 
def setPath (self, path)
 
def getName (self)
 
def setName (self, name)
 
def isReadOnly (self)
 
def setReadOnly (self, read_only)
 
def getMetaData (self)
 
def setMetaData (self, metadata)
 
def getMetaDataEntry (self, entry, default=None)
 
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. More...
 
def setDirty (self, dirty)
 
def getProperty (self, key, property_name)
 
def hasProperty (self, key, property_name)
 
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. More...
 
def getAllKeys (self)
 Get all the keys of the instances of this container. More...
 
def duplicate
 Create a new InstanceContainer with the same contents as this container. More...
 
def serialize (self)
 
def deserialize
 
def findInstances (self, kwargs)
 Find instances matching certain criteria. More...
 
def getInstance
 Get an instance by key.
 
def addInstance
 Add a new instance to this container. More...
 
def removeInstance
 Remove an instance from this container. More...
 
def getDefinition (self)
 Get the DefinitionContainer used for new instance creation. More...
 
def setDefinition
 Set the DefinitionContainer to use for new instance creation. More...
 
def __lt__ (self, other)
 
def sendPostponedEmits (self)
 Send postponed emits These emits are collected from the option postpone_emit. More...
 
- Public Member Functions inherited from UM.PluginObject.PluginObject
def __init__ (self)
 
def getPluginId (self)
 
def setPluginId (self, plugin_id)
 

Static Public Attributes

int Version = 2
 
 nameChanged = Signal()
 
 metaDataChanged = Signal()
 
 propertyChanged = Signal()
 

Properties

 id = property(getId)
 
 name = property(getName)
 
 metaData = property(getMetaData)
 

Detailed Description

A container for SettingInstance objects.

Constructor & Destructor Documentation

◆ __init__()

def UM.Settings.InstanceContainer.InstanceContainer.__init__ (   self,
  container_id,
  args,
  kwargs 
)

Constructor.

Parameters
container_idA unique, machine readable/writable ID for this container.

Member Function Documentation

◆ addInstance()

def UM.Settings.InstanceContainer.InstanceContainer.addInstance (   self,
  instance 
)

Add a new instance to this container.

◆ addMetaDataEntry()

def UM.Settings.InstanceContainer.InstanceContainer.addMetaDataEntry (   self,
  key,
  value 
)

Add a new entry to the metadata of this container.

Parameters
keystr The key of the new entry.
valueThe value of the new entry.
Note
This does nothing if the key already exists.

◆ clear()

def UM.Settings.InstanceContainer.InstanceContainer.clear (   self)

Remove all instances from this container.

◆ deserialize()

def UM.Settings.InstanceContainer.InstanceContainer.deserialize (   self,
  serialized 
)

Reimplemented from ContainerInterface

◆ duplicate()

def UM.Settings.InstanceContainer.InstanceContainer.duplicate (   self,
  new_id 
)

Create a new InstanceContainer with the same contents as this container.

Parameters
new_idstr The new ID of the container
new_namestr 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.

◆ findInstances()

def UM.Settings.InstanceContainer.InstanceContainer.findInstances (   self,
  kwargs,
  List,
  SettingInstance 
)

Find instances matching certain criteria.

Parameters
kwargsdict A dictionary of keyword arguments with key-value pairs that should match properties of the instances.

◆ getAllKeys()

def UM.Settings.InstanceContainer.InstanceContainer.getAllKeys (   self)

Get all the keys of the instances of this container.

Returns
list of keys

◆ getDefinition()

def UM.Settings.InstanceContainer.InstanceContainer.getDefinition (   self,
  DefinitionContainerInterface 
)

Get the DefinitionContainer used for new instance creation.

◆ getId()

def UM.Settings.InstanceContainer.InstanceContainer.getId (   self,
  str 
)

Reimplemented from ContainerInterface

◆ getMetaData()

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

Reimplemented from ContainerInterface

◆ getMetaDataEntry()

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

Reimplemented from ContainerInterface

◆ getName()

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

Reimplemented from ContainerInterface

◆ getPath()

def UM.Settings.InstanceContainer.InstanceContainer.getPath (   self)

Reimplemented from ContainerInterface

◆ getProperty()

def UM.Settings.InstanceContainer.InstanceContainer.getProperty (   self,
  key,
  property_name 
)

Reimplemented from ContainerInterface

◆ hasProperty()

def UM.Settings.InstanceContainer.InstanceContainer.hasProperty (   self,
  key,
  property_name 
)

Reimplemented from ContainerInterface.

◆ isDirty()

def UM.Settings.InstanceContainer.InstanceContainer.isDirty (   self)

Check if this container is dirty, that is, if it changed from deserialization.

◆ isReadOnly()

def UM.Settings.InstanceContainer.InstanceContainer.isReadOnly (   self,
  bool 
)

Reimplemented from ContainerInterface

◆ removeInstance()

def UM.Settings.InstanceContainer.InstanceContainer.removeInstance (   self,
  key 
)

Remove an instance from this container.

/param postpone_emit postpone emit until calling sendPostponedEmits

◆ 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.

◆ serialize()

def UM.Settings.InstanceContainer.InstanceContainer.serialize (   self,
  str 
)

Reimplemented from ContainerInterface

◆ setDefinition()

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.

◆ setMetaDataEntry()

def UM.Settings.InstanceContainer.InstanceContainer.setMetaDataEntry (   self,
  key,
  value 
)

Set a metadata entry to a certain value.

Parameters
keyThe key of the metadata entry to set.
valueThe new value of the metadata.
Note
This does nothing if the key is not already added to the metadata.

◆ setPath()

def UM.Settings.InstanceContainer.InstanceContainer.setPath (   self,
  path 
)

Reimplemented from ContainerInterface

◆ setProperty()

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
keystring The key of the setting to set a property of.
property_namestring The name of the property to set.
property_valueThe new value of the property.
containerThe container to use for retrieving values when changing the property triggers property updates. Defaults to None, which means use the current container.
set_from_cacheFlag 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: