Uranium
Application Framework
|
Public Member Functions | |
str | getPath (cls, int resource_type, *args) |
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. | |
None | addSearchPath (cls, str path) |
Add a path relative to which resources should be searched for. | |
None | addSecureSearchPath (cls, str path) |
None | removeSearchPath (cls, str path) |
Remove a resource search path. | |
None | addType (cls, int resource_type, str path) |
Add a custom resource type that can be located. | |
None | 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. | |
str | getCacheStoragePath (cls) |
Gets the search paths for resources. | |
Generator[str, None, None] | getSearchPaths (cls) |
None | removeType (cls, int resource_type) |
Remove a custom resource type. | |
None | factoryReset (cls) |
None | copyVersionFolder (cls, str src_path, str dest_path) |
None | addExpectedDirNameInData (cls, str dir_name) |
None | setIsEnterprise (cls, bool is_enterprise) |
Public Attributes | |
ApplicationIdentifier | |
ApplicationVersion | |
Protected Member Functions | |
str | _getConfigStorageRootPath (cls) |
List[str] | _getPossibleConfigStorageRootPathList (cls) |
List[str] | _getPossibleDataStorageRootPathList (cls) |
Optional[str] | _getDataStorageRootPath (cls) |
Optional[str] | _getCacheStorageRootPath (cls) |
None | _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. | |
Optional[str] | _findLatestDirInPaths (cls, List[str] search_path_list, str dir_type="config") |
bool | _isNonVersionedDataDir (cls, str check_path) |
bool | _isNonVersionedConfigDir (cls, str check_path) |
Class to look up any form of resource used by Uranium or an application using Uranium
|
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.
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.
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.addSecureSearchPath | ( | cls, | |
str | path ) |
Add a path relative to which resources should be searched for. This path should be secure, such as the install directory. :param 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. |
Get a list of paths to all resources of a certain resource type. :param resource_type: The resource type to get the paths for. :return: A list of absolute paths to resources of the specified type.
str UM.Resources.Resources.getCacheStoragePath | ( | cls | ) |
Gets the search paths for resources.
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 :param resource_type: :type{int} The type of resource to retrieve a path for. :param args: Arguments that are appended to the location to locate the correct file. :return: 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. :exception FileNotFoundError: Raised when the file could not be found.
Generator[str, None, None] UM.Resources.Resources.getSearchPaths | ( | cls | ) |
Gets the search paths for resources. :return: A sequence of paths where resources might be.
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 | int The type of resource to store. |
UnsupportedStorageTypeError | Raised when writing type is not supported. |