async def _browse_for_game_session(self): if await self._game_session_active(): return if not await self._ensure_logged_in(): return network_client = self.network_client browser = GameSessionBrowserDialog(network_client) try: result = await wait_dialog.cancellable_wait( self, asyncio.ensure_future(browser.refresh()), "Communicating", "Requesting the session list...", ) except asyncio.CancelledError: return if not result: return if await async_dialog.execute_dialog(browser) == browser.Accepted: self.game_session_window = await GameSessionWindow.create_and_update( network_client, common_qt_lib.get_game_connection(), self.preset_manager, self.window_manager, self.options, ) if self.game_session_window is not None: self.game_session_window.show()
async def _browse_for_game_session(self): if await self._game_session_active(): return if not await self._ensure_logged_in(): return network_client = self.network_client browser = GameSessionBrowserDialog(network_client) await browser.refresh() if await async_dialog.execute_dialog(browser) == browser.Accepted: self.game_session_window = await GameSessionWindow.create_and_update( network_client, common_qt_lib.get_game_connection(), self.preset_manager, self, self._options) if self.game_session_window is not None: self.game_session_window.show()
async def _host_game_session(self): if await self._game_session_active(): return if not await self._ensure_logged_in(): return dialog = QInputDialog(self) dialog.setModal(True) dialog.setWindowTitle("Enter session name") dialog.setLabelText("Select a name for the session:") if await async_dialog.execute_dialog(dialog) != dialog.Accepted: return await self.network_client.create_new_session(dialog.textValue()) self.game_session_window = await GameSessionWindow.create_and_update( self.network_client, common_qt_lib.get_game_connection(), self.preset_manager, self, self._options) if self.game_session_window is not None: self.game_session_window.show()
def _open_auto_tracker(self): from randovania.gui.auto_tracker_window import AutoTrackerWindow self.auto_tracker_window = AutoTrackerWindow( common_qt_lib.get_game_connection(), self._options) self.auto_tracker_window.show()
def test_get_game_connection(skip_qtbot, qapp): qapp.game_connection = MagicMock() assert common_qt_lib.get_game_connection() is qapp.game_connection