From 90b7d109cc13e6fa84c9c472b6dddf3e9f854210 Mon Sep 17 00:00:00 2001 From: Dummerle Date: Tue, 16 Mar 2021 15:12:37 +0100 Subject: [PATCH] Use Custom legendary version, cloud saves bug --- Rare/Components/Dialogs/Login/BrowserLogin.py | 2 +- Rare/Components/Dialogs/Login/ImportWidget.py | 2 +- Rare/Components/Dialogs/Login/LoginDialog.py | 2 +- Rare/Components/Launch/LaunchDialog.py | 10 +- Rare/Components/TabWidget.py | 2 +- Rare/Components/Tabs/Account/AccountWidget.py | 2 +- Rare/Components/Tabs/CloudSaves/CloudSaves.py | 4 +- Rare/Components/Tabs/CloudSaves/SyncWidget.py | 10 +- Rare/Components/Tabs/Downloads/DownloadTab.py | 104 ++++++++++++------ .../Tabs/Games/GameInfo/GameInfo.py | 4 +- .../Tabs/Games/GameInfo/GameSettings.py | 4 +- Rare/Components/Tabs/Games/GameList.py | 4 +- .../Tabs/Games/GameWidgetInstalled.py | 4 +- .../Tabs/Games/GameWidgetListUninstalled.py | 7 +- .../Tabs/Games/GameWidgetUninstalled.py | 4 +- .../Tabs/Games/InstalledListWidget.py | 5 +- Rare/Components/Tabs/Settings/DXVK/Dxvk.py | 2 +- Rare/Components/Tabs/Settings/Legendary.py | 2 +- Rare/Components/Tabs/Settings/Linux.py | 2 +- Rare/Components/Tabs/Settings/SettingsTab.py | 4 +- Rare/utils/LegendaryApi.py | 6 +- Rare/utils/Models.py | 4 + Rare/utils/legendaryConfig.py | 15 --- Rare/utils/utils.py | 8 +- .../__init__.py | 2 +- .../api/__init__.py | 0 .../api/egs.py | 0 {custom-legendary => custom_legendary}/cli.py | 0 .../core.py | 0 .../downloader/__init__.py | 0 .../downloader/manager.py | 0 .../downloader/workers.py | 0 .../lfs/__init__.py | 0 .../lfs/egl.py | 0 .../lfs/lgndry.py | 0 .../models/__init__.py | 0 .../models/chunk.py | 0 .../models/downloading.py | 0 .../models/egl.py | 0 .../models/exceptions.py | 0 .../models/game.py | 0 .../models/json_manifest.py | 0 .../models/manifest.py | 0 .../utils/__init__.py | 0 .../utils/cli.py | 0 .../utils/custom_parser.py | 0 .../utils/game_workarounds.py | 0 .../utils/lfs.py | 0 .../utils/manifests.py | 0 .../utils/rolling_hash.py | 0 .../utils/savegame_helper.py | 0 .../utils/selective_dl.py | 0 .../utils/wine_helpers.py | 0 53 files changed, 122 insertions(+), 93 deletions(-) delete mode 100644 Rare/utils/legendaryConfig.py rename {custom-legendary => custom_legendary}/__init__.py (54%) rename {custom-legendary => custom_legendary}/api/__init__.py (100%) rename {custom-legendary => custom_legendary}/api/egs.py (100%) rename {custom-legendary => custom_legendary}/cli.py (100%) rename {custom-legendary => custom_legendary}/core.py (100%) rename {custom-legendary => custom_legendary}/downloader/__init__.py (100%) rename {custom-legendary => custom_legendary}/downloader/manager.py (100%) rename {custom-legendary => custom_legendary}/downloader/workers.py (100%) rename {custom-legendary => custom_legendary}/lfs/__init__.py (100%) rename {custom-legendary => custom_legendary}/lfs/egl.py (100%) rename {custom-legendary => custom_legendary}/lfs/lgndry.py (100%) rename {custom-legendary => custom_legendary}/models/__init__.py (100%) rename {custom-legendary => custom_legendary}/models/chunk.py (100%) rename {custom-legendary => custom_legendary}/models/downloading.py (100%) rename {custom-legendary => custom_legendary}/models/egl.py (100%) rename {custom-legendary => custom_legendary}/models/exceptions.py (100%) rename {custom-legendary => custom_legendary}/models/game.py (100%) rename {custom-legendary => custom_legendary}/models/json_manifest.py (100%) rename {custom-legendary => custom_legendary}/models/manifest.py (100%) rename {custom-legendary => custom_legendary}/utils/__init__.py (100%) rename {custom-legendary => custom_legendary}/utils/cli.py (100%) rename {custom-legendary => custom_legendary}/utils/custom_parser.py (100%) rename {custom-legendary => custom_legendary}/utils/game_workarounds.py (100%) rename {custom-legendary => custom_legendary}/utils/lfs.py (100%) rename {custom-legendary => custom_legendary}/utils/manifests.py (100%) rename {custom-legendary => custom_legendary}/utils/rolling_hash.py (100%) rename {custom-legendary => custom_legendary}/utils/savegame_helper.py (100%) rename {custom-legendary => custom_legendary}/utils/selective_dl.py (100%) rename {custom-legendary => custom_legendary}/utils/wine_helpers.py (100%) diff --git a/Rare/Components/Dialogs/Login/BrowserLogin.py b/Rare/Components/Dialogs/Login/BrowserLogin.py index c1efc244..bf5da85c 100644 --- a/Rare/Components/Dialogs/Login/BrowserLogin.py +++ b/Rare/Components/Dialogs/Login/BrowserLogin.py @@ -3,7 +3,7 @@ from logging import getLogger from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QLabel, QLineEdit -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore logger = getLogger("BrowserLogin") diff --git a/Rare/Components/Dialogs/Login/ImportWidget.py b/Rare/Components/Dialogs/Login/ImportWidget.py index bfd0a368..a3cf9c26 100644 --- a/Rare/Components/Dialogs/Login/ImportWidget.py +++ b/Rare/Components/Dialogs/Login/ImportWidget.py @@ -4,7 +4,7 @@ from logging import getLogger from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QLabel, QButtonGroup, QRadioButton -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore logger = getLogger("Import") diff --git a/Rare/Components/Dialogs/Login/LoginDialog.py b/Rare/Components/Dialogs/Login/LoginDialog.py index 65e9dfba..e2583e60 100644 --- a/Rare/Components/Dialogs/Login/LoginDialog.py +++ b/Rare/Components/Dialogs/Login/LoginDialog.py @@ -1,5 +1,5 @@ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QStackedLayout, QWidget, QPushButton -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore # Login Opportunities: Browser, Import from Rare.Components.Dialogs.Login.BrowserLogin import BrowserLogin diff --git a/Rare/Components/Launch/LaunchDialog.py b/Rare/Components/Launch/LaunchDialog.py index 37f54981..b6b1f772 100644 --- a/Rare/Components/Launch/LaunchDialog.py +++ b/Rare/Components/Launch/LaunchDialog.py @@ -2,7 +2,7 @@ from logging import getLogger from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QDialog, QLabel, QProgressBar, QVBoxLayout -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore from Rare.Components.Dialogs.Login.LoginDialog import LoginDialog from Rare.utils.utils import download_images @@ -27,7 +27,7 @@ class LaunchThread(QThread): class LoginThread(QThread): login = pyqtSignal() - start_app = pyqtSignal(LegendaryCore) + start_app = pyqtSignal() def __init__(self, core: LegendaryCore): super(LoginThread, self).__init__() @@ -38,7 +38,7 @@ class LoginThread(QThread): try: if self.core.login(): logger.info("You are logged in") - self.start_app.emit(self.core) + self.start_app.emit() else: self.run() except ValueError: @@ -72,8 +72,8 @@ class LaunchDialog(QDialog): else: exit(0) - def launch(self, core: LegendaryCore): - self.core = core + def launch(self): + #self.core = core self.info_pb.setMaximum(len(self.core.get_game_list())) self.info_text.setText(self.tr("Downloading Images")) self.thread = LaunchThread(self.core, self) diff --git a/Rare/Components/TabWidget.py b/Rare/Components/TabWidget.py index 32782fcb..db537252 100644 --- a/Rare/Components/TabWidget.py +++ b/Rare/Components/TabWidget.py @@ -2,7 +2,7 @@ from PyQt5.QtCore import QSize from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QTabWidget, QTabBar, QWidget, QToolButton, QWidgetAction, QMenu from Rare.Components.Tabs.CloudSaves.CloudSaves import SyncSaves -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore from qtawesome import icon # from Rare.Components.Tabs.Account.AccountWidget import MiniWidget diff --git a/Rare/Components/Tabs/Account/AccountWidget.py b/Rare/Components/Tabs/Account/AccountWidget.py index 18222161..e98d24c0 100644 --- a/Rare/Components/Tabs/Account/AccountWidget.py +++ b/Rare/Components/Tabs/Account/AccountWidget.py @@ -2,7 +2,7 @@ import webbrowser from PyQt5.QtCore import QCoreApplication from PyQt5.QtWidgets import QWidget, QVBoxLayout, QMessageBox, QLabel, QPushButton -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore class MiniWidget(QWidget): diff --git a/Rare/Components/Tabs/CloudSaves/CloudSaves.py b/Rare/Components/Tabs/CloudSaves/CloudSaves.py index 45a36f08..ce248f04 100644 --- a/Rare/Components/Tabs/CloudSaves/CloudSaves.py +++ b/Rare/Components/Tabs/CloudSaves/CloudSaves.py @@ -2,8 +2,8 @@ from logging import getLogger from PyQt5.QtCore import QThread, pyqtSignal, Qt from PyQt5.QtWidgets import * -from legendary.core import LegendaryCore -from legendary.models.game import SaveGameStatus +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import SaveGameStatus from Rare.Components.Dialogs.PathInputDialog import PathInputDialog from Rare.Components.Tabs.CloudSaves.SyncWidget import SyncWidget diff --git a/Rare/Components/Tabs/CloudSaves/SyncWidget.py b/Rare/Components/Tabs/CloudSaves/SyncWidget.py index 740c5896..72e1649b 100644 --- a/Rare/Components/Tabs/CloudSaves/SyncWidget.py +++ b/Rare/Components/Tabs/CloudSaves/SyncWidget.py @@ -3,9 +3,9 @@ from logging import getLogger from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QHBoxLayout, QLabel -from legendary.core import LegendaryCore -from legendary.models.game import InstalledGame, SaveGameStatus +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import InstalledGame, SaveGameStatus class _UploadThread(QThread): @@ -48,7 +48,11 @@ class SyncWidget(QWidget): self.igame = igame self.has_save_path = True if not igame.save_path: - save_path = self.core.get_save_path(igame.app_name) + try: + save_path = self.core.get_save_path(igame.app_name) + except Exception as e: + self.logger.error(e) + return if '%' in save_path or '{' in save_path: status = self.tr("Path not found") self.logger.info("Could not find save path") diff --git a/Rare/Components/Tabs/Downloads/DownloadTab.py b/Rare/Components/Tabs/Downloads/DownloadTab.py index b5308e2b..c7688107 100644 --- a/Rare/Components/Tabs/Downloads/DownloadTab.py +++ b/Rare/Components/Tabs/Downloads/DownloadTab.py @@ -5,17 +5,20 @@ import time from logging import getLogger from multiprocessing import Queue as MPQueue -from PyQt5.QtCore import QThread, pyqtSignal, Qt, QVariant -from PyQt5.QtWidgets import QWidget, QMessageBox, QVBoxLayout, QLabel, QGridLayout, QProgressBar, QPushButton, QDialog, QListWidget +from PyQt5.QtCore import QThread, pyqtSignal, Qt +from PyQt5.QtWidgets import QWidget, QMessageBox, QVBoxLayout, QLabel, QGridLayout, QProgressBar, QPushButton, QDialog, \ + QListWidget, QHBoxLayout -from legendary.core import LegendaryCore -from legendary.models.game import Game -from legendary.models.downloading import UIUpdate -from legendary.utils.selective_dl import games + + +from custom_legendary.core import LegendaryCore +from custom_legendary.downloader.manager import DLManager +from custom_legendary.models.downloading import UIUpdate +from custom_legendary.models.game import Game +from custom_legendary.utils.selective_dl import games from Rare.Components.Dialogs.InstallDialog import InstallInfoDialog -from Rare.utils.LegendaryApi import VerifyThread -from Rare.utils.Models import InstallOptions +from Rare.utils.Models import InstallOptions, KillDownloadException logger = getLogger("Download") @@ -23,8 +26,10 @@ logger = getLogger("Download") class DownloadThread(QThread): status = pyqtSignal(str) statistics = pyqtSignal(UIUpdate) + kill = False - def __init__(self, dlm, core: LegendaryCore, status_queue: MPQueue, igame, repair=False, repair_file=None): + def __init__(self, dlm: DLManager, core: LegendaryCore, status_queue: MPQueue, igame, repair=False, + repair_file=None): super(DownloadThread, self).__init__() self.dlm = dlm self.core = core @@ -40,11 +45,23 @@ class DownloadThread(QThread): self.dlm.start() time.sleep(1) while self.dlm.is_alive(): + if self.kill: + #raise KillDownloadException() + # TODO kill download queue, workers + pass try: - self.statistics.emit(self.status_queue.get(timeout=0.1)) + self.statistics.emit(self.status_queue.get(timeout=1)) except queue.Empty: pass + self.dlm.join() + + except KillDownloadException: + self.status.emit("stop") + logger.info("Downlaod can be continued later") + self.dlm.kill() + return + except Exception as e: logger.error(f"Installation failed after {time.time() - start_time:.02f} seconds: {e}") self.status.emit("error") @@ -128,9 +145,18 @@ class DownloadTab(QWidget): self.info_layout.addWidget(self.downloaded, 1, 1) self.layout.addLayout(self.info_layout) + self.mini_layout = QHBoxLayout() + self.prog_bar = QProgressBar() self.prog_bar.setMaximum(100) - self.layout.addWidget(self.prog_bar) + self.mini_layout.addWidget(self.prog_bar) + + self.kill_button = QPushButton(self.tr("Stop Download")) + # self.mini_layout.addWidget(self.kill_button) + self.kill_button.setDisabled(True) + self.kill_button.clicked.connect(self.stop_download) + + self.layout.addLayout(self.mini_layout) self.installing_game_widget = QLabel(self.tr("No active Download")) self.layout.addWidget(self.installing_game_widget) @@ -155,6 +181,9 @@ class DownloadTab(QWidget): self.setLayout(self.layout) + def stop_download(self): + self.thread.kill = True + def install_game(self, options: InstallOptions): game = self.core.get_game(options.app_name, update_meta=True) status_queue = MPQueue() @@ -162,28 +191,28 @@ class DownloadTab(QWidget): dlm, analysis, game, igame, repair, repair_file = self.core.prepare_download( app_name=options.app_name, base_path=options.path, - force=False, # TODO allow overwrite + force=False, # TODO allow overwrite no_install=options.download_only, status_q=status_queue, - #max_shm=, + # max_shm=, max_workers=options.max_workers, - #game_folder=, - #disable_patching=, - #override_manifest=, - #override_old_manifest=, - #override_base_url=, - #platform_override=, - #file_prefix_filter=, - #file_exclude_filter=, - #file_install_tag=, - #dl_optimizations=, - #dl_timeout=, + # game_folder=, + # disable_patching=, + # override_manifest=, + # override_old_manifest=, + # override_base_url=, + # platform_override=, + # file_prefix_filter=, + # file_exclude_filter=, + # file_install_tag=, + # dl_optimizations=, + # dl_timeout=, repair=options.repair, - #repair_use_latest=, - #ignore_space_req=, - #disable_delta=, - #override_delta_manifest=, - #reset_sdl=, + # repair_use_latest=, + # ignore_space_req=, + # disable_delta=, + # override_delta_manifest=, + # reset_sdl=, sdl_prompt=self.sdl_prompt) except Exception as e: QMessageBox.warning(self, self.tr("Error preparing download"), @@ -202,6 +231,7 @@ class DownloadTab(QWidget): self.thread.status.connect(self.status) self.thread.statistics.connect(self.statistics) self.thread.start() + self.kill_button.setDisabled(False) self.installing_game.setText("Installing Game: " + self.active_game.app_title) def sdl_prompt(self, app_name: str = '', title: str = '') -> list: @@ -223,7 +253,7 @@ class DownloadTab(QWidget): tags.extend(games[app_name]['__required']['tags']) # add available additional downloads to list - pack_list.addItems([ tag + ': ' + info['name'] for tag, info in games[app_name].items() if tag != '__required' ]) + pack_list.addItems([tag + ': ' + info['name'] for tag, info in games[app_name].items() if tag != '__required']) # enable checkboxes for i in range(len(pack_list)): @@ -265,11 +295,19 @@ class DownloadTab(QWidget): elif text == "error": QMessageBox.warning(self, "warn", "Download error") + elif text == "stop": + self.kill_button.setDisabled(True) + self.installing_game.setText(self.tr("Installing Game: No active download")) + self.prog_bar.setValue(0) + self.dl_speed.setText("") + self.cache_used.setText("") + self.downloaded.setText("") + def statistics(self, ui_update: UIUpdate): self.prog_bar.setValue(ui_update.progress) - self.dl_speed.setText(self.tr("Download speed") + f": {ui_update.download_speed/1024/1024:.02f}MB/s") - self.cache_used.setText(self.tr("Cache used") + f": {ui_update.cache_usage/1024/1024:.02f}MB") - self.downloaded.setText(self.tr("Downloaded") + f": {ui_update.total_downloaded/1024/1024:.02f}MB") + self.dl_speed.setText(self.tr("Download speed") + f": {ui_update.download_speed / 1024 / 1024:.02f}MB/s") + self.cache_used.setText(self.tr("Cache used") + f": {ui_update.cache_usage / 1024 / 1024:.02f}MB") + self.downloaded.setText(self.tr("Downloaded") + f": {ui_update.total_downloaded / 1024 / 1024:.02f}MB") def update_game(self, app_name: str): print("Update ", app_name) diff --git a/Rare/Components/Tabs/Games/GameInfo/GameInfo.py b/Rare/Components/Tabs/Games/GameInfo/GameInfo.py index e71c6d4a..78408972 100644 --- a/Rare/Components/Tabs/Games/GameInfo/GameInfo.py +++ b/Rare/Components/Tabs/Games/GameInfo/GameInfo.py @@ -4,8 +4,8 @@ from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtGui import QPixmap, QKeyEvent from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QLabel, QHBoxLayout, QTabWidget, QMessageBox, \ QProgressBar, QStackedWidget -from legendary.core import LegendaryCore -from legendary.models.game import InstalledGame, Game +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import InstalledGame, Game from qtawesome import icon from Rare.Components.Tabs.Games.GameInfo.GameSettings import GameSettings diff --git a/Rare/Components/Tabs/Games/GameInfo/GameSettings.py b/Rare/Components/Tabs/Games/GameInfo/GameSettings.py index 8235b169..7e6e5e00 100644 --- a/Rare/Components/Tabs/Games/GameInfo/GameSettings.py +++ b/Rare/Components/Tabs/Games/GameInfo/GameSettings.py @@ -1,8 +1,8 @@ import os from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout, QComboBox, QFileDialog, QPushButton, QMessageBox -from legendary.core import LegendaryCore -from legendary.models.game import InstalledGame, Game +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import InstalledGame, Game from Rare.Components.Tabs.Settings.Linux import LinuxSettings from Rare.Components.Tabs.Settings.SettingsWidget import SettingsWidget diff --git a/Rare/Components/Tabs/Games/GameList.py b/Rare/Components/Tabs/Games/GameList.py index 470c0e7a..f84b5fba 100644 --- a/Rare/Components/Tabs/Games/GameList.py +++ b/Rare/Components/Tabs/Games/GameList.py @@ -1,6 +1,6 @@ from PyQt5.QtCore import Qt, pyqtSignal, QSettings from PyQt5.QtWidgets import * -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore from Rare.Components.Tabs.Games.GameWidgetInstalled import GameWidgetInstalled from Rare.Components.Tabs.Games.GameWidgetListUninstalled import UninstalledGameWidget @@ -46,7 +46,7 @@ class GameList(QScrollArea): widget = GameWidget(game, self.core) if widget.update_available: self.updates.append(widget.game.app_name) - widget.update_game.connect(self.update_game.emit) + widget.update_game.connect(lambda: self.update_game.emit()) self.layout.addWidget(widget) widget.update_list.connect(self.update_list) diff --git a/Rare/Components/Tabs/Games/GameWidgetInstalled.py b/Rare/Components/Tabs/Games/GameWidgetInstalled.py index 002b4096..42ae7dd4 100644 --- a/Rare/Components/Tabs/Games/GameWidgetInstalled.py +++ b/Rare/Components/Tabs/Games/GameWidgetInstalled.py @@ -4,8 +4,8 @@ from logging import getLogger from PyQt5.QtCore import QEvent, pyqtSignal, QSettings, QSize, Qt from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import * -from legendary.core import LegendaryCore -from legendary.models.game import InstalledGame +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import InstalledGame from qtawesome import icon from Rare.utils import LegendaryApi diff --git a/Rare/Components/Tabs/Games/GameWidgetListUninstalled.py b/Rare/Components/Tabs/Games/GameWidgetListUninstalled.py index 5da1004c..6417cebf 100644 --- a/Rare/Components/Tabs/Games/GameWidgetListUninstalled.py +++ b/Rare/Components/Tabs/Games/GameWidgetListUninstalled.py @@ -1,14 +1,13 @@ import os -import subprocess from logging import getLogger -from PyQt5.QtCore import QThread, pyqtSignal, QProcess, QSettings +from PyQt5.QtCore import pyqtSignal, QSettings from PyQt5.QtGui import QPixmap -from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QPushButton, QMessageBox -from legendary.core import LegendaryCore +from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QPushButton from Rare.Components.Dialogs.InstallDialog import InstallDialog from Rare.utils.Models import InstallOptions +from custom_legendary.core import LegendaryCore logger = getLogger("Game") diff --git a/Rare/Components/Tabs/Games/GameWidgetUninstalled.py b/Rare/Components/Tabs/Games/GameWidgetUninstalled.py index de1cf79a..b16b88bf 100644 --- a/Rare/Components/Tabs/Games/GameWidgetUninstalled.py +++ b/Rare/Components/Tabs/Games/GameWidgetUninstalled.py @@ -4,8 +4,8 @@ from logging import getLogger from PyQt5.QtCore import pyqtSignal, QSettings from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel -from legendary.core import LegendaryCore -from legendary.models.game import Game +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import Game from Rare.Components.Dialogs.InstallDialog import InstallDialog from Rare.utils.Models import InstallOptions diff --git a/Rare/Components/Tabs/Games/InstalledListWidget.py b/Rare/Components/Tabs/Games/InstalledListWidget.py index 4089433f..6e75e13d 100644 --- a/Rare/Components/Tabs/Games/InstalledListWidget.py +++ b/Rare/Components/Tabs/Games/InstalledListWidget.py @@ -4,8 +4,8 @@ from logging import getLogger from PyQt5.QtCore import QProcess, pyqtSignal, QSettings from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton, QStyle, QVBoxLayout -from legendary.core import LegendaryCore -from legendary.models.game import InstalledGame +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import InstalledGame from Rare.utils import LegendaryApi @@ -16,6 +16,7 @@ class GameWidget(QWidget): proc: QProcess signal = pyqtSignal(str) update_list = pyqtSignal() + update_game = pyqtSignal() # TODO Repair def __init__(self, game: InstalledGame, core: LegendaryCore): diff --git a/Rare/Components/Tabs/Settings/DXVK/Dxvk.py b/Rare/Components/Tabs/Settings/DXVK/Dxvk.py index c49940ce..84e9d5bd 100644 --- a/Rare/Components/Tabs/Settings/DXVK/Dxvk.py +++ b/Rare/Components/Tabs/Settings/DXVK/Dxvk.py @@ -2,7 +2,7 @@ from logging import getLogger from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QWidget, QCheckBox, QVBoxLayout, QWidgetAction, QMenu, QToolButton, QHBoxLayout, QLabel -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore logger = getLogger("DXVK Settings") diff --git a/Rare/Components/Tabs/Settings/Legendary.py b/Rare/Components/Tabs/Settings/Legendary.py index e9d2bd96..0dffdd03 100644 --- a/Rare/Components/Tabs/Settings/Legendary.py +++ b/Rare/Components/Tabs/Settings/Legendary.py @@ -2,7 +2,7 @@ from logging import getLogger from PyQt5.QtGui import QIntValidator from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QFileDialog, QPushButton, QLineEdit -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore from Rare.Components.Tabs.Settings.SettingsWidget import SettingsWidget from Rare.utils.QtExtensions import PathEdit diff --git a/Rare/Components/Tabs/Settings/Linux.py b/Rare/Components/Tabs/Settings/Linux.py index 7dc1cd9d..120dc5b3 100644 --- a/Rare/Components/Tabs/Settings/Linux.py +++ b/Rare/Components/Tabs/Settings/Linux.py @@ -1,7 +1,7 @@ from logging import getLogger from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QFileDialog, QLineEdit -from legendary.core import LegendaryCore +from custom_legendary.core import LegendaryCore from Rare.Components.Tabs.Settings.DXVK.Dxvk import DxvkWidget from Rare.Components.Tabs.Settings.SettingsWidget import SettingsWidget diff --git a/Rare/Components/Tabs/Settings/SettingsTab.py b/Rare/Components/Tabs/Settings/SettingsTab.py index 3c6829bd..dfe5443b 100644 --- a/Rare/Components/Tabs/Settings/SettingsTab.py +++ b/Rare/Components/Tabs/Settings/SettingsTab.py @@ -1,7 +1,6 @@ import os -from PyQt5.QtCore import QRect, QPoint, QSize -from PyQt5.QtWidgets import QTabWidget, QStylePainter, QStyleOptionTab, QTabBar, QStyle +from PyQt5.QtWidgets import QTabWidget from Rare.Components.Tabs.Settings.About import About from Rare.Components.Tabs.Settings.Legendary import LegendarySettings @@ -21,4 +20,3 @@ class SettingsTab(QTabWidget): if os.name != "nt": self.addTab(LinuxSettings(core), "Linux") self.addTab(About(), "About") - diff --git a/Rare/utils/LegendaryApi.py b/Rare/utils/LegendaryApi.py index f6381d43..bec8ecad 100644 --- a/Rare/utils/LegendaryApi.py +++ b/Rare/utils/LegendaryApi.py @@ -5,9 +5,9 @@ from sys import stdout from PyQt5.QtCore import QProcess, QProcessEnvironment, QThread, pyqtSignal from PyQt5.QtWidgets import QMessageBox, QWidget -from legendary.core import LegendaryCore -from legendary.models.game import VerifyResult -from legendary.utils.lfs import validate_files +from custom_legendary.core import LegendaryCore +from custom_legendary.models.game import VerifyResult +from custom_legendary.utils.lfs import validate_files logger = getLogger("Legendary Utils") diff --git a/Rare/utils/Models.py b/Rare/utils/Models.py index d5a61cb8..3b64c03d 100644 --- a/Rare/utils/Models.py +++ b/Rare/utils/Models.py @@ -10,3 +10,7 @@ class InstallOptions: self.max_workers = max_workers self.repair = repair self.download_only = download_only + + +class KillDownloadException(Exception): + pass diff --git a/Rare/utils/legendaryConfig.py b/Rare/utils/legendaryConfig.py deleted file mode 100644 index c236f5be..00000000 --- a/Rare/utils/legendaryConfig.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -from legendary.lfs.lgndry import LGDLFS - -lgd = LGDLFS() - - -def get_config() -> {}: - return lgd.config - - -def set_config(new_config: {}): - lgd.config = new_config - with open(os.path.join(lgd.path, 'config.ini'), "w") as cf: - lgd.config.write(cf) diff --git a/Rare/utils/utils.py b/Rare/utils/utils.py index 0356130c..28c4602a 100644 --- a/Rare/utils/utils.py +++ b/Rare/utils/utils.py @@ -9,7 +9,6 @@ from PyQt5.QtCore import pyqtSignal, QLocale, QSettings from legendary.core import LegendaryCore from Rare import lang_path -from Rare.utils import legendaryConfig logger = getLogger("Utils") s = QSettings("Rare","Rare") @@ -95,9 +94,10 @@ def download_image(game, force=False): def get_lang(): - if "Legendary" in legendaryConfig.get_config() and "locale" in legendaryConfig.get_config()["Legendary"]: - logger.info("Found locale in Legendary config: " + legendaryConfig.get_config()["Legendary"]["locale"]) - return legendaryConfig.get_config()["Legendary"]["locale"].split("-")[0] + core = LegendaryCore() + if "Legendary" in core.lgd.config.sections() and "locale" in core.lgd.config["Legendary"]: + logger.info("Found locale in Legendary config: " + core.lgd.config.get("Legendary", "locale")) + return core.lgd.config.get("Legendary", "locale").split("-")[0] else: logger.info("Found locale in system config: " + QLocale.system().name().split("_")[0]) return QLocale.system().name().split("_")[0] diff --git a/custom-legendary/__init__.py b/custom_legendary/__init__.py similarity index 54% rename from custom-legendary/__init__.py rename to custom_legendary/__init__.py index 1760b2aa..fc1bda59 100644 --- a/custom-legendary/__init__.py +++ b/custom_legendary/__init__.py @@ -1,4 +1,4 @@ """Legendary!""" __version__ = '0.20.6' -__codename__ = 'A Red Letter Day' +__codename__ = 'Custom' diff --git a/custom-legendary/api/__init__.py b/custom_legendary/api/__init__.py similarity index 100% rename from custom-legendary/api/__init__.py rename to custom_legendary/api/__init__.py diff --git a/custom-legendary/api/egs.py b/custom_legendary/api/egs.py similarity index 100% rename from custom-legendary/api/egs.py rename to custom_legendary/api/egs.py diff --git a/custom-legendary/cli.py b/custom_legendary/cli.py similarity index 100% rename from custom-legendary/cli.py rename to custom_legendary/cli.py diff --git a/custom-legendary/core.py b/custom_legendary/core.py similarity index 100% rename from custom-legendary/core.py rename to custom_legendary/core.py diff --git a/custom-legendary/downloader/__init__.py b/custom_legendary/downloader/__init__.py similarity index 100% rename from custom-legendary/downloader/__init__.py rename to custom_legendary/downloader/__init__.py diff --git a/custom-legendary/downloader/manager.py b/custom_legendary/downloader/manager.py similarity index 100% rename from custom-legendary/downloader/manager.py rename to custom_legendary/downloader/manager.py diff --git a/custom-legendary/downloader/workers.py b/custom_legendary/downloader/workers.py similarity index 100% rename from custom-legendary/downloader/workers.py rename to custom_legendary/downloader/workers.py diff --git a/custom-legendary/lfs/__init__.py b/custom_legendary/lfs/__init__.py similarity index 100% rename from custom-legendary/lfs/__init__.py rename to custom_legendary/lfs/__init__.py diff --git a/custom-legendary/lfs/egl.py b/custom_legendary/lfs/egl.py similarity index 100% rename from custom-legendary/lfs/egl.py rename to custom_legendary/lfs/egl.py diff --git a/custom-legendary/lfs/lgndry.py b/custom_legendary/lfs/lgndry.py similarity index 100% rename from custom-legendary/lfs/lgndry.py rename to custom_legendary/lfs/lgndry.py diff --git a/custom-legendary/models/__init__.py b/custom_legendary/models/__init__.py similarity index 100% rename from custom-legendary/models/__init__.py rename to custom_legendary/models/__init__.py diff --git a/custom-legendary/models/chunk.py b/custom_legendary/models/chunk.py similarity index 100% rename from custom-legendary/models/chunk.py rename to custom_legendary/models/chunk.py diff --git a/custom-legendary/models/downloading.py b/custom_legendary/models/downloading.py similarity index 100% rename from custom-legendary/models/downloading.py rename to custom_legendary/models/downloading.py diff --git a/custom-legendary/models/egl.py b/custom_legendary/models/egl.py similarity index 100% rename from custom-legendary/models/egl.py rename to custom_legendary/models/egl.py diff --git a/custom-legendary/models/exceptions.py b/custom_legendary/models/exceptions.py similarity index 100% rename from custom-legendary/models/exceptions.py rename to custom_legendary/models/exceptions.py diff --git a/custom-legendary/models/game.py b/custom_legendary/models/game.py similarity index 100% rename from custom-legendary/models/game.py rename to custom_legendary/models/game.py diff --git a/custom-legendary/models/json_manifest.py b/custom_legendary/models/json_manifest.py similarity index 100% rename from custom-legendary/models/json_manifest.py rename to custom_legendary/models/json_manifest.py diff --git a/custom-legendary/models/manifest.py b/custom_legendary/models/manifest.py similarity index 100% rename from custom-legendary/models/manifest.py rename to custom_legendary/models/manifest.py diff --git a/custom-legendary/utils/__init__.py b/custom_legendary/utils/__init__.py similarity index 100% rename from custom-legendary/utils/__init__.py rename to custom_legendary/utils/__init__.py diff --git a/custom-legendary/utils/cli.py b/custom_legendary/utils/cli.py similarity index 100% rename from custom-legendary/utils/cli.py rename to custom_legendary/utils/cli.py diff --git a/custom-legendary/utils/custom_parser.py b/custom_legendary/utils/custom_parser.py similarity index 100% rename from custom-legendary/utils/custom_parser.py rename to custom_legendary/utils/custom_parser.py diff --git a/custom-legendary/utils/game_workarounds.py b/custom_legendary/utils/game_workarounds.py similarity index 100% rename from custom-legendary/utils/game_workarounds.py rename to custom_legendary/utils/game_workarounds.py diff --git a/custom-legendary/utils/lfs.py b/custom_legendary/utils/lfs.py similarity index 100% rename from custom-legendary/utils/lfs.py rename to custom_legendary/utils/lfs.py diff --git a/custom-legendary/utils/manifests.py b/custom_legendary/utils/manifests.py similarity index 100% rename from custom-legendary/utils/manifests.py rename to custom_legendary/utils/manifests.py diff --git a/custom-legendary/utils/rolling_hash.py b/custom_legendary/utils/rolling_hash.py similarity index 100% rename from custom-legendary/utils/rolling_hash.py rename to custom_legendary/utils/rolling_hash.py diff --git a/custom-legendary/utils/savegame_helper.py b/custom_legendary/utils/savegame_helper.py similarity index 100% rename from custom-legendary/utils/savegame_helper.py rename to custom_legendary/utils/savegame_helper.py diff --git a/custom-legendary/utils/selective_dl.py b/custom_legendary/utils/selective_dl.py similarity index 100% rename from custom-legendary/utils/selective_dl.py rename to custom_legendary/utils/selective_dl.py diff --git a/custom-legendary/utils/wine_helpers.py b/custom_legendary/utils/wine_helpers.py similarity index 100% rename from custom-legendary/utils/wine_helpers.py rename to custom_legendary/utils/wine_helpers.py