diff --git a/TODO.rst b/TODO.rst index bcc29af..2bc9438 100644 --- a/TODO.rst +++ b/TODO.rst @@ -39,7 +39,7 @@ Wasp-os * [ ] Update icon for Music player * [ ] Introduce fwd/back/vol+/vol- buttons to the music player * [X] Update icon for Alarm app - * [ ] Update art work for buttons in Confirmation view + * [X] Update art work for buttons in Confirmation view * [X] Reduce the size of the battery charge icon slightly (match bell) * [ ] Widgets diff --git a/res/no_button.png b/res/no_button.png deleted file mode 100644 index cb295d1..0000000 Binary files a/res/no_button.png and /dev/null differ diff --git a/res/yes_button.png b/res/yes_button.png deleted file mode 100644 index 48bd3fe..0000000 Binary files a/res/yes_button.png and /dev/null differ diff --git a/wasp/apps/pager.py b/wasp/apps/pager.py index 4f518eb..5a435a6 100644 --- a/wasp/apps/pager.py +++ b/wasp/apps/pager.py @@ -36,8 +36,6 @@ class PagerApp(): def swipe(self, event): """Swipe to page up/down.""" - mute = wasp.watch.display.mute - if event[0] == wasp.EventType.UP: if self._page >= self._numpages: wasp.system.navigate(wasp.EventType.BACK) @@ -48,9 +46,7 @@ class PagerApp(): wasp.watch.vibrator.pulse() return self._page -= 1 - mute(True) self._draw() - mute(False) def _redraw(self): """Redraw from scratch (jump to the first page)""" @@ -61,7 +57,11 @@ class PagerApp(): def _draw(self): """Draw a page from scratch.""" + mute = wasp.watch.display.mute draw = wasp.watch.drawable + + mute(True) + draw.set_color(0xffff) draw.fill() page = self._page @@ -77,6 +77,8 @@ class PagerApp(): scroll.down = page < self._numpages scroll.draw() + mute(False) + class NotificationApp(PagerApp): NAME = 'Notifications' diff --git a/wasp/boards/sphinx/icons.py b/wasp/boards/sphinx/icons.py index b17b97e..a5cceac 100644 --- a/wasp/boards/sphinx/icons.py +++ b/wasp/boards/sphinx/icons.py @@ -11,5 +11,3 @@ settings = 'Default settings icon' torch = 'Default torch or flashlight icon' up_arrow = 'Small (16x9) up arrow' down_arrow = 'Small (16x9) down arrow' -yes_button = b'Yes button' -no_button = b'No button' diff --git a/wasp/icons.py b/wasp/icons.py index 2ccd140..8954b59 100644 --- a/wasp/icons.py +++ b/wasp/icons.py @@ -286,73 +286,6 @@ pause = ( b'&\xe0)\xdd-\xda1\xd47\xce?\xff\x8f' ) -# 2-bit RLE, generated from res/yes_button.png, 432 bytes -yes_button = ( - b'\x02' - b'`<' - b'?"\xff\x1e\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1' - b'?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?' - b'\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c' - b'\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1' - b'\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03' - b'\xc1\x08\xc5\x0f\xc5\x05\xd4\n\xcf\x08\xc1\x03\xc1\x08\xc5\x0f' - b'\xc5\x05\xd4\n\xcf\x08\xc1\x03\xc1\x08\xc5\x0f\xc5\x05\xd4\n' - b'\xcf\x08\xc1\x03\xc1\x08\xc5\x0f\xc5\x05\xd4\n\xcf\x08\xc1\x03' - b'\xc1\x08\xc5\x0f\xc5\x05\xd4\n\xcf\x08\xc1\x03\xc1\x08\xc5\x0f' - b'\xc5\x05\xc5\x14\xc5\x17\xc1\x03\xc1\x08\xc5\x0f\xc5\x05\xc5\x14' - b'\xc5\x17\xc1\x03\xc1\x08\xc5\x0f\xc5\x05\xc5\x14\xc5\x17\xc1\x03' - b'\xc1\x08\xc5\x0f\xc5\x05\xc5\x14\xc5\x17\xc1\x03\xc1\x08\xc5\x0f' - b'\xc5\x05\xc5\x14\xc5\x17\xc1\x03\xc1\r\xcf\n\xcf\x0f\xca\r' - b'\xc1\x03\xc1\r\xcf\n\xcf\x0f\xca\r\xc1\x03\xc1\r\xcf\n' - b'\xcf\x0f\xca\r\xc1\x03\xc1\r\xcf\n\xcf\x0f\xca\r\xc1\x03' - b'\xc1\r\xcf\n\xcf\x0f\xca\r\xc1\x03\xc1\x12\xc5\x0f\xc5#' - b'\xc5\x08\xc1\x03\xc1\x12\xc5\x0f\xc5#\xc5\x08\xc1\x03\xc1\x12' - b'\xc5\x0f\xc5#\xc5\x08\xc1\x03\xc1\x12\xc5\x0f\xc5#\xc5\x08' - b'\xc1\x03\xc1\x12\xc5\x0f\xc5#\xc5\x08\xc1\x03\xc1\x12\xc5\x0f' - b'\xd4\x05\xcf\r\xc1\x03\xc1\x12\xc5\x0f\xd4\x05\xcf\r\xc1\x03' - b'\xc1\x12\xc5\x0f\xd4\x05\xcf\r\xc1\x03\xc1\x12\xc5\x0f\xd4\x05' - b'\xcf\r\xc1\x03\xc1\x12\xc5\x0f\xd4\x05\xcf\r\xc1\x03\xc1?' - b'\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c' - b'\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1' - b'\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03' - b'\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1' - b'?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xff\x1e?\x83' -) - -# 2-bit RLE, generated from res/no_button.png, 442 bytes -no_button = ( - b'\x02' - b'`<' - b'?"\xff\x1e\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1' - b'?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?' - b'\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c' - b'\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1' - b'\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1\x16\xc5\n\xc5' - b'\n\xca\x1d\xc1\x03\xc1\x16\xc5\n\xc5\n\xca\x1d\xc1\x03\xc1' - b'\x16\xc5\n\xc5\n\xca\x1d\xc1\x03\xc1\x16\xc5\n\xc5\n\xca' - b'\x1d\xc1\x03\xc1\x16\xc5\n\xc5\n\xca\x1d\xc1\x03\xc1\x16\xca' - b'\x05\xc5\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xca\x05\xc5\x05\xc5' - b'\n\xc5\x18\xc1\x03\xc1\x16\xca\x05\xc5\x05\xc5\n\xc5\x18\xc1' - b'\x03\xc1\x16\xca\x05\xc5\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xca' - b'\x05\xc5\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xc5\x05\xca\x05\xc5' - b'\n\xc5\x18\xc1\x03\xc1\x16\xc5\x05\xca\x05\xc5\n\xc5\x18\xc1' - b'\x03\xc1\x16\xc5\x05\xca\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xc5' - b'\x05\xca\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xc5\x05\xca\x05\xc5' - b'\n\xc5\x18\xc1\x03\xc1\x16\xc5\n\xc5\x05\xc5\n\xc5\x18\xc1' - b'\x03\xc1\x16\xc5\n\xc5\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xc5' - b'\n\xc5\x05\xc5\n\xc5\x18\xc1\x03\xc1\x16\xc5\n\xc5\x05\xc5' - b'\n\xc5\x18\xc1\x03\xc1\x16\xc5\n\xc5\x05\xc5\n\xc5\x18\xc1' - b'\x03\xc1\x16\xc5\n\xc5\n\xca\x1d\xc1\x03\xc1\x16\xc5\n\xc5' - b'\n\xca\x1d\xc1\x03\xc1\x16\xc5\n\xc5\n\xca\x1d\xc1\x03\xc1' - b'\x16\xc5\n\xc5\n\xca\x1d\xc1\x03\xc1\x16\xc5\n\xc5\n\xca' - b'\x1d\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c' - b'\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1' - b'\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03' - b'\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1' - b'?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?\x1c\xc1\x03\xc1?' - b'\x1c\xc1\x03\xff\x1e?\x83' -) - # 2-bit RLE, generated from res/checkbox.png, 108 bytes checkbox = ( b'\x02' diff --git a/wasp/widgets.py b/wasp/widgets.py index 0fa4a61..e3019bb 100644 --- a/wasp/widgets.py +++ b/wasp/widgets.py @@ -430,24 +430,34 @@ class ConfirmationView: def __init__(self): self.active = False self.value = False + self._yes = Button(20, 140, 90, 45, 'Yes') + self._no = Button(130, 140, 90, 45, 'No') def draw(self, message): + draw = wasp.watch.drawable + mute = wasp.watch.display.mute + + mute(True) + draw.set_color(wasp.system.theme('bright')) + draw.fill() + draw.string(message, 0, 60) + self._yes.draw() + self._no.draw() + mute(False) + self.active = True - wasp.watch.drawable.fill(1) - wasp.watch.drawable.string(message, 0, 60) - wasp.watch.drawable.blit(icons.yes_button, 20, 100) - wasp.watch.drawable.blit(icons.no_button, 120, 100) def touch(self, event): if not self.active: return False - x = event[1] - y = event[2] - - if y >= 80 and y < 180: + if self._yes.touch(event): self.active = False - self.value = x < 120 + self.value = True + return True + elif self._no.touch(event): + self.active = False + self.value = False return True return False