Fix --skip-update-check option for launch helper
This commit is contained in:
parent
e6bbb2035b
commit
4cadc263e6
3 changed files with 11 additions and 8 deletions
|
@ -51,8 +51,6 @@ def main():
|
||||||
metavar="<App Name>", action="store")
|
metavar="<App Name>", action="store")
|
||||||
launch_minimal_parser.add_argument("--offline", help="Launch game offline",
|
launch_minimal_parser.add_argument("--offline", help="Launch game offline",
|
||||||
action="store_true")
|
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>',
|
launch_minimal_parser.add_argument('--wine-bin', dest='wine_bin', action='store', metavar='<wine binary>',
|
||||||
default=os.environ.get('LGDRY_WINE_BINARY', None),
|
default=os.environ.get('LGDRY_WINE_BINARY', None),
|
||||||
help='Set WINE binary to use to launch the app')
|
help='Set WINE binary to use to launch the app')
|
||||||
|
@ -61,6 +59,8 @@ def main():
|
||||||
help='Set WINE prefix to use')
|
help='Set WINE prefix to use')
|
||||||
launch_minimal_parser.add_argument("--ask-alyways-sync", help="Ask for cloud saves",
|
launch_minimal_parser.add_argument("--ask-alyways-sync", help="Ask for cloud saves",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
launch_minimal_parser.add_argument("--skip-update-check", help="Do not check for updates",
|
||||||
|
action="store_true")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,17 @@ class PreLaunchThread(QRunnable):
|
||||||
self.core = core
|
self.core = core
|
||||||
self.app_name = args.app_name
|
self.app_name = args.app_name
|
||||||
self.signals = self.Signals()
|
self.signals = self.Signals()
|
||||||
|
self.args = args
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
args = self.prepare_launch(self.app_name)
|
args = self.prepare_launch(self.args)
|
||||||
if not args:
|
if not args:
|
||||||
return
|
return
|
||||||
self.signals.ready_to_launch.emit(args)
|
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:
|
try:
|
||||||
args = get_launch_args(self.core, InitArgs(app_name))
|
args = get_launch_args(self.core, args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.signals.error_occurred.emit(str(e))
|
self.signals.error_occurred.emit(str(e))
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -23,17 +23,18 @@ class InitArgs:
|
||||||
app_name: str
|
app_name: str
|
||||||
debug: bool = False
|
debug: bool = False
|
||||||
offline: bool = False
|
offline: bool = False
|
||||||
skip_version_check: bool = False
|
skip_update_check: bool = False
|
||||||
wine_prefix: str = ""
|
wine_prefix: str = ""
|
||||||
wine_bin: str = ""
|
wine_bin: str = ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_argparse(cls, args):
|
def from_argparse(cls, args):
|
||||||
|
print(args.skip_update_check)
|
||||||
return cls(
|
return cls(
|
||||||
app_name=args.app_name,
|
app_name=args.app_name,
|
||||||
debug=args.debug,
|
debug=args.debug,
|
||||||
offline=args.offline,
|
offline=args.offline,
|
||||||
skip_version_check=args.skip_update_check,
|
skip_update_check=args.skip_update_check,
|
||||||
wine_bin=args.wine_bin,
|
wine_bin=args.wine_bin,
|
||||||
wine_prefix=args.wine_pfx,
|
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,
|
def get_game_params(core: LegendaryCore, igame: InstalledGame, args: InitArgs,
|
||||||
launch_args: LaunchArgs) -> LaunchArgs:
|
launch_args: LaunchArgs) -> LaunchArgs:
|
||||||
if not args.offline: # skip for update
|
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
|
# check updates
|
||||||
try:
|
try:
|
||||||
latest = core.get_asset(
|
latest = core.get_asset(
|
||||||
|
|
Loading…
Reference in a new issue