Corrected duplicate hour time formatting

This commit is contained in:
2017-04-19 02:25:56 -04:00
parent e093cac35b
commit 64e113d5d7
2 changed files with 14 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
[
{
"surf": "panel_script::time",
"anchor": "0.5,0.4",
"anchor": "0.5, 0.4",
"args": {
"size": 360
}
@@ -49,5 +49,14 @@
"anchor": ".5 .5"
}
]
},
{
"surf": "panel_script::weather",
"args": {
"fmt": "Weather updated {current_conditions.last_updated}",
"size": 30
},
"anchor": ".5 1",
"position": "0 -20"
}
]

View File

@@ -27,11 +27,11 @@ class Font(object):
roboto = Font('res/RobotoSlab-Regular.ttf')
def __do_eval(text):
def __do_eval(t):
try:
return eval(text)
return eval(t)
except:
return text
return t
def text(size=60, t="", do_eval=False):
@@ -40,7 +40,7 @@ def text(size=60, t="", do_eval=False):
return roboto[size].render(t, True, WHITE)
def time(size=60, fmt='%I:%H', strip='0'):
def time(size=60, fmt='%I:%M', strip='0'):
return roboto[size].render(format(datetime.now(), fmt).lstrip(strip), True, WHITE)