diff --git a/src/main/python/constants.py b/src/main/python/constants.py index c38f46e..224eafb 100644 --- a/src/main/python/constants.py +++ b/src/main/python/constants.py @@ -2,7 +2,13 @@ KEY_WIDTH = 40 KEY_HEIGHT = KEY_WIDTH KEY_SPACING = 4 +KEYCODE_BTN_WIDTH = 50 +KEYCODE_BTN_HEIGHT = KEYCODE_BTN_WIDTH + WINDOW_WIDTH, WINDOW_HEIGHT = 1024, 768 LAYER_BTN_STYLE = "border: 1px solid black; padding: 5px" ACTIVE_LAYER_BTN_STYLE = "border: 1px solid black; padding: 5px; background-color: black; color: white" + +KEY_NORMAL_STYLE = "background-color:white; border: 1px solid black" +KEY_ACTIVE_STYLE = "background-color:black; color: white; border: 1px solid black" diff --git a/src/main/python/keyboard_container.py b/src/main/python/keyboard_container.py index 2ed2c7d..849c9e0 100644 --- a/src/main/python/keyboard_container.py +++ b/src/main/python/keyboard_container.py @@ -5,7 +5,8 @@ from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QVBoxLayout from clickable_label import ClickableLabel from keycodes import keycode_label, keycode_tooltip -from constants import KEY_WIDTH, KEY_SPACING, KEY_HEIGHT, LAYER_BTN_STYLE, ACTIVE_LAYER_BTN_STYLE +from constants import KEY_WIDTH, KEY_SPACING, KEY_HEIGHT, LAYER_BTN_STYLE, ACTIVE_LAYER_BTN_STYLE, KEY_NORMAL_STYLE, \ + KEY_ACTIVE_STYLE from util import tr @@ -114,9 +115,9 @@ class KeyboardContainer(QWidget): text = keycode_label(code) tooltip = keycode_tooltip(code) for widget in widgets: - widget.setStyleSheet('background-color:white; border: 1px solid black') + widget.setStyleSheet(KEY_NORMAL_STYLE) if widget == self.selected_key: - widget.setStyleSheet('background-color:black; color: white; border: 1px solid black') + widget.setStyleSheet(KEY_ACTIVE_STYLE) widget.setText(text) widget.setToolTip(tooltip) diff --git a/src/main/python/tabbed_keycodes.py b/src/main/python/tabbed_keycodes.py index fa1324f..8085b4f 100644 --- a/src/main/python/tabbed_keycodes.py +++ b/src/main/python/tabbed_keycodes.py @@ -1,6 +1,7 @@ from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QTabWidget, QWidget, QPushButton +from constants import KEYCODE_BTN_WIDTH, KEYCODE_BTN_HEIGHT from flowlayout import FlowLayout from keycodes import KEYCODES_BASIC, KEYCODES_ISO, KEYCODES_MACRO, KEYCODES_LAYERS, KEYCODES_SPECIAL, keycode_tooltip from util import tr @@ -38,7 +39,7 @@ class TabbedKeycodes(QTabWidget): for keycode in keycodes: btn = QPushButton(keycode.label) - btn.setFixedSize(50, 50) + btn.setFixedSize(KEYCODE_BTN_WIDTH, KEYCODE_BTN_HEIGHT) btn.setToolTip(keycode_tooltip(keycode.code)) btn.clicked.connect(lambda st, k=keycode: self.keycode_changed.emit(k.code)) layout.addWidget(btn)