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')¶
- __init__(ini_filepath: Path, ini_type: Literal['profile_qgis3', 'profile_qgis3customization', 'plugin_metadata', None] = None, strict: bool = False, enable_environment_variables_interpolation: bool = True) None ¶
Instanciation.
- Parameters:
ini_filepath (Path) – path to the QGIS3.ini configuration file
ini_type (Literal[ "profile_qgis3", "profile_qgis3customization", "plugin_metadata", None ], optional) – type of ini file. None enables autodetection. Defaults to None.
strict (bool, optional) – strict mode applied to ConfigParser. Defaults to False.
enable_environment_variables_interpolation (bool, optional) – if enabled, values matching environment variables are interepreted. Defaults to True.
- cfg_parser() CustomConfigParser ¶
Return config parser with options for QGIS ini files.
- Returns:
config parser
- Return type:
- 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:
- 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:
- merge_to(dst: QgisIniHelper) None ¶
Merge INI file to another INI file. If the destination file exists a merge is done: - all available sections are kept - if a section is available in both INI files, keep updated parameters in a backup section If environnement variable interpolation is enabled, value are written with current environnement values
- Parameters:
dst (QgisIniHelper) – destination ini file
- 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: