Skip to content

Commit

Permalink
handle indicator key
Browse files Browse the repository at this point in the history
  • Loading branch information
wevsty committed Oct 5, 2024
1 parent a88ae33 commit c000ca2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

# 键盘松开事件
Expand Down

0 comments on commit c000ca2

Please sign in to comment.