Skip to content

Commit

Permalink
Fix n0bel#256 Date strings not always in locale
Browse files Browse the repository at this point in the history
Moved set locale from tick to qtstart
  • Loading branch information
BertLindeman authored Apr 10, 2023
1 parent 1ec723c commit e440ab9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Clock/PyQtPiClock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -327,7 +321,6 @@ def heighti(f):
return f / 25.4



def barom(f):
return f * 25.4

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e440ab9

Please sign in to comment.