diff options
| author | Francesco Gazzetta <fgaz@fgaz.me> | 2021-12-31 18:16:12 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel.thompson@linaro.org> | 2022-02-02 12:18:27 (GMT) |
| commit | 4b7cf885767e94b3a212d18bdcb4d76be519d547 (patch) | |
| tree | a6a6abeb8c84bd7208ca201731080c9c0e50b8e5 /wasp/apps/clock.py | |
| parent | 1c3a835448dcff6b182e120a1e135185943c21ff (diff) | |
Add watchface with weekday
* Allow overriding of date string in clock.py
* Override it to display the weekday in week_clock.py
Signed-off-by: Francesco Gazzetta <fgaz@fgaz.me>
Diffstat (limited to 'wasp/apps/clock.py')
| -rw-r--r-- | wasp/apps/clock.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/wasp/apps/clock.py b/wasp/apps/clock.py index d9e489f..6270999 100644 --- a/wasp/apps/clock.py +++ b/wasp/apps/clock.py @@ -62,6 +62,14 @@ class ClockApp(): wasp.system.bar.clock = False self._draw(True) + def _day_string(self, now): + """Produce a string representing the current day""" + # Format the month as text + month = now[1] - 1 + month = MONTH[month*3:(month+1)*3] + + return '{} {} {}'.format(now[2], month, now[0]) + def _draw(self, redraw=False): """Draw or lazily update the display. @@ -93,18 +101,13 @@ class ClockApp(): # Skip the update return - # Format the month as text - month = now[1] - 1 - month = MONTH[month*3:(month+1)*3] - # Draw the changeable parts of the watch face draw.blit(DIGITS[now[4] % 10], 4*48, 80, fg=hi) draw.blit(DIGITS[now[4] // 10], 3*48, 80, fg=lo) draw.blit(DIGITS[now[3] % 10], 1*48, 80, fg=hi) draw.blit(DIGITS[now[3] // 10], 0*48, 80, fg=lo) draw.set_color(hi) - draw.string('{} {} {}'.format(now[2], month, now[0]), - 0, 180, width=240) + draw.string(self._day_string(now), 0, 180, width=240) # Record the minute that is currently being displayed self._min = now[4] |
