diff --git a/portprotonqt/game_library_manager.py b/portprotonqt/game_library_manager.py index b5ca36f..61f8158 100644 --- a/portprotonqt/game_library_manager.py +++ b/portprotonqt/game_library_manager.py @@ -35,6 +35,7 @@ class MainWindowProtocol(Protocol): _last_card_width: int current_hovered_card: GameCard | None current_focused_card: GameCard | None + gamesListWidget: QWidget | None class GameLibraryManager: def __init__(self, main_window: MainWindowProtocol, theme, context_menu_manager: ContextMenuManager | None): diff --git a/portprotonqt/input_manager.py b/portprotonqt/input_manager.py index 1e6d918..5217e8b 100644 --- a/portprotonqt/input_manager.py +++ b/portprotonqt/input_manager.py @@ -597,6 +597,9 @@ class InputManager(QObject): def handle_dpad_slot(self, code: int, value: int, current_time: float) -> None: if not self._gamepad_handling_enabled: return + if not hasattr(self._parent, 'gamesListWidget') or self._parent.gamesListWidget is None: + logger.error("gamesListWidget not available yet, skipping D-pad navigation") + return try: app = QApplication.instance() diff --git a/portprotonqt/main_window.py b/portprotonqt/main_window.py index 04e1af0..4b3f918 100644 --- a/portprotonqt/main_window.py +++ b/portprotonqt/main_window.py @@ -769,6 +769,7 @@ class MainWindow(QMainWindow): def createInstalledTab(self): self.gamesLibraryWidget = self.game_library_manager.create_games_library_widget() self.stackedWidget.addWidget(self.gamesLibraryWidget) + self.gamesListWidget = self.game_library_manager.gamesListWidget self.game_library_manager.update_game_grid() def resizeEvent(self, event):