Uranium
Application Framework
|
Class to look up any form of resource used by Uranium or an application using Uranium. More...
Public Member Functions | |
str | getPath (cls, int resource_type, *args) |
Get the path to a certain resource file. More... | |
List[str] | getAllResourcesOfType (cls, int resource_type) |
Get a list of paths to all resources of a certain resource type. More... | |
str | getStoragePath (cls, int resource_type, *args) |
Get the path that can be used to write a certain resource file. More... | |
List[str] | getAllPathsForType (cls, int resource_type) |
Return a list of paths for a certain resource type. More... | |
str | getStoragePathForType (cls, int resource_type) |
Return a path where a certain resource type can be stored. More... | |
None | addSearchPath (cls, str path) |
Add a path relative to which resources should be searched for. More... | |
None | removeSearchPath (cls, str path) |
Remove a resource search path. More... | |
None | addType (cls, int resource_type, str path) |
Add a custom resource type that can be located. More... | |
None | addStorageType (cls, int resource_type, str path) |
Add a custom storage path for a resource type. More... | |
str | getConfigStoragePath (cls) |
Gets the configuration storage path. More... | |
str | getDataStoragePath (cls) |
Gets the data storage path. More... | |
str | getCacheStoragePath (cls) |
Gets the cache storage path. More... | |
Generator[str, None, None] | getSearchPaths (cls) |
Gets the search paths for resources. More... | |
None | removeType (cls, int resource_type) |
Remove a custom resource type. More... | |
None | factoryReset (cls) |
Performs a factory reset, compressing the current state of configuration into an archive and emptying the resource folders. More... | |
None | copyVersionFolder (cls, str src_path, str dest_path) |
None | addExpectedDirNameInData (cls, str 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 | Plugins = 12 |
Location of plugins. | |
int | BundledPackages = 13 |
Location of data regarding bundled packages. | |
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" |
Class to look up any form of resource used by Uranium or an application using Uranium.
None UM.Resources.Resources.addSearchPath | ( | cls, | |
str | path | ||
) |
Add a path relative to which resources should be searched for.
path | The path to add. |
None UM.Resources.Resources.addStorageType | ( | cls, | |
int | resource_type, | ||
str | path | ||
) |
Add a custom storage path for a resource type.
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. |
None UM.Resources.Resources.addType | ( | cls, | |
int | resource_type, | ||
str | path | ||
) |
Add a custom resource type that can be located.
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./ |
None UM.Resources.Resources.factoryReset | ( | cls | ) |
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.
List[str] UM.Resources.Resources.getAllPathsForType | ( | cls, | |
int | resource_type | ||
) |
Return a list of paths for a certain resource type.
resource_type | int The type of resource to retrieve. |
TypeError | Raised when type is an unknown value. |
List[str] UM.Resources.Resources.getAllResourcesOfType | ( | cls, | |
int | resource_type | ||
) |
Get a list of paths to all resources of a certain resource type.
resource_type | The resource type to get the paths for. |
str UM.Resources.Resources.getCacheStoragePath | ( | cls | ) |
Gets the cache storage path.
This is where the application stores cache files.
str UM.Resources.Resources.getConfigStoragePath | ( | cls | ) |
Gets the configuration storage path.
This is where the application stores user configuration, such as preferences.
str UM.Resources.Resources.getDataStoragePath | ( | cls | ) |
Gets the data storage path.
This is where the application stores user files, such as profiles.
str UM.Resources.Resources.getPath | ( | cls, | |
int | resource_type, | ||
* | args | ||
) |
Get the path to a certain resource file.
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. |
FileNotFoundError | Raised when the file could not be found. |
Generator[str, None, None] UM.Resources.Resources.getSearchPaths | ( | cls | ) |
Gets the search paths for resources.
str UM.Resources.Resources.getStoragePath | ( | cls, | |
int | resource_type, | ||
* | args | ||
) |
Get the path that can be used to write a certain resource file.
resource_type | The type of resource to retrieve a path for. |
args | Arguments that are appended to the location for the correct path. |
str UM.Resources.Resources.getStoragePathForType | ( | cls, | |
int | resource_type | ||
) |
Return a path where a certain resource type can be stored.
type | The type of resource to store. |
UnsupportedStorageTypeError | Raised when writing type is not supported. |
None UM.Resources.Resources.removeSearchPath | ( | cls, | |
str | path | ||
) |
Remove a resource search path.
None UM.Resources.Resources.removeType | ( | cls, | |
int | resource_type | ||
) |
Remove a custom resource type.
|
static |
Location of container stack files.
Equal to $resources/stacks
|
static |
Location of definition container files.
Equal to $resources/definitions
|
static |
Location of translation files.
Equal to $resources/i18n.
|
static |
Location of images not in the theme.
Equal to $resources/images.
|
static |
Location of instance container files.
Equal to $resources/instances
|
static |
Location of meshes.
Equal to $resources/meshes.
|
static |
Location of preference configuration files.
Actual location depends on platform.
|
static |
The main resources location.
Equal to $resource_search_path/resources.
|
static |
Location of shaders.
Equal to $resources/shaders.
|
static |
Location of themes.
Equal to $resources/themes.
|
static |
Any custom resource types should be greater than this to prevent collisions with standard types.