summaryrefslogtreecommitdiff
path: root/wasp/apps/week_clock.py
diff options
context:
space:
mode:
Diffstat (limited to 'wasp/apps/week_clock.py')
-rw-r--r--wasp/apps/week_clock.py30
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])