Skip to content

Commit 24159f9

Browse files
committed
Add check and warning for time zone variable
Check if PGTZ is set to expected value. Warn user if not.
1 parent 2cd3a3e commit 24159f9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arho_feature_template/plugin.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import os
34
from typing import TYPE_CHECKING, Callable
45

56
from qgis.core import QgsApplication
@@ -42,6 +43,17 @@ def __init__(self) -> None:
4243

4344
self.toolbar = iface.addToolBar("ARHO Toolbar")
4445
self.toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
46+
self.check_timezone_variable()
47+
48+
def check_timezone_variable(self):
49+
"""Check if PGTZ environment variable is correctly set."""
50+
51+
if os.environ.get("PGTZ") != "Europe/Helsinki":
52+
iface.messageBar().pushWarning(
53+
"Varoitus",
54+
"Ympäristömuuttuja PGTZ ei ole asetettu arvoon 'Europe/Helsinki'.\n"
55+
"Tämä voi johtaa väärään aikavyöhykkeeseen tallennettuihin kellonaikoihin.",
56+
)
4557

4658
def add_action(
4759
self,

0 commit comments

Comments
 (0)