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

Central class to manage all setting providers. More...

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

Public Member Functions

def __init__
 
def addResourceType
 
def getResourceTypes (self)
 Returns all resource types. More...
 
def getDefaultSaveProvider (self)
 
def addWrongContainerId
 This method adds the current id to the list of wrong containers that are skipped when looking for a container.
 
def addProvider
 Adds a container provider to search through containers in. More...
 
def findDefinitionContainers
 Find all DefinitionContainer objects matching certain criteria. More...
 
def findDefinitionContainersMetadata
 Get the metadata of all definition containers matching certain criteria. More...
 
def findInstanceContainers
 Find all InstanceContainer objects matching certain criteria. More...
 
def findInstanceContainersMetadata
 Find the metadata of all instance containers matching certain criteria. More...
 
def findContainerStacks
 Find all ContainerStack objects matching certain criteria. More...
 
def findContainerStacksMetadata
 Find the metadata of all container stacks matching certain criteria. More...
 
def findContainers
 Find all container objects matching certain criteria. More...
 
def findContainersMetadata
 Find the metadata of all container objects matching certain criteria. More...
 
def findDirtyContainers
 Specialized find function to find only the modified container objects that also match certain criteria. More...
 
def getEmptyInstanceContainer (self)
 This is a small convenience to make it easier to support complex structures in ContainerStacks. More...
 
def setExplicitReadOnly
 
def isExplicitReadOnly
 
def isReadOnly
 Returns whether a profile is read-only or not. More...
 
def getContainerFilePathById
 
def isLoaded
 Returns whether a container is completely loaded or not. More...
 
def loadAllMetadata (self)
 Load the metadata of all available definition containers, instance containers and container stacks. More...
 
def load (self)
 Load all available definition containers, instance containers and container stacks. More...
 
def addContainer
 
def removeContainer
 
def renameContainer
 
def uniqueName
 Creates a new unique name for a container that doesn't exist yet. More...
 
def addContainerType
 Add a container type that will be used to serialize/deserialize containers. More...
 
def addContainerTypeByName
 Used to associate mime types with object to be created. More...
 
def getMimeTypeForContainer
 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 saveContainer
 Save single dirty container.
 
def saveDirtyContainers (self)
 Save all the dirty containers by calling the appropriate container providers.
 
def getLockFilename (self)
 Get the lock filename including full path Dependent on when you call this function, Resources.getConfigStoragePath may return different paths.
 
def getCacheLockFilename (self)
 Get the cache lock filename including full path. More...
 
def lockFile (self)
 Contextmanager to create a lock file and remove it afterwards. More...
 
def lockCache (self)
 Context manager to create a lock file for the cache directory and remove it afterwards. More...
 
def getInstance (cls, args, kwargs)
 
- Public Member Functions inherited from UM.Settings.Interfaces.ContainerRegistryInterface
def findContainers
 
def findDefinitionContainers
 
def getApplication (cls)
 
def getEmptyInstanceContainer (self)
 
def isReadOnly
 
def setExplicitReadOnly
 
def isExplicitReadOnly
 

Public Attributes

 metadata
 
 source_provider
 

Static Public Attributes

tuple containerAdded = Signal()
 
tuple containerRemoved = Signal()
 
tuple containerMetaDataChanged = Signal()
 
tuple containerLoadComplete = Signal()
 
tuple allMetadataLoaded = Signal()
 
dictionary mime_type_map
 

Detailed Description

Central class to manage all setting providers.

This class aggregates all data from all container providers. If only the metadata is used, it requests the metadata lazily from the providers. If more than that is needed, the entire container is requested from the appropriate providers.

Member Function Documentation

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.
def UM.Settings.ContainerRegistry.ContainerRegistry.addContainerTypeByName (   cls,
  container_type 
)

Used to associate mime types with object to be created.

Parameters
container_typeContainerStack or derivative
type_name
mime_type
def UM.Settings.ContainerRegistry.ContainerRegistry.addProvider (   self,
  provider 
)

Adds a container provider to search through containers in.

def UM.Settings.ContainerRegistry.ContainerRegistry.findContainers (   self,
  ignore_case 
)

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.
def UM.Settings.ContainerRegistry.ContainerRegistry.findContainersMetadata (   self,
  ignore_case 
)

Find the metadata of all container objects matching certain criteria.

Parameters
container_typeIf provided, return only objects that are instances or subclasses of container_type.
kwargsA dictionary of keyword arguments containing keys and values that need to match the metadata. An asterisk can be used to denote a wildcard.
Returns
A list of metadata dictionaries matching the search criteria, or an empty list if nothing was found.
def UM.Settings.ContainerRegistry.ContainerRegistry.findContainerStacks (   self,
  kwargs 
)

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.
def UM.Settings.ContainerRegistry.ContainerRegistry.findContainerStacksMetadata (   self,
  kwargs 
)

Find the metadata of all container stacks matching certain criteria.

Parameters
kwargsA dictionary of keyword arguments containing keys and values that need to match the metadata. An asterisk in the values can be used to denote a wildcard.
Returns
A list of metadata dictionaries matching the search criteria, or an empty list if nothing was found.
def UM.Settings.ContainerRegistry.ContainerRegistry.findDefinitionContainers (   self,
  kwargs 
)

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.
def UM.Settings.ContainerRegistry.ContainerRegistry.findDefinitionContainersMetadata (   self,
  kwargs 
)

Get the metadata of all definition containers matching certain criteria.

Parameters
kwargsA dictionary of keyword arguments containing keys and values that need to match the metadata. An asterisk in the values can be used to denote a wildcard.
Returns
A list of metadata dictionaries matching the search criteria, or an empty list if nothing was found.
def UM.Settings.ContainerRegistry.ContainerRegistry.findDirtyContainers (   self,
  ignore_case 
)

Specialized find function to find only the modified container objects that also match certain criteria.

This is faster than the normal find methods since it won't ever load all containers, but only the modified ones. Since containers must be fully loaded before they are modified, you are guaranteed that any operations on the resulting containers will not trigger additional containers to load lazily.

Parameters
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.
ignore_caseWhether casing should be ignored when matching string values of metadata.
Returns
A list of containers matching the search criteria, or an empty list if nothing was found.
def UM.Settings.ContainerRegistry.ContainerRegistry.findInstanceContainers (   self,
  kwargs 
)

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.
def UM.Settings.ContainerRegistry.ContainerRegistry.findInstanceContainersMetadata (   self,
  kwargs 
)

Find the metadata of all instance containers matching certain criteria.

Parameters
kwargsA dictionary of keyword arguments containing keys and values that need to match the metadata. An asterisk in the values can be used to denote a wildcard.
Returns
A list of metadata dictionaries matching the search criteria, or an empty list if nothing was found.
def UM.Settings.ContainerRegistry.ContainerRegistry.getCacheLockFilename (   self,
  str 
)

Get the cache lock filename including full path.

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.
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.
def UM.Settings.ContainerRegistry.ContainerRegistry.getEmptyInstanceContainer (   self,
  InstanceContainer 
)

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

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.
def UM.Settings.ContainerRegistry.ContainerRegistry.getResourceTypes (   self,
  Dict,
  str,
  int 
)

Returns all resource types.

def UM.Settings.ContainerRegistry.ContainerRegistry.isLoaded (   self,
  container_id 
)

Returns whether a container is completely loaded or not.

If only its metadata is known, it is not yet completely loaded.

Returns
True if all data about this container is known, False if only metadata is known or the container is completely unknown.
def UM.Settings.ContainerRegistry.ContainerRegistry.isReadOnly (   self,
  container_id 
)

Returns whether a profile is read-only or not.

Whether it is read-only depends on the source where the container is obtained from.

Returns
True if the container is read-only, or False if it can be modified.
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.
def UM.Settings.ContainerRegistry.ContainerRegistry.loadAllMetadata (   self,
  None 
)

Load the metadata of all available definition containers, instance containers and container stacks.

def UM.Settings.ContainerRegistry.ContainerRegistry.lockCache (   self,
  LockFile 
)

Context manager to create a lock file for the cache directory and remove it afterwards.

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

Contextmanager to create a lock file and remove it afterwards.

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.

Member Data Documentation

dictionary UM.Settings.ContainerRegistry.ContainerRegistry.mime_type_map
static
Initial value:
1 = {
2  "application/x-uranium-definitioncontainer": DefinitionContainer,
3  "application/x-uranium-instancecontainer": InstanceContainer,
4  "application/x-uranium-containerstack": ContainerStack,
5  "application/x-uranium-extruderstack": ContainerStack
6  }

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