From 2dd3c2bc0aab9f8e688fcdaf335a9faba2888e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ribeiro=20Bezerra?= Date: Wed, 25 Oct 2023 18:40:00 +0100 Subject: [PATCH] Improve character id search --- src/TSHGameAssetManager.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/TSHGameAssetManager.py b/src/TSHGameAssetManager.py index 704519c87..fb2a466a8 100644 --- a/src/TSHGameAssetManager.py +++ b/src/TSHGameAssetManager.py @@ -439,6 +439,14 @@ def run(self): self.assetsLoaderThread.lock = self.assetsLoaderLock self.assetsLoaderThread.start(QThread.Priority.HighestPriority) + # Setup startgg chacter id to character name + sggcharacters = json.loads( + open('./assets/characters.json', 'r').read()) + self.startgg_id_to_character = {} + + for c in sggcharacters.get("entities", {}).get("character", []): + self.startgg_id_to_character[str(c.get("id"))] = c + # self.programState["asset_path"] = self.selectedGame.get("path") # self.programState["game"] = game @@ -573,14 +581,6 @@ def UpdateCharacterModel(self): self.characterModel.appendRow(item) self.characterModel.sort(0) - - # Setup startgg chacter id to character name - sggcharacters = json.loads( - open('./assets/characters.json', 'r').read()) - self.startgg_id_to_character = {} - - for c in sggcharacters.get("entities", {}).get("character", []): - self.startgg_id_to_character[str(c.get("id"))] = c except: logger.error(traceback.format_exc())