From f44905020acd8367b5c88247c7f13c19de449bf3 Mon Sep 17 00:00:00 2001 From: Zash Date: Thu, 28 Sep 2023 15:12:43 +0200 Subject: [PATCH] Fix for latest master changes (BasicModDataChecker) --- games/game_cyberpunk2077.py | 43 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/games/game_cyberpunk2077.py b/games/game_cyberpunk2077.py index b15a5b6..90a01b5 100644 --- a/games/game_cyberpunk2077.py +++ b/games/game_cyberpunk2077.py @@ -13,7 +13,7 @@ import mobase -from ..basic_features import BasicModDataChecker +from ..basic_features import BasicModDataChecker, GlobPatterns from ..basic_features.basic_save_game_info import ( BasicGameSaveGame, BasicGameSaveGameInfo, @@ -22,21 +22,24 @@ class CyberpunkModDataChecker(BasicModDataChecker): - default_file_patterns = { - "valid": ["root", "archive", "mods"], - "move": { - # archive and ArchiveXL - "*.archive": "archive/pc/mod", - "*.xl": "archive/pc/mod", - "bin": "root/", # CET, red4ext - # redscript - "engine": "root/", - "r6": "root/", - "red4ext": "root/", - # redmod - # "*": "mods", - }, - } + def __init__(self): + super().__init__( + GlobPatterns( + valid=["root", "archive", "mods"], + move={ + # archive and ArchiveXL + "*.archive": "archive/pc/mod", + "*.xl": "archive/pc/mod", + "bin": "root/", # CET, red4ext + # redscript + "engine": "root/", + "r6": "root/", + "red4ext": "root/", + # redmod + # "*": "mods", + }, + ) + ) def dataLooksValid( self, filetree: mobase.IFileTree @@ -52,11 +55,11 @@ def dataLooksValid( return self.CheckReturn.FIXABLE return res - def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree | None: + def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree: # Check for correct redmod format tree = super().fix(filetree) or filetree for entry in tree: - if not self._regex["valid"].match( + if not self._regex_patterns.valid.match( entry.name().casefold() ) and self._valid_redmod(entry): tree.move(entry, "mods/") @@ -127,7 +130,7 @@ def init(self, organizer: mobase.IOrganizer) -> bool: ) self._featureMap[mobase.ModDataChecker] = CyberpunkModDataChecker() - def ui_init(window): + def ui_init(window: QMainWindow): self._qwindow = window self._set_root_builder_settings() @@ -254,7 +257,7 @@ def executables(self) -> list[mobase.ExecutableInfo]: else "" ) redmod_installed = self._is_redmod_installed() - execs = [] + execs: list[mobase.ExecutableInfo] = [] if redmod_installed: # Game with redmod execs.append(