async def _setup_locations_combo(self): network_client = common_qt_lib.get_network_client() game_session = network_client.current_game_session user = network_client.current_user game = self.game index_to_name = { node.pickup_index.index: game.world_list.area_name(area) for world, area, node in game.world_list.all_worlds_areas_nodes if isinstance(node, PickupNode) } if game_session is None: names = index_to_name else: patcher_data = await network_client.session_admin_player( user.id, SessionAdminUserAction.CREATE_PATCHER_FILE, CosmeticPatches().as_json) names = { pickup["pickup_index"]: "{}: {}".format(index_to_name[pickup["pickup_index"]], pickup["hud_text"][0]) for pickup in patcher_data["pickups"] } self.collect_location_combo.clear() for index, name in sorted(names.items()): self.collect_location_combo.addItem(name, index) self.collect_location_button.setEnabled(True) self.collect_location_combo.setVisible(True) self.setup_collect_location_combo_button.deleteLater()
def test_get_network_client(skip_qtbot, qapp): qapp.network_client = MagicMock() assert common_qt_lib.get_network_client() is qapp.network_client