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

Central class to manage all Setting containers. More...

Inheritance diagram for UM.Settings.ContainerRegistry.ContainerRegistry:
UM.Settings.Interfaces.ContainerRegistryInterface

Public Member Functions

def __init__ (self, args, kwargs)
 
def addResourceType
 
def findDefinitionContainers (self, kwargs)
 Find all DefinitionContainer objects matching certain criteria. More...
 
def findInstanceContainers (self, kwargs)
 Find all InstanceContainer objects matching certain criteria. More...
 
def findContainerStacks (self, kwargs)
 Find all ContainerStack objects matching certain criteria. More...
 
def findContainers (self, container_type=None, ignore_case=False, kwargs)
 Find all container objects matching certain criteria. More...
 
def getEmptyInstanceContainer (self)
 This is a small convenience to make it easier to support complex structures in ContainerStacks. More...
 
def load (self)
 Load all available definition containers, instance containers and container stacks. More...
 
def addContainer
 
def removeContainer
 
def renameContainer (self, container_id, new_name, new_id=None)
 
def saveAll (self)
 
def uniqueName
 Creates a new unique name for a container that doesn't exist yet. More...
 
def addContainerType (cls, container)
 Add a container type that will be used to serialize/deserialize containers. More...
 
def addContainerTypeByName (cls, container_type, type_name, mime_type)
 Used to associate mime types with object to be created. More...
 
def getMimeTypeForContainer (cls, container_type)
 Retrieve the mime type corresponding to a certain container type. More...
 
def getContainerForMimeType (cls, mime_type)
 Get the container type corresponding to a certain mime type. More...
 
def getContainerTypes (cls)
 Get all the registered container types. More...
 
def getLockFilename (self)
 Get the lock filename including full path Dependent on when you call this function, Resources.getConfigStoragePath may return different paths.
 
def lockFile (self)
 Contextmanager to create a lock file and remove it afterwards. More...
 
def getInstance (cls)
 Get the singleton instance for this class. More...
 
def setApplication (cls, application)
 
def getApplication (cls)
 
- Public Member Functions inherited from UM.Settings.Interfaces.ContainerRegistryInterface
def findDefinitionContainers
 

Static Public Attributes

 containerAdded = Signal()
 
 containerRemoved = Signal()
 

Detailed Description

Central class to manage all Setting containers.

Member Function Documentation

◆ addContainerType()

def UM.Settings.ContainerRegistry.ContainerRegistry.addContainerType (   cls,
  container 
)

Add a container type that will be used to serialize/deserialize containers.

Parameters
containerAn instance of the container type to add.

◆ addContainerTypeByName()

def UM.Settings.ContainerRegistry.ContainerRegistry.addContainerTypeByName (   cls,
  container_type,
  type_name,
  mime_type 
)

Used to associate mime types with object to be created.

Parameters
container_typeContainerStack or derivative
type_name
mime_type

◆ findContainers()

def UM.Settings.ContainerRegistry.ContainerRegistry.findContainers (   self,
  container_type = None,
  ignore_case = False,
  kwargs,
  List,
  ContainerInterface 
)

Find all container objects matching certain criteria.

Parameters
container_typeIf provided, return only objects that are instances or subclasses of container_type.
kwargsdict A dictionary of keyword arguments containing keys and values that need to match the metadata of the container. An asterisk can be used to denote a wildcard.
Returns
A list of containers matching the search criteria, or an empty list if nothing was found.

◆ findContainerStacks()

def UM.Settings.ContainerRegistry.ContainerRegistry.findContainerStacks (   self,
  kwargs,
  List,
  ContainerStack 
)

Find all ContainerStack objects matching certain criteria.

Parameters
kwargsdict A dictionary of keyword arguments containing keys and values that need to match the metadata of the ContainerStack. An asterisk in the values can be used to denote a wildcard.

◆ findDefinitionContainers()

def UM.Settings.ContainerRegistry.ContainerRegistry.findDefinitionContainers (   self,
  kwargs,
  List,
  DefinitionContainerInterface 
)

Find all DefinitionContainer objects matching certain criteria.

Parameters
kwargsdict A dictionary of keyword arguments containing keys and values that need to match the metadata of the DefinitionContainer. An asterisk in the values can be used to denote a wildcard.

◆ findInstanceContainers()

def UM.Settings.ContainerRegistry.ContainerRegistry.findInstanceContainers (   self,
  kwargs,
  List,
  InstanceContainer 
)

Find all InstanceContainer objects matching certain criteria.

Parameters
kwargsdict A dictionary of keyword arguments containing keys and values that need to match the metadata of the InstanceContainer. An asterisk in the values can be used to denote a wildcard.

◆ getContainerForMimeType()

def UM.Settings.ContainerRegistry.ContainerRegistry.getContainerForMimeType (   cls,
  mime_type 
)

Get the container type corresponding to a certain mime type.

Parameters
mime_typeThe mime type to get the container type for.
Returns
A class object of a container type that corresponds to the specified mime type or None if not found.

◆ getContainerTypes()

def UM.Settings.ContainerRegistry.ContainerRegistry.getContainerTypes (   cls)

Get all the registered container types.

Returns
A dictionary view object that provides access to the container types. The key is the plugin ID, the value the container type.

◆ getEmptyInstanceContainer()

def UM.Settings.ContainerRegistry.ContainerRegistry.getEmptyInstanceContainer (   self,
  InstanceContainer 
)

This is a small convenience to make it easier to support complex structures in ContainerStacks.

◆ getInstance()

def UM.Settings.ContainerRegistry.ContainerRegistry.getInstance (   cls,
  ContainerRegistry 
)

Get the singleton instance for this class.

◆ getMimeTypeForContainer()

def UM.Settings.ContainerRegistry.ContainerRegistry.getMimeTypeForContainer (   cls,
  container_type 
)

Retrieve the mime type corresponding to a certain container type.

Parameters
container_typeThe type of container to get the mime type for.
Returns
A MimeType object that matches the mime type of the container or None if not found.

◆ load()

def UM.Settings.ContainerRegistry.ContainerRegistry.load (   self,
  None 
)

Load all available definition containers, instance containers and container stacks.

Note
This method does not clear the internal list of containers. This means that any containers that were already added when the first call to this method happened will not be re-added.

◆ lockFile()

def UM.Settings.ContainerRegistry.ContainerRegistry.lockFile (   self)

Contextmanager to create a lock file and remove it afterwards.

◆ uniqueName()

def UM.Settings.ContainerRegistry.ContainerRegistry.uniqueName (   self,
  original 
)

Creates a new unique name for a container that doesn't exist yet.

It tries if the original name you provide exists, and if it doesn't it'll add a " #1" or " #2" after the name to make it unique.

Parameters
originalThe original name that may not be unique.
Returns
A unique name that looks a lot like the original but may have a number behind it to make it unique.

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