From 1c69f1ae32a946b95fe0833d666c8d7526b5dbfe Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Wed, 16 Aug 2023 15:52:11 -0600 Subject: [PATCH 1/3] Add title, author, and abstract to project metadata. TODO: review abstract & authors (do we want to list out team members, or just "QGreenland Team"?) --- qgreenland/util/qgis/project.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qgreenland/util/qgis/project.py b/qgreenland/util/qgis/project.py index a1f2fd99..772e06bd 100644 --- a/qgreenland/util/qgis/project.py +++ b/qgreenland/util/qgis/project.py @@ -79,6 +79,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 +89,22 @@ 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("QGreenland") + 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""" + ) + project.setMetadata(project_metadata) + + def _apply_group_settings( group: qgc.QgsLayerTreeGroup, settings: LayerGroupSettings, From adce7101c5f178f885e7db4bb1026095fae6b6aa Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Wed, 16 Aug 2023 16:01:15 -0600 Subject: [PATCH 2/3] Use `PROJECT` constant to set project title. --- qgreenland/util/qgis/project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qgreenland/util/qgis/project.py b/qgreenland/util/qgis/project.py index 772e06bd..74ad6005 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 @@ -96,7 +97,7 @@ def _add_project_metadata(project: qgc.QgsProject) -> None: """ project_metadata = project.metadata() project_metadata.setAuthor("QGreenland team") - project_metadata.setTitle("QGreenland") + 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: From 3ac51e93206c9e8afe7910dbafc5f5edad30c1e0 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Wed, 16 Aug 2023 17:14:48 -0600 Subject: [PATCH 3/3] Project abstract: Add link to RTD page on how to cite QGreenland --- qgreenland/util/qgis/project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qgreenland/util/qgis/project.py b/qgreenland/util/qgis/project.py index 74ad6005..a788f7a1 100644 --- a/qgreenland/util/qgis/project.py +++ b/qgreenland/util/qgis/project.py @@ -101,7 +101,10 @@ def _add_project_metadata(project: qgc.QgsProject) -> None: 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""" +https://qgreenland.org. + +For information on how to cite QGreenland, please see: +https://qgreenland.readthedocs.io/en/latest/citing.html""" ) project.setMetadata(project_metadata)