Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add title, author, and abstract to project metadata. #730

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use our names, or is "QGreenland team" appropriate here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think QGreenland team is great. The full citation is easy to find. I think we should link to that page in our docs from this metadata.

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