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

Tarkista että aikavyöhyke on asetettu #200

Merged
merged 2 commits into from
Feb 26, 2025
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
15 changes: 15 additions & 0 deletions arho_feature_template/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
from typing import TYPE_CHECKING, Callable

from qgis.core import QgsApplication
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
Loading