1
0
Fork 0
mirror of synced 2024-06-17 10:04:43 +12:00

Lgndr: Add 'repair_and_update' argument in InstallOptionsModel

This commit is contained in:
loathingKernel 2022-07-11 20:11:34 +03:00
parent aeb149a3e9
commit b4a1efa357
4 changed files with 9 additions and 6 deletions

View file

@ -332,7 +332,7 @@ class InstallInfoWorker(QRunnable):
order_opt=self.dl_item.options.order_opt,
# dl_timeout=,
repair_mode=self.dl_item.options.repair_mode,
# repair_and_update=True,
repair_and_update=self.dl_item.options.repair_and_update,
ignore_space=self.dl_item.options.ignore_space,
# disable_delta=,
# override_delta_manifest=,

View file

@ -4,7 +4,7 @@ from typing import Callable, List
from .api_monkeys import get_boolean_choice
"""
@dataclass(kw_only=True)
class LgndrCommonArgs:
# keep this here for future reference
@ -12,6 +12,7 @@ class LgndrCommonArgs:
app_name: str
platform: str = "Windows"
yes: bool = False
"""
@dataclass

View file

@ -2,10 +2,9 @@ import functools
import os
import logging
import time
from typing import Optional, Union, overload
from typing import Optional, Union
import legendary.cli
from PyQt5.QtWidgets import QLabel, QMessageBox
from legendary.cli import logger
from legendary.models.downloading import AnalysisResult, ConditionCheckResult
from legendary.models.game import Game, InstalledGame, VerifyResult
@ -16,7 +15,7 @@ from .core import LegendaryCore
from .manager import DLManager
from .api_arguments import LgndrInstallGameArgs, LgndrImportGameArgs, LgndrVerifyGameArgs
from .api_exception import LgndrException, LgndrLogHandler
from .api_monkeys import return_exit, get_boolean_choice
from .api_monkeys import return_exit as exit, get_boolean_choice
class LegendaryCLI(legendary.cli.LegendaryCLI):
@ -36,7 +35,7 @@ class LegendaryCLI(legendary.cli.LegendaryCLI):
@functools.wraps(func)
def inner(self, args, *oargs, **kwargs):
old_exit = legendary.cli.exit
legendary.cli.exit = return_exit
legendary.cli.exit = exit
old_choice = legendary.cli.get_boolean_choice
if hasattr(args, 'get_boolean_choice') and args.get_boolean_choice is not None:
@ -64,6 +63,7 @@ class LegendaryCLI(legendary.cli.LegendaryCLI):
args.repair_mode = True
repair_file = None
# Rare: The 'args.no_install' flags is set externally from the InstallDialog
if args.repair_mode:
args.repair_mode = True
args.no_install = args.repair_and_update is False
@ -230,6 +230,7 @@ class LegendaryCLI(legendary.cli.LegendaryCLI):
def uninstall_game(self, args):
super(LegendaryCLI, self).uninstall_game(args)
@wrapped
def verify_game(self, args: Union[LgndrVerifyGameArgs, LgndrInstallGameArgs], print_command=True, repair_mode=False, repair_online=False):
args.app_name = self._resolve_aliases(args.app_name)
if not self.core.is_installed(args.app_name):

View file

@ -17,6 +17,7 @@ class InstallOptionsModel:
shared_memory: int = 1024
max_workers: int = os.cpu_count() * 2
repair_mode: bool = False
repair_and_update: bool = False
no_install: bool = False
ignore_space: bool = False
force: bool = False