disable KeyboardWidget to stop propagating events when not needed
parent
3e9feb2ffc
commit
40ead965c0
|
|
@ -116,6 +116,14 @@ class KeyWidget:
|
||||||
def setColor(self, color):
|
def setColor(self, color):
|
||||||
self.color = color
|
self.color = color
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
qualifiers = ["KeyboardWidget"]
|
||||||
|
if self.desc.row is not None:
|
||||||
|
qualifiers.append("matrix:{},{}".format(self.desc.row, self.desc.col))
|
||||||
|
if self.desc.layout_index != -1:
|
||||||
|
qualifiers.append("layout:{},{}".format(self.desc.layout_index, self.desc.layout_option))
|
||||||
|
return " ".join(qualifiers)
|
||||||
|
|
||||||
|
|
||||||
class EncoderWidget(KeyWidget):
|
class EncoderWidget(KeyWidget):
|
||||||
|
|
||||||
|
|
@ -138,6 +146,9 @@ class EncoderWidget(KeyWidget):
|
||||||
path.lineTo(int(self.x + self.w / 5), int(self.y + self.h - self.h / 3))
|
path.lineTo(int(self.x + self.w / 5), int(self.y + self.h - self.h / 3))
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "EncoderWidget"
|
||||||
|
|
||||||
|
|
||||||
class KeyboardWidget(QWidget):
|
class KeyboardWidget(QWidget):
|
||||||
|
|
||||||
|
|
@ -355,7 +366,8 @@ class KeyboardWidget(QWidget):
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def resizeEvent(self, ev):
|
def resizeEvent(self, ev):
|
||||||
self.update_layout()
|
if self.isEnabled():
|
||||||
|
self.update_layout()
|
||||||
|
|
||||||
def select_next(self):
|
def select_next(self):
|
||||||
""" Selects next key based on their order in the keymap """
|
""" Selects next key based on their order in the keymap """
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ class KeymapEditor(BasicEditor):
|
||||||
recreate_keyboard_keycodes(self.keyboard)
|
recreate_keyboard_keycodes(self.keyboard)
|
||||||
self.tabbed_keycodes.recreate_keycode_buttons()
|
self.tabbed_keycodes.recreate_keycode_buttons()
|
||||||
self.refresh_layer_display()
|
self.refresh_layer_display()
|
||||||
|
self.container.setEnabled(self.valid())
|
||||||
|
|
||||||
def valid(self):
|
def valid(self):
|
||||||
return isinstance(self.device, VialKeyboard)
|
return isinstance(self.device, VialKeyboard)
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,8 @@ class MainWindow(QMainWindow):
|
||||||
Unlocker.unlock(self.current_device.keyboard)
|
Unlocker.unlock(self.current_device.keyboard)
|
||||||
self.current_device.keyboard.reload()
|
self.current_device.keyboard.reload()
|
||||||
|
|
||||||
for e in [self.layout_editor, self.keymap_editor, self.firmware_flasher, self.macro_recorder, self.matrix_tester]:
|
for e in [self.layout_editor, self.keymap_editor, self.firmware_flasher, self.macro_recorder,
|
||||||
|
self.matrix_tester]:
|
||||||
e.rebuild(self.current_device)
|
e.rebuild(self.current_device)
|
||||||
|
|
||||||
def refresh_tabs(self):
|
def refresh_tabs(self):
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class MatrixTest(BasicEditor):
|
||||||
self.keyboard = device.keyboard
|
self.keyboard = device.keyboard
|
||||||
|
|
||||||
self.keyboardWidget.set_keys(self.keyboard.keys, self.keyboard.encoders)
|
self.keyboardWidget.set_keys(self.keyboard.keys, self.keyboard.encoders)
|
||||||
|
self.keyboardWidget.setEnabled(self.valid())
|
||||||
|
|
||||||
def valid(self):
|
def valid(self):
|
||||||
# Check if vial protocol is v3 or later
|
# Check if vial protocol is v3 or later
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue