diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2023-08-13 10:45:56 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2023-08-13 10:46:58 +0200 |
commit | 6716fbc7a1ec5d14887d54b7d0286a149d15d46a (patch) | |
tree | 4b79c10ce838142ae9ac41222fd73d99aeba5228 /src/skeleton.py | |
parent | 7357e1f9671cbaef34fc934ce52b78f25c74f34e (diff) |
Added a sleep function in the keyboard
Diffstat (limited to 'src/skeleton.py')
-rw-r--r-- | src/skeleton.py | 15 |
1 files changed, 12 insertions, 3 deletions
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() |