qgis_deployment_toolbelt.profiles.qdt_profile module

QDT QGIS Profile object and related sugar.

Author: Julien Moura (https://github.com/guts)

class qgis_deployment_toolbelt.profiles.qdt_profile.QdtProfile(alias: str | None = None, author: str | None = None, description: str | None = None, email: str | None = None, folder: Path | None = None, icon: str | None = None, json_ref_path: Path | None = None, loaded_from_json: bool = False, name: str | None = None, plugins: list | None = None, qgis_maximum_version: str | None = None, qgis_minimum_version: str | None = None, rules: list[dict] | None = None, splash: str | None = None, version: str | None = None, **kwargs)

Bases: object

Object definition for QGIS Profile handled by QDT.

ATTR_MAP = {'qgis_maximum_version': 'qgisMaximumVersion', 'qgis_minimum_version': 'qgisMinimumVersion'}
__init__(alias: str | None = None, author: str | None = None, description: str | None = None, email: str | None = None, folder: Path | None = None, icon: str | None = None, json_ref_path: Path | None = None, loaded_from_json: bool = False, name: str | None = None, plugins: list | None = None, qgis_maximum_version: str | None = None, qgis_minimum_version: str | None = None, rules: list[dict] | None = None, splash: str | None = None, version: str | None = None, **kwargs)

Initialize a QDT Profile object.

Parameters:
  • name (str) – name of the shortcut that will be created

  • author (str) – profile author name

property alias: str

Returns the profile’s alias.

Return str:

profile alias

property folder: Path

Returns the path to the folder where the profile is stored.

Returns:

profile folder path

Return type:

Path

classmethod from_json(profile_json_path: Path, profile_folder: Path | None = None) QdtProfile

Load profile from a profile.json file.

Parameters:
  • profile_json_path (Path) – path to the profile json file

  • profile_folder (Path | None, optional) – path to the profile folder, defaults to None.

Returns:

QdtProfile object with attributes filled from JSON.

Return type:

QdtProfile

Example

QdtProfile = QdtProfile.from_json(
        Path(src_profile / "profile.json")
    )
print(profile.splash.resolve())
get_qgis3customizationini_helper() QgisIniHelper

Return the QGIS3 ini helper for the profile customization.

Returns:

Ini helper loaded with profile’s QGIS/QGISCUSTOMIZATION3.ini

Return type:

QgisIniHelper

get_qgis3ini_helper() QgisIniHelper

Return the QGIS3 ini helper for the profile configuration.

Returns:

Ini helper loaded with profile’s QGIS/QGIS3.ini

Return type:

QgisIniHelper

has_qgis3_ini_file() bool

Determine if a QGIS/QGIS3.ini file exists in the profile folder.

Returns:

True if a QGIS/QGIS3.ini file exists in the profile folder.

Return type:

bool

has_qgis3customization_ini_file() bool

Determine if a QGIS/QGISCUSTOMIZATION3.ini file exists in the profile folder.

Returns:

True if a QGIS/QGISCUSTOMIZATION3.ini file exists in the profile folder.

Return type:

bool

property icon: str | None

Returns the icon as specified into the original profile.json.

Return str:

profile icon value

property icon_path: Path

Returns the path to the profile’s icon into the profile folder.

Return Path:

profile icon path

property installed_profile: QdtProfile | None
Returns the installed profile object only if the corresponding profiles.json

exists.

Returns:

QdtProfile object if profile.json exists, else None

Return type:

QdtProfile | None

property is_loaded_from_json: bool

Tells if the profile has been loaded from a JSON file.

Return bool:

True if the profile has been loaded from a JSON file

is_older_than(version_to_compare: str | QdtProfile) bool | None
Determine if the actual object version is older than the given version to

compare.

Parameters:
  • version_to_compare (Union[str, QdtProfile]) – given version to compare with object

  • version

Returns:

True if the given version is newer (more recent)

Return type:

bool

property json_ref_path: Path

Returns the path to the corresponding JSON path.

Return Path:

profile json_ref_path path

merge_to(dst: QdtProfile) None

Merge QdtProfile to another profile

Parameters:

dst (QdtProfile) – _description_

property name: str | None

Returns the profile’s name. If not set, the folder name is used.

Returns:

profile’s name

Return type:

str

property path_in_qgis: Path
Returns the path to the folder where the profile is stored in QGIS 3

(= installed).

Returns:

path to the installed (i.e. in QGIS) profile folder

Return type:

Path

property plugins: list[QgisPlugin]

Returns the plugins associated with the profile.

Returns:

list of plugins

Return type:

List[QgisPlugin]

property rules: list[dict] | None

Returns the rules associated with the profile.

Returns:

list of rules

Return type:

list[rules]

property splash: str | Path | None

Returns the profile splash image as path if can be resolved or as string.

Returns:

path to the profile splash image

Return type:

Union[str, Path]

status() Literal['downloaded', 'installed', 'unknown']

Determine current profile status: downloaded (in QDT working folder), installed (in QGIS3/profiles) or unknown.

Returns:

one of “downloaded”, “installed”, “unknown”

Return type:

str

property version: str | None

Returns the profile version as string.

Returns:

version

Return type:

str