From c59516fc601e6e8784ee6a9de3635f781c0d0b01 Mon Sep 17 00:00:00 2001 From: Nix <75538775+nixietab@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:47:38 -0300 Subject: [PATCH] keyboard support added --- picodulce.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/picodulce.py b/picodulce.py index 6c21aa9..232fba1 100644 --- a/picodulce.py +++ b/picodulce.py @@ -114,6 +114,20 @@ class PicomcVersionSelector(QWidget): self.setLayout(main_layout) + def keyPressEvent(self, event): + focus_widget = self.focusWidget() + if event.key() == Qt.Key_Down: + self.focusNextChild() # Move focus to the next widget + elif event.key() == Qt.Key_Up: + self.focusPreviousChild() # Move focus to the previous widget + elif event.key() in [Qt.Key_Return, Qt.Key_Enter]: + if isinstance(focus_widget, QPushButton): + focus_widget.click() # Trigger the button click + elif isinstance(focus_widget, QComboBox): + focus_widget.showPopup() # Show dropdown for combo box + else: + super().keyPressEvent(event) + def check_config_file(self): config_path = "config.json" default_config = { @@ -1071,6 +1085,8 @@ class ModLoaderAndVersionMenu(QDialog): logging.error(error_message) + + if __name__ == '__main__': app = QApplication(sys.argv) current_date = datetime.now()