Uranium
Application Framework
UM.Resources.Resources Class Reference

Class to look up any form of resource used by Uranium or an application using Uranium. More...

Public Member Functions

def getPath
 Get the path to a certain resource file. More...
 
def getAllResourcesOfType
 Get a list of paths to all resources of a certain resource type. More...
 
def getStoragePath
 Get the path that can be used to write a certain resource file. More...
 
def getAllPathsForType
 Return a list of paths for a certain resource type. More...
 
def getStoragePathForType
 Return a path where a certain resource type can be stored. More...
 
def addSearchPath
 Add a path relative to which resources should be searched for. More...
 
def removeSearchPath
 Remove a resource search path. More...
 
def addType
 Add a custom resource type that can be located. More...
 
def addStorageType
 Add a custom storage path for a resource type. More...
 
def getConfigStoragePath (cls)
 Gets the configuration storage path. More...
 
def getDataStoragePath (cls)
 Gets the data storage path. More...
 
def getCacheStoragePath (cls)
 Gets the cache storage path. More...
 
def getSearchPaths (cls)
 Gets the search paths for resources. More...
 
def removeType
 Remove a custom resource type. More...
 
def addExpectedDirNameInData (cls, dir_name)
 

Public Attributes

 ApplicationVersion
 

Static Public Attributes

int Resources = 1
 The main resources location. More...
 
int Preferences = 2
 Location of preference configuration files. More...
 
int Meshes = 3
 Location of meshes. More...
 
int Shaders = 4
 Location of shaders. More...
 
int i18n = 5
 Location of translation files. More...
 
int Images = 6
 Location of images not in the theme. More...
 
int Themes = 7
 Location of themes. More...
 
int DefinitionContainers = 8
 Location of definition container files. More...
 
int InstanceContainers = 9
 Location of instance container files. More...
 
int ContainerStacks = 10
 Location of container stack files. More...
 
int Cache = 11
 Location of cached data.
 
int PresetSettingVisibilityGroups = 12
 Location of preset setting visibility groups.
 
int UserType = 128
 Any custom resource types should be greater than this to prevent collisions with standard types. More...
 
string ApplicationIdentifier = "UM"
 
string ApplicationVersion = "unknown"
 

Detailed Description

Class to look up any form of resource used by Uranium or an application using Uranium.

Member Function Documentation

◆ addSearchPath()

def UM.Resources.Resources.addSearchPath (   cls,
  path 
)

Add a path relative to which resources should be searched for.

Parameters
pathThe path to add.

◆ addStorageType()

def UM.Resources.Resources.addStorageType (   cls,
  resource_type 
)

Add a custom storage path for a resource type.

Parameters
typeThe type to add a storage path for.
pathThe path to add as storage path. Should be relative to the resources storage path.

◆ addType()

def UM.Resources.Resources.addType (   cls,
  resource_type 
)

Add a custom resource type that can be located.

Parameters
typeint An integer that can be used to identify the type. Should be greater than UserType.
pathstring The path relative to the search paths where resources of this type can be found./

◆ getAllPathsForType()

def UM.Resources.Resources.getAllPathsForType (   cls,
  resource_type 
)

Return a list of paths for a certain resource type.

Parameters
resource_typeint The type of resource to retrieve.
Returns
list A list of absolute paths where the resource type can be found.
Exceptions
TypeErrorRaised when type is an unknown value.

◆ getAllResourcesOfType()

def UM.Resources.Resources.getAllResourcesOfType (   cls,
  resource_type 
)

Get a list of paths to all resources of a certain resource type.

Parameters
resource_typeThe resource type to get the paths for.
Returns
A list of absolute paths to resources of the specified type.

◆ getCacheStoragePath()

def UM.Resources.Resources.getCacheStoragePath (   cls,
  str 
)

Gets the cache storage path.

This is where the application stores cache files.

◆ getConfigStoragePath()

def UM.Resources.Resources.getConfigStoragePath (   cls,
  str 
)

Gets the configuration storage path.

This is where the application stores user configuration, such as preferences.

◆ getDataStoragePath()

def UM.Resources.Resources.getDataStoragePath (   cls,
  str 
)

Gets the data storage path.

This is where the application stores user files, such as profiles.

◆ getPath()

def UM.Resources.Resources.getPath (   cls,
  resource_type 
)

Get the path to a certain resource file.

Parameters
resource_typeint The type of resource to retrieve a path for.
argsArguments that are appended to the location to locate the correct file.
Returns
An absolute path to a file. If a file exists in any storage path, it is returned without searching other paths. If multiple files are found the first found is returned.
Exceptions
FileNotFoundErrorRaised when the file could not be found.

◆ getSearchPaths()

def UM.Resources.Resources.getSearchPaths (   cls)

Gets the search paths for resources.

Returns
A sequence of paths where resources might be.

◆ getStoragePath()

def UM.Resources.Resources.getStoragePath (   cls,
  resource_type 
)

Get the path that can be used to write a certain resource file.

Parameters
resource_typeThe type of resource to retrieve a path for.
argsArguments that are appended to the location for the correct path.
Returns
A path that can be used to write the file.
Note
This method does not check whether a given file exists.

◆ getStoragePathForType()

def UM.Resources.Resources.getStoragePathForType (   cls,
  resource_type 
)

Return a path where a certain resource type can be stored.

Parameters
typeint The type of resource to store.
Returns
string An absolute path where the given resource type can be stored.
Exceptions
UnsupportedStorageTypeErrorRaised when writing type is not supported.

◆ removeSearchPath()

def UM.Resources.Resources.removeSearchPath (   cls,
  path 
)

Remove a resource search path.

◆ removeType()

def UM.Resources.Resources.removeType (   cls,
  resource_type 
)

Remove a custom resource type.

Member Data Documentation

◆ ContainerStacks

int UM.Resources.Resources.ContainerStacks = 10
static

Location of container stack files.

Equal to $resources/stacks

◆ DefinitionContainers

int UM.Resources.Resources.DefinitionContainers = 8
static

Location of definition container files.

Equal to $resources/definitions

◆ i18n

int UM.Resources.Resources.i18n = 5
static

Location of translation files.

Equal to $resources/i18n.

◆ Images

int UM.Resources.Resources.Images = 6
static

Location of images not in the theme.

Equal to $resources/images.

◆ InstanceContainers

int UM.Resources.Resources.InstanceContainers = 9
static

Location of instance container files.

Equal to $resources/instances

◆ Meshes

int UM.Resources.Resources.Meshes = 3
static

Location of meshes.

Equal to $resources/meshes.

◆ Preferences

int UM.Resources.Resources.Preferences = 2
static

Location of preference configuration files.

Actual location depends on platform.

◆ Resources

int UM.Resources.Resources.Resources = 1
static

The main resources location.

Equal to $resource_search_path/resources.

◆ Shaders

int UM.Resources.Resources.Shaders = 4
static

Location of shaders.

Equal to $resources/shaders.

◆ Themes

int UM.Resources.Resources.Themes = 7
static

Location of themes.

Equal to $resources/themes.

◆ UserType

int UM.Resources.Resources.UserType = 128
static

Any custom resource types should be greater than this to prevent collisions with standard types.


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