Class: QgsLocalizedDataPathRegistry

class qgis.core.QgsLocalizedDataPathRegistry

Bases: sip.wrapper

A registry class to hold localized data paths which can be used for basemaps, logos, etc. Paths are meant to be absolute paths and are stored by order of preference.

If a layer from one of the paths is loaded, it will be saved as localized in the project file. For instance, if you have C:/my_maps in your localized paths, C:/my_maps/my_country/ortho.tif will be save in your project as localized:my_country/ortho.tif.

The resolving of the file paths happens in QgsPathResolver.

New in version 3.14:

Methods

globalPath

Returns the global path if the file has been found in one of the paths, an empty string otherwise

localizedPath

Returns the localized path if the file has been found in one of the path, an empty string otherwise

paths

Returns a list of registered localized paths

registerPath

Registers a localized path If position is given, the path is inserted at the given position in the list Since the paths are stored by order of preference, lower positions in the list take precedence.

unregisterPath

Unregisters a localized path

globalPath(self, localizedPath: str) str

Returns the global path if the file has been found in one of the paths, an empty string otherwise

Parameters:

localizedPath (str) –

Return type:

str

localizedPath(self, globalPath: str) str

Returns the localized path if the file has been found in one of the path, an empty string otherwise

Parameters:

globalPath (str) –

Return type:

str

paths(self) List[str]

Returns a list of registered localized paths

Return type:

List[str]

registerPath(self, path: str, position: int = -1)

Registers a localized path If position is given, the path is inserted at the given position in the list Since the paths are stored by order of preference, lower positions in the list take precedence.

Parameters:
  • path (str) –

  • position (int = -1) –

unregisterPath(self, path: str)

Unregisters a localized path

Parameters:

path (str) –