1
0
Fork 0
mirror of synced 2024-06-02 18:54:41 +12:00

DownloadThread: Use clean_post_install instead of local copy

InstallDialog: Handly empty `config_tags`
Lgndr: Cleanup
This commit is contained in:
loathingKernel 2022-08-01 10:30:31 +03:00
parent e5c7b029ff
commit 5ac71e99f0
4 changed files with 12 additions and 31 deletions

View file

@ -176,8 +176,9 @@ class InstallDialog(QDialog, Ui_InstallDialog):
if tag == "__required":
cb.setChecked(True)
cb.setDisabled(True)
if all(elem in self.config_tags for elem in info["tags"]):
cb.setChecked(True)
if self.config_tags is not None:
if all(elem in self.config_tags for elem in info["tags"]):
cb.setChecked(True)
self.sdl_list_layout.addWidget(cb)
self.sdl_list_cbs.append(cb)
self.sdl_list_frame.resize(self.sdl_list_frame.minimumSize())

View file

@ -11,7 +11,7 @@ from PyQt5.QtCore import QThread, pyqtSignal, QProcess
from legendary.core import LegendaryCore
from legendary.models.downloading import WriterTask
from rare.shared import GlobalSignalsSingleton
from rare.shared import GlobalSignalsSingleton, LegendaryCLISingleton
from rare.models.install import InstallQueueItemModel
from rare.utils.misc import create_desktop_link
from rare.lgndr.downloading import UIUpdate
@ -139,7 +139,6 @@ class DownloadThread(QThread):
self.status.emit("dl_finished")
end_t = time.time()
logger.info(f"Download finished in {end_t - start_time}s")
game = self.core.get_game(self.item.download.igame.app_name)
if self.item.options.overlay:
self.signals.overlay_installation_finished.emit()
@ -163,28 +162,18 @@ class DownloadThread(QThread):
"Manually installing DLCs works the same; just use the DLC app name instead."
)
# install_dlcs = QMessageBox.question(self, "", "Do you want to install the prequisites", QMessageBox.Yes|QMessageBox.No) == QMessageBox.Yes
# TODO
if game.supports_cloud_saves and not game.is_dlc:
if self.item.download.game.supports_cloud_saves and not self.item.download.game.is_dlc:
logger.info(
'This game supports cloud saves, syncing is handled by the "sync-saves" command.'
)
logger.info(
f'To download saves for this game run "legendary sync-saves {game.app_name}"'
f'To download saves for this game run "legendary sync-saves {self.item.download.game.app_name}"'
)
old_igame = self.core.get_installed_game(game.app_name)
if old_igame and self.item.download.repair and os.path.exists(self.item.download.repair_file):
if old_igame.needs_verification:
old_igame.needs_verification = False
self.core.install_game(old_igame)
logger.debug("Removing repair file.")
os.remove(self.item.download.repair_file)
if old_igame and old_igame.install_tags != self.item.download.igame.install_tags:
old_igame.install_tags = self.item.download.igame.install_tags
logger.info("Deleting now untagged files.")
self.core.uninstall_tag(old_igame)
self.core.install_game(old_igame)
LegendaryCLISingleton().clean_post_install(
self.item.download.game, self.item.download.igame,
self.item.download.repair, self.item.download.repair_file
)
if not self.item.options.update and self.item.options.create_shortcut:
if not create_desktop_link(self.item.options.app_name, self.core, "desktop"):

View file

@ -7,7 +7,7 @@ from typing_extensions import Protocol
class GetBooleanChoiceProtocol(Protocol):
def __call__(self, prompt: str, default: bool = ...) -> bool:
pass
...
def get_boolean_choice(prompt: str, default: bool = True) -> bool:
@ -18,15 +18,6 @@ def verify_stdout(a0: int, a1: int, a2: float, a3: float) -> None:
print(f"Verification progress: {a0}/{a1} ({a2:.01f}%) [{a3:.1f} MiB/s]\t\r")
class UILogHandler(logging.Handler):
def __init__(self, dest: QLabel):
super(UILogHandler, self).__init__()
self.widget = dest
def emit(self, record: logging.LogRecord) -> None:
self.widget.setText(record.getMessage())
@dataclass
class LgndrIndirectStatus:
success: bool = False

View file

@ -108,7 +108,7 @@ class VerifyWorker(QRunnable):
args, print_command=False, repair_mode=repair_mode, repair_online=not self.args.offline
)
if result is None:
# lk: second pass with the latest manifest
# lk: second pass with downloading the latest manifest
# lk: this happens if the manifest was not found and repair_mode was not requested
# lk: we already have checked if the directory exists before starting the worker
try: