diff options
| author | sbahling <sbahling@mudgum.net> | 2018-10-22 18:49:07 +0200 |
|---|---|---|
| committer | sbahling <sbahling@mudgum.net> | 2018-10-22 18:49:07 +0200 |
| commit | cee18857433a3d5cc1d5b57a97872bbd7b6cf021 (patch) | |
| tree | 030f68d1dec12cb9c69c59c2801859c369627bda /console.py | |
| parent | 800e07c6f323d634b1d7e99007626d0c1f2d1c3d (diff) | |
| download | tascam-fw-osc-cee18857433a3d5cc1d5b57a97872bbd7b6cf021.tar.gz tascam-fw-osc-cee18857433a3d5cc1d5b57a97872bbd7b6cf021.tar.xz tascam-fw-osc-cee18857433a3d5cc1d5b57a97872bbd7b6cf021.zip | |
Access console button state from another button
Create lookup table of console buttons by button name,
Diffstat (limited to 'console.py')
| -rw-r--r-- | console.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -99,12 +99,21 @@ class Console(): self.more_banks_up = False self.more_banks_down = False self.strips = strips.init_strips(self) - self.buttons = fw_1884_buttons.init_buttons(self) + self.buttons = {} + self.init_buttons() self.unit.connect('control', self.handle_control) self.status_thread = RunningStatusThread(self) # noqa F841 + def init_buttons(self): + self.button_map = fw_1884_buttons.init_buttons(self) + for index, items in self.button_map.items(): + for item in items: + if item is None: + continue + self.buttons[item.name] = item + @property def status(self): try: @@ -119,7 +128,7 @@ class Console(): bits = reversed(bits32(changed)) for bit in [i for i, b in enumerate(bits) if int(b)]: high = bool(after & (0b1 << bit)) - button = self.buttons[index][int(bit)] + button = self.button_map[index][int(bit)] if button is None: print('unhandled control bit {}:{}'.format(index, bit)) continue |
