diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-06-27 13:34:36 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-06-27 13:34:36 (GMT) |
| commit | 11be7ca3280134cf4e565198f87c316179cf2dc9 (patch) | |
| tree | 4d6d6f57859e990091a19c8b6af1245224c5b2c8 /wasp/apps/stopwatch.py | |
| parent | 7b3e0f917d541317edd4bed53ca6241d898cfbff (diff) | |
apps: stopwatch: Improve splits... and colour scheme
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps/stopwatch.py')
| -rw-r--r-- | wasp/apps/stopwatch.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/wasp/apps/stopwatch.py b/wasp/apps/stopwatch.py index 2b7e7e8..ac29999 100644 --- a/wasp/apps/stopwatch.py +++ b/wasp/apps/stopwatch.py @@ -47,6 +47,7 @@ class StopwatchApp(): self._update() self._splits.insert(0, self._count) del self._splits[4:] + self._nsplits += 1 else: self._reset() self._update() @@ -61,6 +62,7 @@ class StopwatchApp(): self._count = 0 self._last_count = -1 self._splits = [] + self._nsplits = 0 def _draw_splits(self): draw = wasp.watch.drawable @@ -68,21 +70,21 @@ class StopwatchApp(): if 0 == len(splits): draw.fill(0, 0, 120, 240, 120) return - y = 240 - 12 - (len(splits) * 24) + y = 240 - 6 - (len(splits) * 24) + + n = self._nsplits for i, s in enumerate(splits): - if s: - centisecs = s - secs = centisecs // 100 - centisecs %= 100 - minutes = secs // 60 - secs %= 60 + centisecs = s + secs = centisecs // 100 + centisecs %= 100 + minutes = secs // 60 + secs %= 60 - t = '#{} {:02}:{:02}.{:02}'.format(i+1, minutes, secs, centisecs) - else: - t = '' + t = '# {} {:02}:{:02}.{:02}'.format(n, minutes, secs, centisecs) + n -= 1 draw.set_font(fonts.sans24) - draw.set_color(0xfff0) + draw.set_color(0xe73c) w = fonts.width(fonts.sans24, t) draw.string(t, 0, y + (i*24), 240) @@ -113,7 +115,7 @@ class StopwatchApp(): if now[4] != self._last_clock[4]: t1 = '{:02}:{:02}'.format(now[3], now[4]) draw.set_font(fonts.sans28) - draw.set_color(0x7bef) + draw.set_color(0xe73c) draw.string(t1, 48, 12, 240-96) self._last_clock = now self._meter.update() @@ -129,7 +131,7 @@ class StopwatchApp(): t2 = '{:02}'.format(centisecs) draw.set_font(fonts.sans36) - draw.set_color(0xffff) + draw.set_color(0xc67f) w = fonts.width(fonts.sans36, t1) draw.string(t1, 180-w, 120-36) draw.fill(0, 0, 120-36, 180-w, 36) |
