Skip to content

Commit

Permalink
Merge pull request #730 from nsidc/add-project-metadata
Browse files Browse the repository at this point in the history
Add title, author, and abstract to project metadata.
  • Loading branch information
trey-stafford authored Aug 16, 2023
2 parents b2d1346 + 3ac51e9 commit e457821
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions qgreenland/util/qgis/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand All @@ -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,
Expand Down

0 comments on commit e457821

Please sign in to comment.