From e440ab9e1b98b8bef50d78049aa3a3563b5d8eac Mon Sep 17 00:00:00 2001 From: Bert Date: Mon, 10 Apr 2023 20:38:50 +0200 Subject: [PATCH] Fix #256 Date strings not always in locale Moved set locale from tick to qtstart --- Clock/PyQtPiClock.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Clock/PyQtPiClock.py b/Clock/PyQtPiClock.py index 3dd1f62..20825d6 100644 --- a/Clock/PyQtPiClock.py +++ b/Clock/PyQtPiClock.py @@ -161,12 +161,6 @@ def tick(): global sun, daytime, sunrise, sunset global bottom - if Config.DateLocale != "": - try: - locale.setlocale(locale.LC_TIME, Config.DateLocale) - except: - pass - now = datetime.datetime.now() try: if Config.clockUTC: @@ -327,7 +321,6 @@ def heighti(f): return f / 25.4 - def barom(f): return f * 25.4 @@ -1509,6 +1502,12 @@ def qtstart(): global objradar4 global sun, daytime, sunrise, sunset + if Config.DateLocale != "": + try: + locale.setlocale(locale.LC_TIME, Config.DateLocale) + except: + pass + dt = datetime.datetime.now(tz=tzlocal.get_localzone()) sun = suntimes(Config.location.lat, Config.location.lng) sunrise = sun.sunrise(dt)