diff options
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 |
