Class to look up any form of resource used by Uranium or an application using Uranium.
More...
Class to look up any form of resource used by Uranium or an application using Uranium.
◆ addSearchPath()
def UM.Resources.Resources.addSearchPath |
( |
|
cls, |
|
|
|
path |
|
) |
| |
Add a path relative to which resources should be searched for.
- Parameters
-
◆ addStorageType()
def UM.Resources.Resources.addStorageType |
( |
|
cls, |
|
|
|
resource_type |
|
) |
| |
Add a custom storage path for a resource type.
- Parameters
-
type | The type to add a storage path for. |
path | The 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
-
type | int An integer that can be used to identify the type. Should be greater than UserType. |
path | string The path relative to the search paths where resources of this type can be found./ |
◆ factoryReset()
def UM.Resources.Resources.factoryReset |
( |
|
cls, |
|
|
|
None |
|
) |
| |
Performs a factory reset, compressing the current state of configuration into an archive and emptying the resource folders.
When calling this function, be sure to quit the application immediately afterwards, lest the save function write the configuration anew.
◆ getAllPathsForType()
def UM.Resources.Resources.getAllPathsForType |
( |
|
cls, |
|
|
|
resource_type |
|
) |
| |
Return a list of paths for a certain resource type.
- Parameters
-
resource_type | int The type of resource to retrieve. |
- Returns
- list A list of absolute paths where the resource type can be found.
- Exceptions
-
TypeError | Raised 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_type | The 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_type | int The type of resource to retrieve a path for. |
args | Arguments 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
-
FileNotFoundError | Raised when the file could not be found. |
◆ getSearchPaths()
def UM.Resources.Resources.getSearchPaths |
( |
|
cls, |
|
|
|
Generator, |
|
|
|
str, |
|
|
|
None, |
|
|
|
None |
|
) |
| |
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_type | The type of resource to retrieve a path for. |
args | Arguments 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
-
type | The type of resource to store. |
- Returns
- An absolute path where the given resource type can be stored.
- Exceptions
-
UnsupportedStorageTypeError | Raised 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.
◆ 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: