Skip to content

Commit

Permalink
RareCore: Fix a problem with dialogs spawning multiple times.
Browse files Browse the repository at this point in the history
RareCore was connecting RareGames to the same signals
multiple times when the library was refreshed.
  • Loading branch information
loathingKernel committed Nov 28, 2023
1 parent 110ea51 commit d6809c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions rare/shared/rare_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def __create_or_update_rgame(self, game: Game) -> RareGame:
rgame.update_rgame()
else:
rgame = RareGame(self.__core, self.__image_manager, game)
self.__add_game(rgame)
return rgame

def __add_games_and_dlcs(self, games: List[Game], dlcs_dict: Dict[str, List]) -> None:
Expand All @@ -247,14 +248,18 @@ def __add_games_and_dlcs(self, games: List[Game], dlcs_dict: Dict[str, List]) ->
if game_dlcs := dlcs_dict.get(rgame.game.catalog_item_id, False):
for dlc in game_dlcs:
rdlc = self.__create_or_update_rgame(dlc)
rgame.add_dlc(rdlc)
self.__add_game(rdlc)
self.__add_game(rgame)
if rdlc not in rgame.owned_dlcs:
rgame.add_dlc(rdlc)
# lk: since loading has to know about game state,
# validate installation just adding each RareGamesu
# TODO: this should probably be moved into RareGame
if rgame.is_installed and not (rgame.is_dlc or rgame.is_non_asset):
self.__validate_install(rgame)
try:
self.__validate_install(rgame)
except FileNotFoundError as e:
logger.info(f'Marking "{rgame.app_title}" as not installed because an exception has occurred...')
logger.error(e)
rgame.set_installed(False)
self.progress.emit(int(idx/length * 80) + 20, self.tr("Loaded <b>{}</b>").format(rgame.app_title))

@pyqtSlot(object, int)
Expand Down

0 comments on commit d6809c2

Please sign in to comment.