qgis_deployment_toolbelt.profiles.qgis_ini_handler module#

Read and write QGIS configuration files.

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

class qgis_deployment_toolbelt.profiles.qgis_ini_handler.QgisIniHelper(ini_filepath: Path, ini_type: Literal['profile_qgis3', 'profile_qgis3customization', 'plugin_metadata', None] = None, strict: bool = False, enable_environment_variables_interpolation: bool = True)#

Bases: object

Helper to manipulate QGIS configuration files (*.ini).

SUPPORTED_INI_TYPES: tuple[str, str, str] = ('plugin_metadata', 'profile_qgis3', 'profile_qgis3customization')#
cfg_parser() CustomConfigParser#

Return config parser with options for QGIS ini files.

Returns:

config parser

Return type:

CustomConfigParser

ini_type: str | None = None#
is_splash_screen_set(ini_file: CustomConfigParser | Path | None = None) bool | None#

Determine if a custom splash screen is set or not.

Parameters:

ini_file (Union[CustomConfigParser, Path]) – input ini file to check. A warning is raised if the filename is not QGISCUSTOMIZATION3.ini. If None, self.profile_customization_path is used.

Returns:

True if a splash is set

Return type:

bool

is_ui_customization_enabled(ini_file: CustomConfigParser | Path | None = None) bool | None#

Determine if UI customization is enabled.

Parameters:

ini_file (Union[CustomConfigParser, Path]) – input ini file to check. A warning is raised if the filename is not QGIS3.ini. If None, self.profile_config_path is used.

Returns:

True if customization is enabled

Return type:

bool

set_splash_screen(ini_file: CustomConfigParser | Path | None = None, splash_screen_filepath: Path | None = None, switch: bool = True) bool#

Add/remove splash screen path to the QGISCUSTOMIZATION3.ini file.

Parameters:
  • ini_file (Union[CustomConfigParser, Path]) – input ini file to check. A warning is raised if the filename is not QGISCUSTOMIZATION3.ini. If None, self.profile_customization_path is used.

  • splash_screen_filepath (Path, optional) – path to the folder containing the splash.png file, defaults to None. Defaults to None.

  • switch (bool, optional) – True to add, False to remove, defaults to True. Defaults to True.

Returns:

True is the splash folder is present. False is absent.

Return type:

bool

set_ui_customization_enabled(switch: bool = True) bool#

Enable/disable UI customization in the profile QGIS3.ini file.

Parameters:

switch (bool, optional) – True to enable, False to disable UI customization. Defaults to True.

Returns:

UI customization state. True is enabled, False is disabled.

Return type:

bool