From a42d4f2c3fe747d26d76a8e6d3d41ad7fcf6e781 Mon Sep 17 00:00:00 2001 From: xgui4 <134389196+xgui4@users.noreply.github.com> Date: Mon, 25 May 2026 15:09:32 -0400 Subject: [PATCH] cleaned the code witj ruff, remove instance type , and some minors typo fixed on docs and other minors changes --- .github/workflows/nightly.yml | 2 +- data/defaults_instances/aether.lce_inst | 1 - data/defaults_instances/mclce.lce_inst | 1 - data/defaults_instances/neoLegacy.lce_inst | 3 +- data/defaults_instances/revelation.lce_inst | 1 - data/guide.jsonc | 17 +- lisezmoi.md | 8 +- readme.md | 4 +- schemas/x-application-lce_inst_config.json | 14 +- src/form.ui | 83 +---- src/instance.ui | 332 ++++++++---------- .../managers/display_manager.py | 14 +- src/lce_qt_launcher/managers/downloader.py | 8 +- .../managers/instance_manager.py | 77 +--- src/lce_qt_launcher/managers/steam_manager.py | 5 +- src/lce_qt_launcher/utils/holiday.py | 2 - .../views/content_installer_dialog.py | 1 - src/lce_qt_launcher/views/launcher.py | 78 ++-- src/lce_qt_launcher/views/setting_dialog.py | 6 +- 19 files changed, 237 insertions(+), 420 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 939c617..5c6df37 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -119,7 +119,7 @@ jobs: Note that the Nightly build is not available as a port right now.\n \n Automatic Nighty (daily) binary build powered by GtiHub Actions. \n - The nigthly build are experimental nuitka compilation from the nighly branch \n + The nigthly build are experimental nuitka compilation from the dev branch \n Now includes installers (NOTE : currently, Automatic installer workflow is broken)." files: | ./artifacts/****.exe diff --git a/data/defaults_instances/aether.lce_inst b/data/defaults_instances/aether.lce_inst index c629b4b..03a69ee 100644 --- a/data/defaults_instances/aether.lce_inst +++ b/data/defaults_instances/aether.lce_inst @@ -8,6 +8,5 @@ "repo_url": "https://github.com/Frcoxd/aether-papu", "news_feed": "https://github.com/LCE-Hub/LCE-Workshop/tree/main/.00versions/test", "instance_source": "InstanceSource.GITHUB_RELEASE", - "instance_type": "InstanceType.CLIENT_VANILLA", "version": "Aether" } \ No newline at end of file diff --git a/data/defaults_instances/mclce.lce_inst b/data/defaults_instances/mclce.lce_inst index 4a29bf1..cfbfeda 100644 --- a/data/defaults_instances/mclce.lce_inst +++ b/data/defaults_instances/mclce.lce_inst @@ -8,6 +8,5 @@ "image" : ":/assets/mclce-ico.png", "news_feed" : "https://git.minecraftlegacy.com/backups/MinecraftConsoles/commits/branch/main", "instance_source": "InstanceSource.REMOTE_GIT_SOURCE", - "instance_type": "InstanceType.CLIENT_VANILLA", "version": "main" } \ No newline at end of file diff --git a/data/defaults_instances/neoLegacy.lce_inst b/data/defaults_instances/neoLegacy.lce_inst index 4568290..03e7407 100644 --- a/data/defaults_instances/neoLegacy.lce_inst +++ b/data/defaults_instances/neoLegacy.lce_inst @@ -1,7 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/xgui4/LCE-Qt-Launcher/refs/heads/master/schemas/x-application-lce_inst_config.json", "name": "neoStudiosLCE neoLegacy", - "instance_type": "InstanceType.CLIENT_VANILLA", "instance_source": "InstanceSource.GITHUB_RELEASE", "image": ":/assets/neoLegacy.png", "archive_file": "neoLegacyWindows64.zip", @@ -9,5 +8,5 @@ "news_feed": "https://github.com/neoStudiosLCE/neoLegacy/commits/main/", "installation_path": ".neoLegacy", "repo_url": "https://github.com/neoStudiosLCE/neoLegacy", - "version": "v1.0.4b" + "version": "v1.0.5b" } diff --git a/data/defaults_instances/revelation.lce_inst b/data/defaults_instances/revelation.lce_inst index b688605..cd35cf4 100644 --- a/data/defaults_instances/revelation.lce_inst +++ b/data/defaults_instances/revelation.lce_inst @@ -8,6 +8,5 @@ "image" : ":/assets/Revelation.jpg", "news_feed" : "https://git.revela.dev/itsRevela/LCE-Revelations/commits/branch/main", "instance_source": "InstanceSource.FORGEJO_RELEASE", - "instance_type": "InstanceType.CLIENT_VANILLA", "version": "Nightly" } \ No newline at end of file diff --git a/data/guide.jsonc b/data/guide.jsonc index 56a5112..b6522c5 100644 --- a/data/guide.jsonc +++ b/data/guide.jsonc @@ -2,7 +2,7 @@ "$schema" : "../schemas/x-application-lce_inst_config.json", "name" : "default", // Name of the instance "installation_path": ".lce", // Installation Path of the game files - "username" : "Steve", // Your Username + "username" : "Steve", // Your Username, DEPRECIATED : will be soon removed and replaced by the username config settnig "exe_name" : "Minecraft.Client.exe", // The executable name "archive_name" : "LCEWindows64.zip", // The archive to download "repo_url" : "https://github.com/MCLCE/MinecraftConsoles", // The ur/repo of the project @@ -10,15 +10,10 @@ "news_feed" : "https://github.com/MCLCE/MinecraftConsoles/commits/main/", // The webiste of the news feed to display in the news tabs // InstanceSource.GITHUB_RELEASE : GitHub, // InstanceSource.FORGEJO_RELEASE : Forgejo (like Codeberge), - // InstanceSource.REMOTE_GIT_SOURCE = Remote Git (not implemented yet) - // InstanceSource.LOCAL_INSTALLATION = Local Installation (not implemented yet) - // InstanceSource.LOCAL_SOURCE_CODE = Local Source Code (not implemented yet) + // InstanceSource.REMOTE_GIT_SOURCE : Remote Git (not implemented yet) + // InstanceSource.LOCAL_INSTALLATION : Local Installation (not implemented yet) + // InstanceSource.LOCAL_SOURCE_CODE : Local Source Code (not implemented yet) "instance_source" : "InstanceSource.GITHUB_RELEASE", - // InstanceType.CLIENT_VANILLA = #TODO To implement and write documentation - // InstanceType.CLENT_MODDED = #TODO To implement and write documentation - // InstanceType.SERVER_VANILLA = #TODO To implement and write documentation - // InstanceType.SERVER_MODDED = #TODO To implement and write documentation - "instance_type": "InstanceType.CLIENT_VANILLA", // Type of the instance (not implemented/functionnal yet) - "version" : "nightly", // version/tag of the release of rhe instance to download - "steam_link" : "steam://rungameid/{number}" + "version" : "nightly", // version/tag of the release of rhe instance to download + "steam_link" : "steam://rungameid/{number}" } diff --git a/lisezmoi.md b/lisezmoi.md index 260c952..caf3cef 100644 --- a/lisezmoi.md +++ b/lisezmoi.md @@ -3,7 +3,7 @@ [Version anglaise](readme.md) ![LCE-QT-Launcher](assets/io.github.xgui4.lce_qt_launcher.png) -![Capture d'écran du lanceur (version à jour)](.github/screenshots/image.png) +![Capture d'écran du lanceur (version Alpha 0.0.20.0)](.github/screenshots/image.png) > [!WARNING] > Ce lanceur est en cours de développement et ses fonctionnalités peuvent être modifiées ou supprimées à tout moment. @@ -13,7 +13,7 @@ Il s'agit d'un lanceur LCE personnalisé pour Minecraft, écrit avec PySide6 (Qt6 pour Python) et conçu pour GNU/Linux. -## Pourquoi le lanceur LCE Qt ? +## Pourquoi LCE Qt Launcher ? - Développé en Python avec Qt 6 : léger et compatible avec le thème Plasma 6/Qt 6 de GNU/Linux - Personnalisation avec les thèmes @@ -67,14 +67,14 @@ A Venir bientôt (décalé du a des problèmes techniques) ### FreeBSD Port (Expérimental) -Voir [mon overlay tion de ports FreeBSD](https://github.com/xgui4/freebsd-ports) pour installer le port games/lce-qt-laucher (py311-lce-qt-launcher). +Voir [mon overlay de ports FreeBSD](https://github.com/xgui4/freebsd-ports) pour installer le port games/lce-qt-laucher (py311-lce-qt-launcher). ### Version Nightly/Quotidienne (Nighly Build) > [!NOTE] > Cette branche n'est pas stable et des modifications y sont apportées presque quotidiennement. Elle peut donc parfois dysfonctionner. De plus, macOS n'est pas disponible dans la version nighly en raison des restrictions d'Apple et du fait que je ne possède pas de Mac. -Sur cette page [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/releases/tag/nightly), vous trouverez les versions Nightly, générées automatiquement via GitHub Actions lors de modifications apportées à la branche [`nightly`](https://github.com/xgui4/LCE-Qt-Launcher/tree/nightly). Cette méthode est sujet a changer prochainement +Sur cette page [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/releases/tag/nightly), vous trouverez les versions Nightly, générées automatiquement via GitHub Actions lors de modifications apportées à la branche [`dev`](https://github.com/xgui4/LCE-Qt-Launcher/tree/dev). ### Via Git diff --git a/readme.md b/readme.md index 53d3536..1e4afea 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ [French Version](lisezmoi.md) ![LCE-Qt-Launcher Icon](assets/io.github.xgui4.lce_qt_launcher.png) -![Screnshot of the launcher in version 0.0.20a0 of the home screen)](.github/screenshots/image.png) +![Screnshot of the launcher in version 0.0.20a0 of the launcher)](.github/screenshots/image.png) > [!WARNING] > This launcher is work in progress and its feature could be changes or remove at any time. @@ -73,7 +73,7 @@ See [my FreeBSD Port Overlay](https://github.com/xgui4/freebsd-ports) to install > [!NOTE] > This branch is not stable and changes are made almost daily so this branch can sometimes break. Also, MacOS is not avaiable in the Nigthly Build due to Apple restriction and that I do now own a mac. -In this [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/releases/tag/nightly) page you will found Nighly Build which are made automatically via GitHub Action when change are made in the [`dev` branch](https://github.com/xgui4/LCE-Qt-Launcher/tree/dev) (This is subject to change very soon) +In this [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/releases/tag/nightly) page you will found Nighly Build which are made automatically via GitHub Action when change are made in the [`dev` branch](https://github.com/xgui4/LCE-Qt-Launcher/tree/dev) ### Via Git diff --git a/schemas/x-application-lce_inst_config.json b/schemas/x-application-lce_inst_config.json index b2e321f..12103b0 100644 --- a/schemas/x-application-lce_inst_config.json +++ b/schemas/x-application-lce_inst_config.json @@ -22,7 +22,7 @@ ] }, "username" : { - "$comment": "DEPRECIATED : will be soon removed and replaced by the username config settng", + "$comment": "DEPRECIATED : will be soon removed and replaced by the username config settng", "description": "The username of the player for the instance", "type" : "string", "default" : "Steve" @@ -74,23 +74,11 @@ "type" : "string", "default" : "InstanceSource.GITHUB_RELEASE" }, - "instance_type" : { - "description": "Type of the instance (not implemented/functionnal yet)", - "examples": [ - "InstanceType.CLIENT_VANILLA", - "InstanceType.CLENT_MODDED", - "InstanceType.SERVER_VANILLA", - "InstanceType.SERVER_MODDED" - ], - "type" : "string", - "default" : "InstanceType.CLIENT_VANILLA" - }, "version" : { "description": "version/tag of the release", "type" : "string", "default" : "nightly", "examples": [ - "nightly-dedicated-server", "Nightly", "v1.0.0b" ] diff --git a/src/form.ui b/src/form.ui index 6920519..89eeb31 100644 --- a/src/form.ui +++ b/src/form.ui @@ -357,6 +357,13 @@ + + + + true + + + @@ -401,63 +408,7 @@ - - - - false - - - - true - - - - Server IP (Coming Soon) - - - - - - - false - - - - 0 - 0 - - - - - - - - false - - - - true - - - - Server Name (Coming Soon) - - - - - - - false - - - - 0 - 0 - - - - - + Save Instances Config @@ -467,7 +418,7 @@ - + @@ -483,13 +434,13 @@ - + - false + true - Open Instances Editor + Open Instances Editor (Experimental) false @@ -502,13 +453,6 @@ - - - - true - - - @@ -677,7 +621,7 @@ 0 0 1205 - 22 + 35 @@ -1193,6 +1137,7 @@ + diff --git a/src/instance.ui b/src/instance.ui index 1ef4186..45f23d4 100644 --- a/src/instance.ui +++ b/src/instance.ui @@ -6,8 +6,8 @@ 0 0 - 645 - 664 + 966 + 700 @@ -27,7 +27,17 @@ - + + + + + 0 + 0 + + + + + @@ -39,117 +49,41 @@ - - + + - - 1 - 1 + + 0 + 0 - - - - - Change Instance Icon - - - - - - - false - - - - true - - - - Server IP (Coming Soon) - - - - - - - N/A - - - - - - - false - - - - true - - - - Server Name (Coming Soon) - - - - - - - - true - - - - Installation Path - - - - + Versions - - - - - true - - - - Steam Link : + + + + + 0 + 0 + - - - - - true - - + + - Instance Name + Add Steam Link - - - - - true - - - - Repo URL - - - - + @@ -167,7 +101,112 @@ - + + + + + 0 + 0 + + + + Confirm Changes + + + + + + + + true + + + + Repo URL + + + + + + + + true + + + + Installation Path + + + + + + + Change Instance Icon + + + + + + + + true + + + + Steam Link : + + + + + + + + + + :/assets/minecraft_lce_title.png + + + true + + + + + + + + + + + + + Save Instances Config + + + + + + + + 1 + 1 + + + + + + + + + + true + + + + Instance Name + + + + @@ -186,105 +225,10 @@ - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - false - - - - 0 - 0 - - - - - - - - false - - - - 0 - 0 - - - - - + - Add Steam Link - - - - - - - Save Instances Config - - - - - - - - 0 - 0 - - - - Confirm Changes - - - - - - - - - - :/assets/minecraft_lce_title.png - - - true + N/A diff --git a/src/lce_qt_launcher/managers/display_manager.py b/src/lce_qt_launcher/managers/display_manager.py index d244812..615b579 100644 --- a/src/lce_qt_launcher/managers/display_manager.py +++ b/src/lce_qt_launcher/managers/display_manager.py @@ -16,7 +16,7 @@ class DisplayType(Enum): class DisplayManager: def __init__(self, type: DisplayType, parentWindow: QWidget | None = None) -> None: self.type: DisplayType = type - if parentWindow != None: + if parentWindow is not None: self.parentWindow: QWidget = parentWindow def displayInfo(self, msg: str, title: str | None = None) -> None: @@ -24,21 +24,21 @@ class DisplayManager: term_service.print_information(msg) if self.type == DisplayType.QMESSAGE_BOX or DisplayType.MIXED: QMessageBox.information( - self.parentWindow, title if not None else "Information", msg - ) # pyright: ignore[reportArgumentType, reportUnusedCallResult] + self.parentWindow, title if not None else "Information", msg # pyright: ignore[reportArgumentType] + ) def displayWarn(self, msg: str, title: str | None = None) -> None: if self.type == DisplayType.CONSOLE or DisplayType.MIXED: term_service.print_warning(msg) if self.type == DisplayType.QMESSAGE_BOX or DisplayType.MIXED: QMessageBox.warning( - self.parentWindow, title if not None else "⚠️ Warning!", msg - ) # pyright: ignore[reportArgumentType, reportUnusedCallResult] + self.parentWindow, title if not None else "⚠️ Warning!", msg # pyright: ignore[reportArgumentType] + ) def displayError(self, msg: str, title: str | None = None) -> None: if self.type == DisplayType.CONSOLE or DisplayType.MIXED: term_service.print_error(msg) if self.type == DisplayType.QMESSAGE_BOX or DisplayType.MIXED: QMessageBox.critical( - self.parentWindow, title if not None else "❗ Error", msg - ) # pyright: ignore[reportArgumentType, reportUnusedCallResult] + self.parentWindow, title if not None else "❗ Error", msg # pyright: ignore[reportArgumentType] + ) diff --git a/src/lce_qt_launcher/managers/downloader.py b/src/lce_qt_launcher/managers/downloader.py index edda012..50a1eb2 100644 --- a/src/lce_qt_launcher/managers/downloader.py +++ b/src/lce_qt_launcher/managers/downloader.py @@ -39,7 +39,7 @@ class Downloader(QObject): self.manager: QNetworkAccessManager = QNetworkAccessManager() self.appContext: AppContext = appContext - def download_async(self, url_str : str, object_name : str) -> QNetworkReply: + def download_async(self, url_str: str, object_name: str) -> QNetworkReply: """#TODO docstring _summary_ Args: @@ -78,10 +78,10 @@ class Downloader(QObject): error_msg = f"Extraction Error : {e}" term_service.print_error(error_msg) raise RuntimeError(error_msg) + _ = reply.finished.connect(_when_finished) return reply - def download_inst_async(self, instance: Instance) -> QNetworkReply: """_summary_ Download and install the selected Instance @@ -140,7 +140,7 @@ class Downloader(QObject): """ data.extractall(instance.installation_path) - def extract_async(self, data: ZipFile, installation_path : str) -> None: + def extract_async(self, data: ZipFile, installation_path: str) -> None: """ _summary_ : extract the the data into the specified path @@ -149,4 +149,4 @@ class Downloader(QObject): installation_path : path of the installation/extraction #TODO Make Async """ - data.extractall(installation_path) \ No newline at end of file + data.extractall(installation_path) diff --git a/src/lce_qt_launcher/managers/instance_manager.py b/src/lce_qt_launcher/managers/instance_manager.py index 64b2622..95f0be9 100644 --- a/src/lce_qt_launcher/managers/instance_manager.py +++ b/src/lce_qt_launcher/managers/instance_manager.py @@ -24,7 +24,6 @@ SCHEME_VERSION = "https://raw.githubusercontent.com/xgui4/LCE-Qt-Launcher/refs/h class InstanceSource(Enum): """_summary_ The 4 Type of Instances (2 functional, the othes coming soon)""" - GITHUB_RELEASE = 0 FORGEJO_RELEASE = 1 REMOTE_GIT_SOURCE = 2 @@ -86,65 +85,6 @@ def from_str_to_InstanceSource(string: str) -> InstanceSource: raise RuntimeError(f"{string} is an Incorrect InstanceSource Type") -class InstanceType(Enum): - """_summary_ The instance Type (no function yet)""" - - CLIENT_VANILLA = 0 - CLENT_MODDED = 1 - SERVER_VANILLA = 2 - SERVER_MODDED = 3 - - -def from_int_to_InstanceType(value: int) -> InstanceType: - """_summary_ Convert Into to Instance Type - - Args: - value (int): _description_ the int to convert - - Raises: - RuntimeError: _description_ Raise if a incorrect int is specified - - Returns: - InstanceType: _description_ The InstanceType from the int - """ - match value: - case 0: - return InstanceType.CLIENT_VANILLA - case 1: - return InstanceType.CLENT_MODDED - case 2: - return InstanceType.SERVER_VANILLA - case 3: - return InstanceType.SERVER_MODDED - case _: - raise RuntimeError(f"{value} is an Incorrect InstanceType Type") - - -def from_str_to_InstanceType(string: str) -> InstanceType: - """_summary_ Convert str to Instance Type - - Args: - string (str): _description_ the string to convert - - Raises: - RuntimeError: _description_ Raise if a incorrect str is specified - - Returns: - InstanceSource: _description_ The InstanceType from the str - """ - match string: - case "InstanceType.CLIENT_VANILLA": - return InstanceType.CLIENT_VANILLA - case "InstanceType.CLENT_MODDED": - return InstanceType.CLENT_MODDED - case "InstanceType.SERVER_VANILLA": - return InstanceType.SERVER_VANILLA - case "InstanceType.SERVER_MODDED": - return InstanceType.SERVER_MODDED - case _: - raise RuntimeError(f"{string} is an Incorrect Instance Type") - - _DEFAULT_INST_NAME = "New Default (pieeebot neoLegacy)" _DEFAULT_INSTALLATION_PATH = ".new-default" _DEFAULT_USERNAME = "Steve" @@ -152,7 +92,6 @@ _DEFAULT_ARCHIVE_FILE = "neoLegacyWindows64.zip" _DEFAULT_EXE_NAME = "neoLegacyWindows64/Minecraft.Client.exe" _DEFAULT_REPO_URL = "https://github.com/neoStudiosLCE/neoLegacy" _DEFAULT_INST_SOURCE = InstanceSource.GITHUB_RELEASE -_DEFAULT_INST_TYPE = InstanceType.CLIENT_VANILLA _DEFAULT_INST_SOURCE_STRING = "InstanceSource.GITHUB_RELEASE" _DEFAULT_INST_TYPE_STRING = "InstanceType.CLIENT_VANILLA" _DEFAULT_IMAGE = ":/assets/neoLegacy.png" @@ -173,7 +112,6 @@ class Instance(QObject): repo_url: str = _DEFAULT_REPO_URL, image: str = _DEFAULT_IMAGE, instance_source: InstanceSource = _DEFAULT_INST_SOURCE, - instance_type: InstanceType = _DEFAULT_INST_TYPE, news_feed: str = _DEFAULT_NEWS_FEED, version: str = _DEFAULT_VERSION, steam_link: str = "N/A", @@ -186,7 +124,6 @@ class Instance(QObject): self.exe_name: str = exe_name self.repo_url: str = repo_url self.instance_source: InstanceSource = instance_source - self.instance_type: InstanceType = instance_type self.image: str = image self.news_feed: str = news_feed self.version: str = version @@ -209,9 +146,6 @@ class Instance(QObject): self.instance_source = from_str_to_InstanceSource( inst_dict.get("instances_source", _DEFAULT_INST_SOURCE_STRING) ) - self.instance_type = from_str_to_InstanceType( - inst_dict.get("instance_type", _DEFAULT_INST_TYPE_STRING) - ) self.image = inst_dict.get("image", _DEFAULT_IMAGE) self.news_feed = inst_dict.get("news_feed", _DEFAULT_NEWS_FEED) self.version = inst_dict.get("version", _DEFAULT_VERSION) @@ -258,7 +192,6 @@ class Instance(QObject): "archive_file": self.archive_file, "repo_url": self.repo_url, "instance_source": self.instance_source.name, - "instance_type": self.instance_type.name, "image": self.image, "news_feed": self.news_feed, "version": self.version, @@ -268,7 +201,7 @@ class Instance(QObject): def display(self) -> None: print(f"Name : {self.name}") - print(f"=============================") + print("=============================") print(f"installation path : {self.installation_path}") print(f"username : {self.username}") print(f"executable name : {self.exe_name}") @@ -276,7 +209,6 @@ class Instance(QObject): print(f"repo url : {self.repo_url}") print(f"image : {self.image}") print(f"instance source : {self.instance_source.value}") - print(f"instance type : {self.instance_source.value}") print(f"news_feed : {self.news_feed}") print(f"version : {self.version}") print(f"steam link : {self.steam_link}") @@ -345,7 +277,7 @@ class InstanceManager: InstanceSource.FORGEJO_RELEASE, ]: return self._downloader.download_inst_async(self.instance) - #TODO : test this feature + # TODO : test this feature # if self.instance.instance_source == InstanceSource.REMOTE_GIT_SOURCE: # subprocess.run( # [ @@ -401,7 +333,8 @@ class InstanceManager: # Note : Right now the remote git location is not installable via this launcher, it will added in the next version if self.instance.instance_source in [ InstanceSource.FORGEJO_RELEASE, - InstanceSource.GITHUB_RELEASE - ]: return True + InstanceSource.GITHUB_RELEASE, + ]: + return True else: return False diff --git a/src/lce_qt_launcher/managers/steam_manager.py b/src/lce_qt_launcher/managers/steam_manager.py index 9080b0d..6addad2 100644 --- a/src/lce_qt_launcher/managers/steam_manager.py +++ b/src/lce_qt_launcher/managers/steam_manager.py @@ -22,7 +22,6 @@ from PySide6.QtWidgets import QMessageBox import argparse import subprocess import platform -import os import sys LEGAL_TEXT = """ @@ -68,12 +67,12 @@ def add_instance_to_steam(abs_instance_exe_path: str, instance_name: str, icon: None, "Warning", "This function is in work in progress and the id is not saved in the launcher. \n" - "Until this is added, a manual intervention is needed to found the id and put in the save file. ", + + "Until this is added, a manual intervention is needed to found the id and put in the save file. ", ) except RuntimeError: print( "Warning : This function is in work in progress and the id is not saved in the launcher. \n" - "Until this is added, a manual intervention is needed to found the id and put in the save file. " + + "Until this is added, a manual intervention is needed to found the id and put in the save file. " ) else: QMessageBox.critical(None, "Critical Error", "Not Implemented Yet!") diff --git a/src/lce_qt_launcher/utils/holiday.py b/src/lce_qt_launcher/utils/holiday.py index aa6f478..bd7a606 100644 --- a/src/lce_qt_launcher/utils/holiday.py +++ b/src/lce_qt_launcher/utils/holiday.py @@ -44,8 +44,6 @@ def monthEnumToStr(enum: MONTH) -> str: return "November" case MONTH.DECEMBER: return "December" - case _: - return "" HOLIDAYS: dict[str, str] = { diff --git a/src/lce_qt_launcher/views/content_installer_dialog.py b/src/lce_qt_launcher/views/content_installer_dialog.py index 56cbe85..8d42385 100644 --- a/src/lce_qt_launcher/views/content_installer_dialog.py +++ b/src/lce_qt_launcher/views/content_installer_dialog.py @@ -2,7 +2,6 @@ from PySide6.QtWidgets import QDialog from lce_qt_launcher.managers import mod_manager from lce_qt_launcher.ui_contentInstaller import Ui_contentInstallerDialog -from lce_qt_launcher.views import term_service class ContentInstallerView(QDialog): diff --git a/src/lce_qt_launcher/views/launcher.py b/src/lce_qt_launcher/views/launcher.py index 6fcb70b..2f31e23 100644 --- a/src/lce_qt_launcher/views/launcher.py +++ b/src/lce_qt_launcher/views/launcher.py @@ -52,7 +52,6 @@ from lce_qt_launcher import ( import lce_qt_launcher.views.term_service as term_service import lce_qt_launcher.features as features import lce_qt_launcher.utils.holiday as holiday -import lce_qt_launcher.res_rc # pyright: ignore[reportUnusedImport] class LauncherView(QMainWindow): @@ -175,7 +174,7 @@ class LauncherView(QMainWindow): arguments: list[str] = ( QApplication.instance().arguments() if not None else "Error" # pyright: ignore[reportOptionalMemberAccess] - ) + ) if len(arguments) > 1: file_arg: str = arguments[1] try: @@ -275,42 +274,54 @@ class LauncherView(QMainWindow): self.ui.actionImport_Instance.triggered.connect(loadInstanceActionCommand) self.ui.actionInstall_Content.triggered.connect(installContentActionCommand) - loadSteam = lambda: subprocess.run( - ["steam", instanceManager.instance.steam_link] - ) + def loadSteam(): + return subprocess.run(["steam", instanceManager.instance.steam_link]) + self.ui.playOnSteamButton.clicked.connect(loadSteam) - openAppInstancesData = lambda: systemManager.open_url_with_system( - os.path.join(appData.appDataDirs[0], "instances") - ) + def openAppInstancesData(): + return systemManager.open_url_with_system( + os.path.join(appData.appDataDirs[0], "instances") + ) + self.ui.actionInstances.triggered.connect(openAppInstancesData) - open_workshop = lambda: features.show_webbrowser( - self, "https://lce-hub.github.io/piston/" - ) + def open_workshop(): + return features.show_webbrowser(self, "https://lce-hub.github.io/piston/") + self.ui.actionLCE_Hub_Workshop.triggered.connect(open_workshop) - open_legacymods = lambda: features.show_webbrowser( - self, "https://legacymods.org/" - ) + def open_legacymods(): + return features.show_webbrowser(self, "https://legacymods.org/") + self.ui.actionLegacyMods_Coming_Soon.triggered.connect(open_legacymods) - openAppRoot = lambda: systemManager.open_url_with_system(appData.projectRootDir) + def openAppRoot(): + return systemManager.open_url_with_system(appData.projectRootDir) + self.ui.actionApp_Root.triggered.connect(openAppRoot) - openAppConfig = lambda: systemManager.open_url_with_system(appData.appConfigDir) + def openAppConfig(): + return systemManager.open_url_with_system(appData.appConfigDir) + self.ui.actionApp_Root.triggered.connect(openAppConfig) - open_github_issues = lambda: webbrowser.open(git_repo_url_str + "/issues") + def open_github_issues(): + return webbrowser.open(git_repo_url_str + "/issues") + self.ui.actionReport_a_Bugs_or_Sugess_a_feature.triggered.connect( open_github_issues ) - loadDefaultInstance = lambda: self.loadInstanceCommand(dict(), instanceManager) + def loadDefaultInstance(): + return self.loadInstanceCommand(dict(), instanceManager) + self.ui.actionLoadDefaultInstance.triggered.connect(loadDefaultInstance) self.ui.actionLoadmclceInstance.setEnabled(False) - self.ui.actionLoadmclceInstance.setText("MCLCE Source Code Backup (Remote Git Not supported yet)") + self.ui.actionLoadmclceInstance.setText( + "MCLCE Source Code Backup (Remote Git Not supported yet)" + ) mclceJson = QFile(":/instances/mclce.lce_inst") if not mclceJson.open(QIODevice.OpenModeFlag.ReadOnly): @@ -320,7 +331,10 @@ class LauncherView(QMainWindow): else: raw_text_neo: str = bytes(mclceJson.readAll().data()).decode("utf-8") data_neo = json.loads(raw_text_neo) - loadNeoLegacyInstance = lambda: self.loadInstanceCommand(data_neo, instanceManager) + + def loadNeoLegacyInstance(): + return self.loadInstanceCommand(data_neo, instanceManager) + self.ui.actionLoadmclceInstance.triggered.connect(loadNeoLegacyInstance) revelationJson = QFile(":/instances/revelations.lce_inst") @@ -331,8 +345,13 @@ class LauncherView(QMainWindow): else: raw_text_rev = bytes(revelationJson.readAll().data()).decode("utf-8") data_rev = json.loads(raw_text_rev) - loadRevelationInstance = lambda : self.loadInstanceCommand(data_rev, instanceManager) - self.ui.actionLoadRevelationsInstance.triggered.connect(loadRevelationInstance) + + def loadRevelationInstance(): + return self.loadInstanceCommand(data_rev, instanceManager) + + self.ui.actionLoadRevelationsInstance.triggered.connect( + loadRevelationInstance + ) aetherJson = QFile(":/instances/aether.lce_inst") if not aetherJson.open(QIODevice.OpenModeFlag.ReadOnly): @@ -342,9 +361,10 @@ class LauncherView(QMainWindow): else: raw_text_aether = bytes(aetherJson.readAll().data()).decode("utf-8") data_aether = json.loads(raw_text_aether) - loadAetherInstance = lambda: self.loadInstanceCommand( - data_aether, instanceManager - ) + + def loadAetherInstance(): + return self.loadInstanceCommand(data_aether, instanceManager) + self.ui.actionLoadAetherInstance.triggered.connect(loadAetherInstance) def addSteamLinkIntegrationButtonCommand(): @@ -352,7 +372,7 @@ class LauncherView(QMainWindow): value = steamIntegrationDialog.getText( self, "Add Steam Integration", "steamid" ) - if value[1] == True: + if value[1]: self.ui.steamLinkValue.setText(value[0]) question = QMessageBox() answer = question.question( @@ -370,7 +390,9 @@ class LauncherView(QMainWindow): ) instanceManager.instance.steam_link = value[0] - self.ui.addSteamLinkIntegration.clicked.connect(addSteamLinkIntegrationButtonCommand) + self.ui.addSteamLinkIntegration.clicked.connect( + addSteamLinkIntegrationButtonCommand + ) self.ui.InstancesList.setEnabled(False) @@ -442,7 +464,7 @@ class LauncherView(QMainWindow): self.ui.newsEngineView.setUrl(self.news_feed) instanceManager.instance.display() # TODO : FIX THE INSTANCE SOURCE BEFORE RENABLED THIS FEATURES - if instanceManager.is_installable() == False: + if not instanceManager.is_installable(): self.ui.installButton.setEnabled(False) else: self.ui.installButton.setEnabled(True) diff --git a/src/lce_qt_launcher/views/setting_dialog.py b/src/lce_qt_launcher/views/setting_dialog.py index 7e37409..7a6a33d 100644 --- a/src/lce_qt_launcher/views/setting_dialog.py +++ b/src/lce_qt_launcher/views/setting_dialog.py @@ -1,5 +1,4 @@ from PySide6.QtWidgets import QDialog, QWidget, QMessageBox -from PySide6.QtCore import Qt from lce_qt_launcher.app_context import AppContext import lce_qt_launcher.models.theme as theme @@ -22,9 +21,8 @@ class SettingDialog(QDialog): self.ui_setting.settingsOptions.accepted.connect(self.applyButtonCommand) - comingSoonMsgBox = lambda: QMessageBox().information( - self, "Setting", "Not Implemented Yet!" - ) + def comingSoonMsgBox(): + return QMessageBox().information(self, "Setting", "Not Implemented Yet!") self.ui_setting.settingsOptions.helpRequested.connect(comingSoonMsgBox)