1
0
Fork 0
mirror of synced 2024-06-26 18:20:50 +12:00

Fix --skip-update-check option for launch helper

This commit is contained in:
lennard 2022-10-01 00:44:37 +02:00
parent e6bbb2035b
commit 4cadc263e6
No known key found for this signature in database
GPG key ID: AB6010FE63C7C2B1
3 changed files with 11 additions and 8 deletions

View file

@ -51,8 +51,6 @@ def main():
metavar="<App Name>", action="store")
launch_minimal_parser.add_argument("--offline", help="Launch game offline",
action="store_true")
launch_minimal_parser.add_argument("--skip_update_check", help="Do not check for updates",
action="store_true")
launch_minimal_parser.add_argument('--wine-bin', dest='wine_bin', action='store', metavar='<wine binary>',
default=os.environ.get('LGDRY_WINE_BINARY', None),
help='Set WINE binary to use to launch the app')
@ -61,6 +59,8 @@ def main():
help='Set WINE prefix to use')
launch_minimal_parser.add_argument("--ask-alyways-sync", help="Ask for cloud saves",
action="store_true")
launch_minimal_parser.add_argument("--skip-update-check", help="Do not check for updates",
action="store_true")
args = parser.parse_args()

View file

@ -32,16 +32,17 @@ class PreLaunchThread(QRunnable):
self.core = core
self.app_name = args.app_name
self.signals = self.Signals()
self.args = args
def run(self) -> None:
args = self.prepare_launch(self.app_name)
args = self.prepare_launch(self.args)
if not args:
return
self.signals.ready_to_launch.emit(args)
def prepare_launch(self, app_name) -> Union[LaunchArgs, None]:
def prepare_launch(self, args: InitArgs) -> Union[LaunchArgs, None]:
try:
args = get_launch_args(self.core, InitArgs(app_name))
args = get_launch_args(self.core, args)
except Exception as e:
self.signals.error_occurred.emit(str(e))
return None

View file

@ -23,17 +23,18 @@ class InitArgs:
app_name: str
debug: bool = False
offline: bool = False
skip_version_check: bool = False
skip_update_check: bool = False
wine_prefix: str = ""
wine_bin: str = ""
@classmethod
def from_argparse(cls, args):
print(args.skip_update_check)
return cls(
app_name=args.app_name,
debug=args.debug,
offline=args.offline,
skip_version_check=args.skip_update_check,
skip_update_check=args.skip_update_check,
wine_bin=args.wine_bin,
wine_prefix=args.wine_pfx,
)
@ -81,7 +82,8 @@ def get_origin_params(core: LegendaryCore, app_name, offline: bool,
def get_game_params(core: LegendaryCore, igame: InstalledGame, args: InitArgs,
launch_args: LaunchArgs) -> LaunchArgs:
if not args.offline: # skip for update
if not args.skip_version_check and not core.is_noupdate_game(igame.app_name):
if not args.skip_update_check and not core.is_noupdate_game(igame.app_name):
print("Checking for updates...")
# check updates
try:
latest = core.get_asset(