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/week_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/week_clock.py')
| -rw-r--r-- | wasp/apps/week_clock.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/wasp/apps/week_clock.py b/wasp/apps/week_clock.py new file mode 100644 index 0000000..99d3c41 --- /dev/null +++ b/wasp/apps/week_clock.py @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later +# Copyright (C) 2022 Francesco Gazzetta + +"""Digital clock with weekday +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Shows a time (as HH:MM) together with a battery meter, the date, and the weekday. + +.. figure:: res/WeekClkApp.png + :width: 179 +""" + +from apps.clock import ClockApp, MONTH + +WDAY = 'MonTueWedThuFriSatSun' + +class WeekClockApp(ClockApp): + NAME = 'WeekClk' + + 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] + + # Format the weekday as text + wday = now[6] + wday = WDAY[wday*3:(wday+1)*3] + + return '{} {} {} {}'.format(wday, now[2], month, now[0]) |
