commit
bc438fb130
|
|
@ -357,9 +357,9 @@ class KeyboardWidget(QWidget):
|
||||||
""" Returns key, hit_masked_part """
|
""" Returns key, hit_masked_part """
|
||||||
|
|
||||||
for key in self.widgets:
|
for key in self.widgets:
|
||||||
if key.masked and key.mask_polygon.containsPoint(pos, Qt.OddEvenFill):
|
if key.masked and key.mask_polygon.containsPoint(pos/self.scale, Qt.OddEvenFill):
|
||||||
return key, True
|
return key, True
|
||||||
if key.polygon.containsPoint(pos, Qt.OddEvenFill):
|
if key.polygon.containsPoint(pos/self.scale, Qt.OddEvenFill):
|
||||||
return key, False
|
return key, False
|
||||||
|
|
||||||
return None, False
|
return None, False
|
||||||
|
|
@ -414,3 +414,6 @@ class KeyboardWidget(QWidget):
|
||||||
|
|
||||||
def set_scale(self, scale):
|
def set_scale(self, scale):
|
||||||
self.scale = scale
|
self.scale = scale
|
||||||
|
|
||||||
|
def get_scale(self):
|
||||||
|
return self.scale
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,14 @@ class KeymapEditor(BasicEditor):
|
||||||
self.layout_editor = layout_editor
|
self.layout_editor = layout_editor
|
||||||
|
|
||||||
self.layout_layers = QHBoxLayout()
|
self.layout_layers = QHBoxLayout()
|
||||||
|
self.layout_size = QVBoxLayout()
|
||||||
layer_label = QLabel(tr("KeymapEditor", "Layer"))
|
layer_label = QLabel(tr("KeymapEditor", "Layer"))
|
||||||
|
|
||||||
layout_labels_container = QHBoxLayout()
|
layout_labels_container = QHBoxLayout()
|
||||||
layout_labels_container.addWidget(layer_label)
|
layout_labels_container.addWidget(layer_label)
|
||||||
layout_labels_container.addLayout(self.layout_layers)
|
layout_labels_container.addLayout(self.layout_layers)
|
||||||
layout_labels_container.addStretch()
|
layout_labels_container.addStretch()
|
||||||
|
layout_labels_container.addLayout(self.layout_size)
|
||||||
|
|
||||||
# contains the actual keyboard
|
# contains the actual keyboard
|
||||||
self.container = KeyboardWidget(layout_editor)
|
self.container = KeyboardWidget(layout_editor)
|
||||||
|
|
@ -83,6 +85,20 @@ class KeymapEditor(BasicEditor):
|
||||||
btn.clicked.connect(lambda state, idx=x: self.switch_layer(idx))
|
btn.clicked.connect(lambda state, idx=x: self.switch_layer(idx))
|
||||||
self.layout_layers.addWidget(btn)
|
self.layout_layers.addWidget(btn)
|
||||||
self.layer_buttons.append(btn)
|
self.layer_buttons.append(btn)
|
||||||
|
for x in range(0,2):
|
||||||
|
btn = SquareButton("-") if x else SquareButton("+")
|
||||||
|
btn.setFocusPolicy(Qt.NoFocus)
|
||||||
|
btn.setCheckable(False)
|
||||||
|
btn.clicked.connect(lambda state, idx=x: self.adjust_size(idx))
|
||||||
|
self.layout_size.addWidget(btn)
|
||||||
|
self.layer_buttons.append(btn)
|
||||||
|
|
||||||
|
def adjust_size(self, minus):
|
||||||
|
if minus:
|
||||||
|
self.container.set_scale(self.container.get_scale() - 0.1)
|
||||||
|
else:
|
||||||
|
self.container.set_scale(self.container.get_scale() + 0.1)
|
||||||
|
self.refresh_layer_display()
|
||||||
|
|
||||||
def rebuild(self, device):
|
def rebuild(self, device):
|
||||||
super().rebuild(device)
|
super().rebuild(device)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue