diff --git a/arho_feature_template/plugin.py b/arho_feature_template/plugin.py index b7ab8a7..a742048 100644 --- a/arho_feature_template/plugin.py +++ b/arho_feature_template/plugin.py @@ -1,5 +1,6 @@ from __future__ import annotations +import os from typing import TYPE_CHECKING, Callable from qgis.core import QgsApplication @@ -43,6 +44,18 @@ def __init__(self) -> None: self.toolbar = iface.addToolBar("ARHO Toolbar") self.toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + def check_timezone_variable(self): + """Check if PGTZ environment variable is correctly set.""" + + if os.environ.get("PGTZ") != "Europe/Helsinki": + iface.messageBar().pushWarning( + "Varoitus", + ( + "Ympäristömuuttuja PGTZ ei ole asetettu arvoon 'Europe/Helsinki'." + "Tämä voi johtaa väärään aikavyöhykkeeseen tallennettuihin kellonaikoihin." + ), + ) + def add_action( self, text: str, @@ -239,6 +252,8 @@ def initGui(self) -> None: # noqa N802 lambda: self.identify_plan_features_action.setChecked(False) ) + self.check_timezone_variable() + def toggle_dock_visibility(self, dock_widget: QgsDockWidget): if dock_widget.isUserVisible(): dock_widget.hide()