diff --git a/qgreenland/util/qgis/project.py b/qgreenland/util/qgis/project.py index a1f2fd99..a788f7a1 100644 --- a/qgreenland/util/qgis/project.py +++ b/qgreenland/util/qgis/project.py @@ -9,6 +9,7 @@ from PyQt5.QtGui import QColor from qgreenland import exceptions as exc +from qgreenland.constants.project import PROJECT from qgreenland.models.config.layer_group import LayerGroupSettings from qgreenland.util.config.config import get_config from qgreenland.util.qgis.layer import make_map_layer @@ -79,6 +80,8 @@ def make_qgis_project_file(path: Path) -> None: package_layer_tree = prune_layers_not_in_package(config.layer_tree) _add_layers_and_groups(project, package_layer_tree) + _add_project_metadata(project) + # TODO: is it normal to write multiple times? project.write() @@ -87,6 +90,25 @@ def make_qgis_project_file(path: Path) -> None: project.clear() +def _add_project_metadata(project: qgc.QgsProject) -> None: + """Add project-level metadata (title, authors, abstract). + + This information is viewable in the **Project > Properties** in QGIS. + """ + project_metadata = project.metadata() + project_metadata.setAuthor("QGreenland team") + project_metadata.setTitle(PROJECT) + project_metadata.setAbstract( + """QGreenland is a free and open-source Greenland-focused GIS package +for QGIS. To learn more about QGreenland, visit our website: +https://qgreenland.org. + +For information on how to cite QGreenland, please see: +https://qgreenland.readthedocs.io/en/latest/citing.html""" + ) + project.setMetadata(project_metadata) + + def _apply_group_settings( group: qgc.QgsLayerTreeGroup, settings: LayerGroupSettings,