From 6716fbc7a1ec5d14887d54b7d0286a149d15d46a Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 13 Aug 2023 10:45:56 +0200 Subject: Added a sleep function in the keyboard --- src/skeleton.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/skeleton.py') diff --git a/src/skeleton.py b/src/skeleton.py index 8497d34..1e4a03a 100644 --- a/src/skeleton.py +++ b/src/skeleton.py @@ -42,6 +42,9 @@ class Configuration(object): # Set the application available in the menu by default self.visible = True + + self.is_layout = True + self.Action = namedtuple("Action", ("name", "callback", "color")) self.title = title self.keys = { @@ -88,10 +91,16 @@ class Handler(object): 9 : None, 10 : None, 11 : None, } - self.options = configuration.group + self.stack(configuration) + def stack(self, configuration): + """ Add a new configuration on top of an existing one + """ + self.group = displayio.Group() self.name = configuration.title + self.options = configuration.group + for index, value in configuration.keys.items(): if value is None: continue @@ -112,6 +121,7 @@ class Handler(object): self._update_tick() self.macropad.pixels.show() + def _update_tick(self): self.next_tick = ticks.add( ticks_ms(), @@ -162,8 +172,7 @@ class Handler(object): self.macropad.consumer_control.release() self.macropad.mouse.release_all() self.macropad.stop_tone() - for key in range(12): - self._set_color(key, False) + self.macropad.pixels.fill((0, 0, 0)) self.macropad.pixels.show() self.macropad.display.refresh() -- cgit v1.2.3