Class to look up any form of resource used by Uranium or an application using Uranium.
More...
|
str | getPath (cls, int resource_type, *args) |
| Get the path to a certain resource file.
|
|
List[str] | getAllResourcesOfType (cls, int resource_type) |
| Get a list of paths to all resources of a certain resource type.
|
|
str | getStoragePath (cls, int resource_type, *args) |
| Get the path that can be used to write a certain resource file.
|
|
List[str] | getAllPathsForType (cls, int resource_type) |
| Return a list of paths for a certain resource type.
|
|
str | getStoragePathForType (cls, int resource_type) |
| Return a path where a certain resource type can be stored.
|
|
| addSearchPath (cls, str path) |
| Add a path relative to which resources should be searched for.
|
|
| removeSearchPath (cls, str path) |
| Remove a resource search path.
|
|
| addType (cls, int resource_type, str path) |
| Add a custom resource type that can be located.
|
|
| addStorageType (cls, int resource_type, str path) |
| Add a custom storage path for a resource type.
|
|
str | getConfigStoragePath (cls) |
| Gets the configuration storage path.
|
|
str | getDataStoragePath (cls) |
| Gets the data storage path.
|
|
| getSearchPaths (cls) |
| Gets the search paths for resources.
|
|
| removeType (cls, int resource_type) |
| Remove a custom resource type.
|
|
| addExpectedDirNameInData (cls, dir_name) |
|
|
| ApplicationIdentifier |
|
| ApplicationVersion |
|
|
int | Resources = 1 |
| The main resources location.
|
|
int | Preferences = 2 |
| Location of preference configuration files.
|
|
int | Meshes = 3 |
| Location of meshes.
|
|
int | Shaders = 4 |
| Location of shaders.
|
|
int | i18n = 5 |
| Location of translation files.
|
|
int | Images = 6 |
| Location of images not in the theme.
|
|
int | Themes = 7 |
| Location of themes.
|
|
int | DefinitionContainers = 8 |
| Location of definition container files.
|
|
int | InstanceContainers = 9 |
| Location of instance container files.
|
|
int | ContainerStacks = 10 |
| Location of container stack files.
|
|
int | Cache = 11 |
| Location of cached data.
|
|
int | GCodes = 127 |
|
int | UserType = 128 |
| Any custom resource types should be greater than this to prevent collisions with standard types.
|
|
str | ApplicationIdentifier = "UM" |
|
str | ApplicationVersion = "unknown" |
|
|
| _getConfigStorageRootPath (cls) |
|
| _getPossibleConfigStorageRootPathList (cls) |
|
List[str] | _getPossibleDataStorageRootPathList (cls) |
|
| _getDataStorageRootPath (cls) |
|
| _getCacheStorageRootPath (cls) |
|
| _copyLatestDirsIfPresent (cls) |
| Copies the directories of the latest version on this machine if present, so the upgrade will use the copies as the base for upgrade.
|
|
| _findLatestDirInPaths (cls, search_path_list, dir_type="config") |
|
| _isNonVersionedDataDir (cls, check_path) |
|
| _isNonVersionedConfigDir (cls, check_path) |
|
Class to look up any form of resource used by Uranium or an application using Uranium.
◆ _copyLatestDirsIfPresent()
UM.Resources.Resources._copyLatestDirsIfPresent |
( |
|
cls | ) |
|
|
protected |
Copies the directories of the latest version on this machine if present, so the upgrade will use the copies as the base for upgrade.
See CURA-3529 for more details.
◆ addSearchPath()
UM.Resources.Resources.addSearchPath |
( |
|
cls, |
|
|
str |
path |
|
) |
| |
Add a path relative to which resources should be searched for.
- Parameters
-
◆ addStorageType()
UM.Resources.Resources.addStorageType |
( |
|
cls, |
|
|
int |
resource_type, |
|
|
str |
path |
|
) |
| |
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()
UM.Resources.Resources.addType |
( |
|
cls, |
|
|
int |
resource_type, |
|
|
str |
path |
|
) |
| |
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./ |
◆ getAllPathsForType()
List[str] UM.Resources.Resources.getAllPathsForType |
( |
|
cls, |
|
|
int |
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()
List[str] UM.Resources.Resources.getAllResourcesOfType |
( |
|
cls, |
|
|
int |
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.
◆ getConfigStoragePath()
str UM.Resources.Resources.getConfigStoragePath |
( |
|
cls | ) |
|
Gets the configuration storage path.
This is where the application stores user configuration, such as preferences.
◆ getDataStoragePath()
str UM.Resources.Resources.getDataStoragePath |
( |
|
cls | ) |
|
Gets the data storage path.
This is where the application stores user files, such as profiles.
◆ getPath()
str UM.Resources.Resources.getPath |
( |
|
cls, |
|
|
int |
resource_type, |
|
|
* |
args |
|
) |
| |
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()
UM.Resources.Resources.getSearchPaths |
( |
|
cls | ) |
|
Gets the search paths for resources.
- Returns
- A sequence of paths where resources might be.
◆ getStoragePath()
str UM.Resources.Resources.getStoragePath |
( |
|
cls, |
|
|
int |
resource_type, |
|
|
* |
args |
|
) |
| |
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()
str UM.Resources.Resources.getStoragePathForType |
( |
|
cls, |
|
|
int |
resource_type |
|
) |
| |
Return a path where a certain resource type can be stored.
- Parameters
-
type | int The type of resource to store. |
- Returns
- string An absolute path where the given resource type can be stored.
- Exceptions
-
UnsupportedStorageTypeError | Raised when writing type is not supported. |
◆ 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.
The documentation for this class was generated from the following file: