mirror of
https://github.com/xgui4/LCE-Qt-Launcher.git
synced 2026-07-16 03:50:39 +00:00
added instances loading via files
This commit is contained in:
12
lisezmoi.md
12
lisezmoi.md
@@ -59,7 +59,7 @@ Disponible dans la prochaine version stable, lorsque le programme sera plus stab
|
||||
|
||||
> [!NOTE]
|
||||
> Les versions quotidiennes automatiques sont actuellement instable, très expérimentale et en développement actif.
|
||||
> 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 compilation nocturne en raison des restrictions d'Apple et du fait que je ne possède pas de Mac. En raison d'un problème temporaire, la compilation automatique Linux a été désactivée car elle remplaçait la compilation Windows. Cette fonctionnalité sera réactivée une fois le problème résolu.
|
||||
> 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 compilation nocturne 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 de développement quotidiennes automatiques (Nighly Build), générées automatiquement via GitHub Actions lors de modifications apportées à la branche `nighly`.
|
||||
|
||||
@@ -70,8 +70,8 @@ Sur cette page [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/release
|
||||
- [PySide6](https://pypi.org/project/PySide6/)
|
||||
- [Police Monocraft](https://github.com/IdreesInc/Monocraft) installée
|
||||
- Pour un système de type UNIX
|
||||
- Un serveur d'affichage ou un compositeur (sauf sur macOS où un serveur propriétaire est utilisé)
|
||||
- Bash (Généralement préinstallé sous Linux, mais souvent requis sous *BSD et macOS)
|
||||
- Un serveur d'affichage ou un compositeur (sauf sur macOS où un serveur propriétaire est utilisé)
|
||||
- Bash (Généralement préinstallé sous Linux, mais souvent requis sous *BSD et macOS)
|
||||
|
||||
## Bibliothèques et outils Python utilisés
|
||||
|
||||
@@ -96,13 +96,13 @@ Sur cette page [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/release
|
||||
|
||||
- Autres systèmes *BSD, car Minecraft LCE n'est pas pris en charge sur ceux-ci et Wine n'est pas disponible.
|
||||
- Android : Minecraft LCE a actuellement des ralentissements et des bugs importants sur Android.
|
||||
- macOS : LCE Qt Launcher ne supporte pas officialiement MacOS et n'est pas tester lors des PR, mais la compatibilité POISX devrait permettre de l'utiliser.
|
||||
- macOS : LCE Qt Launcher ne supporte pas officialiement MacOS et n'est pas tester lors des PR, mais la compatibilité POISX devrait permettre de l'utiliser.
|
||||
|
||||
## Remerciements
|
||||
|
||||
- [Prism Launcher](https://github.com/PrismLauncher/PrismLauncher) pour certains éléments et fichiers d'interface utilisateur
|
||||
- [MCLCE/MinecraftConsoles](https://github.com/MCLCE/MinecraftConsoles) pour le portage du jeu pour PC
|
||||
- [pieeebot/neoLegacy](https://github.com/pieeebot/neoLegacy) pour le backportage des mise a jours pour le pc port
|
||||
- [pieeebot/neoLegacy](https://github.com/pieeebot/neoLegacy) pour le backportage des mise a jours pour le pc port
|
||||
|
||||
## Code de conduite
|
||||
|
||||
@@ -111,4 +111,4 @@ Sur cette page [GitHub Release](https://github.com/xgui4/LCE-Qt-Launcher/release
|
||||
|
||||
## Licence
|
||||
|
||||
[GPLv3](license.md)
|
||||
[GPLv3](license.md)
|
||||
|
||||
32
src/about.ui
32
src/about.ui
@@ -186,38 +186,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignmentFlag::AlignHCenter">
|
||||
<widget class="QLabel" name="buildDateLabel">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Build Date:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignmentFlag::AlignHCenter">
|
||||
<widget class="QLabel" name="commitLabel">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Commit:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignmentFlag::AlignHCenter">
|
||||
<widget class="QLabel" name="channelLabel">
|
||||
<property name="cursor">
|
||||
|
||||
@@ -222,11 +222,26 @@ class Instance:
|
||||
if self.instance_source == InstanceSource.LOCAL_INSTALLATION:
|
||||
raise RuntimeError("Error ! Local Installation does not have a download URL")
|
||||
else:
|
||||
raise RuntimeError("Not implemented yet!")
|
||||
raise RuntimeError("Not implemented yet!")
|
||||
|
||||
def display(self) -> None:
|
||||
print(f"Name : {self.name}")
|
||||
print(f"=============================")
|
||||
print(f"installation path : {self.installation_path}")
|
||||
print(f"username : {self.username}")
|
||||
print(f"executable name : {self.exe_name}")
|
||||
print(f"archive file : {self.archive_file}")
|
||||
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"skin : {self.skin_path}")
|
||||
print(f"servers : {self.servers}")
|
||||
|
||||
class InstanceManager:
|
||||
"""_summary_ The Manager for Instances objects
|
||||
"""
|
||||
"""_summary_ The Manager for Instances objects"""
|
||||
def __init__(self, instance : Instance, build_info : BuildInfo, appContext : AppContext):
|
||||
self.instance: Instance = instance
|
||||
from lce_qt_launcher.managers.downloader import Downloader
|
||||
|
||||
@@ -2,15 +2,10 @@ from enum import StrEnum, Enum
|
||||
|
||||
from lce_qt_launcher.app_context import AppContext
|
||||
|
||||
import lce_qt_launcher.views.term_service as term_service
|
||||
import lce_qt_launcher.features as features
|
||||
|
||||
class CmdArgAction(Enum):
|
||||
"""_summary_ The CMD flags Actions
|
||||
|
||||
Args:
|
||||
Enum (_type_): _description_
|
||||
"""
|
||||
"""_summary_ The CMD flags Actions"""
|
||||
GEN_CONFIG = 0
|
||||
PRINT_VERSION = 1
|
||||
PRINT_LICENSE = 2
|
||||
@@ -18,7 +13,6 @@ class CmdArgAction(Enum):
|
||||
PRINT_HELP = 4
|
||||
CLI_VERSION = 5
|
||||
NO_ARGS = 6
|
||||
GUI_ARGUMENTS = 7
|
||||
|
||||
def argsDetected(action :CmdArgAction) -> bool:
|
||||
"""Return True if there is a Args detected, Else Return False"""
|
||||
@@ -34,8 +28,6 @@ class CmdArg(StrEnum):
|
||||
LICENSE_CMD_ARG_SHORT = "-L"
|
||||
ABOUT_CMD_ARG = "--about"
|
||||
ABOUT_CMD_ARG_SHORT = "-a"
|
||||
GUI_ARGS_CMD_ARG = "--gui"
|
||||
GUI_ARGS_CMD_ARG_SHORT = "-g"
|
||||
CLI_VERSION_CMD_ARG = "--cli"
|
||||
CLI_VERSION_CMD_ARG_SHORT = "-cl"
|
||||
HELP_CMD_ARG = "--help"
|
||||
@@ -63,8 +55,6 @@ def parse_args(argv : list[str]) -> CmdArgAction:
|
||||
return CmdArgAction.PRINT_HELP
|
||||
case CmdArg.CLI_VERSION_CMD_ARG, CmdArg.CLI_VERSION_CMD_ARG_SHORT:
|
||||
return CmdArgAction.CLI_VERSION
|
||||
case CmdArg.GUI_ARGS_CMD_ARG | CmdArg.GUI_ARGS_CMD_ARG_SHORT:
|
||||
return CmdArgAction.GUI_ARGUMENTS
|
||||
case _:
|
||||
return CmdArgAction.NO_ARGS
|
||||
|
||||
@@ -91,4 +81,4 @@ def launch_cmd_action(action : CmdArgAction, appContext : AppContext) -> None:
|
||||
elif action == CmdArgAction.CLI_VERSION:
|
||||
features.launch_cli_interface(appContext.instanceMan)
|
||||
else:
|
||||
term_service.print_information("Not Implemented Yet!")
|
||||
pass
|
||||
@@ -13,6 +13,12 @@ from PySide6.QtCore import (
|
||||
qVersion
|
||||
)
|
||||
|
||||
import sys
|
||||
import platform
|
||||
import json
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from lce_qt_launcher.managers.system_manager import SystemManager
|
||||
from lce_qt_launcher.app_context import AppContext
|
||||
from lce_qt_launcher.managers.instance_manager import InstanceManager
|
||||
@@ -28,9 +34,6 @@ 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 sys
|
||||
import platform
|
||||
|
||||
class Launcher(QMainWindow):
|
||||
"""_summary_ The Main Window / Launcher of the QApplcation
|
||||
|
||||
@@ -49,7 +52,7 @@ class Launcher(QMainWindow):
|
||||
self.image_label: str = instanceManager.instance.image
|
||||
self.news_feed: str = instanceManager.instance.news_feed
|
||||
self.instance_name: str = instanceManager.instance.name
|
||||
|
||||
|
||||
STARTING_GAME_MSG = translator.translate("start_game_msg")
|
||||
|
||||
def gen_inst_from_form() -> None:
|
||||
@@ -121,7 +124,7 @@ class Launcher(QMainWindow):
|
||||
pixmap = QPixmap(self.image_label)
|
||||
self.ui.instance_img.setPixmap(pixmap)
|
||||
self.ui.repo_name_branch.setText(self.instance_name)
|
||||
self.ui.newsEngineView.setUrl(self.news_feed)
|
||||
self.ui.newsEngineView.setUrl(self.news_feed)
|
||||
|
||||
def show_setting_dialog() -> None:
|
||||
"""_summary_ Show the setting Dialog
|
||||
@@ -139,11 +142,48 @@ class Launcher(QMainWindow):
|
||||
self.setAutoFillBackground(True)
|
||||
else:
|
||||
term_service.print_error("Cannot set the background")
|
||||
|
||||
|
||||
self.ui: Ui_launcher = Ui_launcher()
|
||||
|
||||
self.ui.setupUi(self)
|
||||
|
||||
arguments: list[str] = QApplication.instance().arguments() if not None else "Error" # pyright: ignore[reportOptionalMemberAccess]
|
||||
|
||||
if len(arguments) > 1:
|
||||
file_arg: str = arguments[1]
|
||||
|
||||
try:
|
||||
path = Path(file_arg)
|
||||
if path.is_file():
|
||||
with path.open("r", encoding="utf-8") as instance:
|
||||
inst_dict: dict[str, str] = json.load(instance) # pyright: ignore[reportAny]
|
||||
instanceManager.instance.load_inst_from_dict(inst_dict)
|
||||
instanceManager.instance.display()
|
||||
self.image_label = instanceManager.instance.image
|
||||
self.news_feed = instanceManager.instance.news_feed
|
||||
self.instance_name = instanceManager.instance.name
|
||||
self.ui.usernameInputBox.setText(instanceManager.instance.username)
|
||||
self.ui.pathInputBox.setText(instanceManager.instance.installation_path)
|
||||
self.ui.repoURLInputBox.setText(instanceManager.instance.repo_url)
|
||||
pixmap = QPixmap(self.image_label)
|
||||
self.ui.instance_img.setPixmap(pixmap)
|
||||
self.ui.repo_name_branch.setText(self.instance_name)
|
||||
self.ui.newsEngineView.setUrl(self.news_feed)
|
||||
else:
|
||||
term_service.print_information("No file argument given or file not found. Loading default instance.")
|
||||
except json.JSONDecodeError as err:
|
||||
term_service.print_error(f"Invalid or corrupted Save File (JSON syntax) : {err.msg} at line {err.lineno}")
|
||||
except (ValueError, TypeError) as err:
|
||||
term_service.print_error(f"Data structure error in Save File : {err}")
|
||||
except PermissionError:
|
||||
term_service.print_error("System Error : Permission denied when reading the file.")
|
||||
except RecursionError:
|
||||
term_service.print_error("System Error : The JSON structure is too deep to be processed.")
|
||||
except Exception as err:
|
||||
term_service.print_error(f"An unexpected error occurred : {err}")
|
||||
else:
|
||||
term_service.print_information("No argument given, start with default instance.")
|
||||
|
||||
self.about: Ui_AboutDialog = Ui_AboutDialog()
|
||||
self.aboutDialog: QDialog = QDialog()
|
||||
|
||||
@@ -158,8 +198,6 @@ class Launcher(QMainWindow):
|
||||
self.about.urlLabel.setText(appContext.buildInfo.git_repo_url)
|
||||
self.about.creditsText.setText("Xgui4")
|
||||
self.about.copyLabel.setText("Copyleft (C) GPLv3 Xgui4")
|
||||
self.about.commitLabel.setText(f"Commit : UNKOWMN")
|
||||
self.about.buildDateLabel.setText(f"Build date : UNKOWN")
|
||||
self.about.channelLabel.setText(f"Channel : {appContext.buildInfo.version_type}")
|
||||
self.about.platformLabel.setText(f"Platform : {platform.release()}")
|
||||
from lce_qt_launcher import license_str
|
||||
|
||||
Reference in New Issue
Block a user