apps: clock: Fix theme handling

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
Daniel Thompson 2020-12-13 16:39:29 +00:00
parent 2624a6e998
commit e44e605b7a

View file

@ -70,14 +70,16 @@ class ClockApp():
True then a full redraw is be performed.
"""
draw = wasp.watch.drawable
hi = wasp.system.theme('accent-hi')
mid = wasp.system.theme('accent-mid')
lo = wasp.system.theme('accent-lo')
if redraw:
now = wasp.watch.rtc.get_localtime()
# Clear the display and draw that static parts of the watch face
draw.fill()
draw.rleblit(digits.clock_colon, pos=(2*48, 80),
fg=wasp.system.theme('accent-mid'))
draw.rleblit(digits.clock_colon, pos=(2*48, 80), fg=mid)
# Redraw the status bar
wasp.system.bar.draw()
@ -96,14 +98,11 @@ class ClockApp():
month = MONTH[month*3:(month+1)*3]
# Draw the changeable parts of the watch face
draw.rleblit(DIGITS[now[4] % 10], pos=(4*48, 80),
fg=wasp.system.theme('accent-hi'))
draw.rleblit(DIGITS[now[4] // 10], pos=(3*48, 80),
fg=wasp.system.theme('accent-lo'))
draw.rleblit(DIGITS[now[3] % 10], pos=(1*48, 80),
fg=wasp.system.theme('accent-hi'))
draw.rleblit(DIGITS[now[3] // 10], pos=(0*48, 80),
fg=wasp.system.theme('accent-lo'))
draw.rleblit(DIGITS[now[4] % 10], pos=(4*48, 80), fg=hi)
draw.rleblit(DIGITS[now[4] // 10], pos=(3*48, 80), fg=lo)
draw.rleblit(DIGITS[now[3] % 10], pos=(1*48, 80), fg=hi)
draw.rleblit(DIGITS[now[3] // 10], pos=(0*48, 80), fg=lo)
draw.set_color(hi)
draw.string('{} {} {}'.format(now[2], month, now[0]),
0, 180, width=240)