From c000ca267c42f2f3e5624a00e065a37eec3064cf Mon Sep 17 00:00:00 2001 From: wevsty Date: Sat, 5 Oct 2024 23:02:14 +0800 Subject: [PATCH] handle indicator key --- client/main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/main.py b/client/main.py index 9666691..6a021b3 100644 --- a/client/main.py +++ b/client/main.py @@ -206,7 +206,7 @@ def __init__(self, parent: Optional[QWidget] = None): # 定时检查控制器连接 self.device_check_timer = QTimer() self.device_check_timer.timeout.connect(self.controller_device_check_connection) - self.device_check_timer.start(1000) + self.device_check_timer.start(10000) # 视频设备 self.video_device: QMediaDevices | None = None @@ -1622,7 +1622,17 @@ def keyPressEvent(self, event: QKeyEvent) -> None: return if self.status["pause_keyboard"] is True: return + # 如果是状态键则更新状态buffer + if keyboard_key == Qt.Key.Key_CapsLock: + self.keyboard_indicator_lights.caps_lock = not self.keyboard_indicator_lights.caps_lock + elif keyboard_key == Qt.Key.Key_ScrollLock: + self.keyboard_indicator_lights.scroll_lock = not self.keyboard_indicator_lights.scroll_lock + elif keyboard_key == Qt.Key.Key_NumLock: + self.keyboard_indicator_lights.num_lock = not self.keyboard_indicator_lights.num_lock + else: + pass self.update_keyboard_buffer_with_scancode(event.nativeScanCode(), KeyStateEnum.PRESS) + self.update_status_bar() super().keyPressEvent(event) # 键盘松开事件