From 2ce0ca066c4d077e133e2d5e2fa32346b3df745a Mon Sep 17 00:00:00 2001 From: xgui4 <134389196+xgui4@users.noreply.github.com> Date: Mon, 4 May 2026 18:31:13 -0400 Subject: [PATCH] add start of steam launch --- data/guide.jsonc | 3 ++- flake.nix | 2 +- schemas/x-application-lce_inst_config.json | 7 +++++++ src/form.ui | 2 +- src/lce_qt_launcher/managers/instance_manager.py | 7 ++++++- src/lce_qt_launcher/views/launcher.py | 4 ++++ 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/data/guide.jsonc b/data/guide.jsonc index a8fcbbf..56a5112 100644 --- a/data/guide.jsonc +++ b/data/guide.jsonc @@ -19,5 +19,6 @@ // 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 + "version" : "nightly", // version/tag of the release of rhe instance to download + "steam_link" : "steam://rungameid/{number}" } diff --git a/flake.nix b/flake.nix index 2e804fb..e35cac9 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ python = pkgs.python310; nativeBuildInputs = with pkgs; [ - python + python python3Packages.pyside6 python3Packages.shiboken6 python3Packages.requests diff --git a/schemas/x-application-lce_inst_config.json b/schemas/x-application-lce_inst_config.json index f5cfee0..e3ad2a4 100644 --- a/schemas/x-application-lce_inst_config.json +++ b/schemas/x-application-lce_inst_config.json @@ -92,6 +92,13 @@ "Nightly", "v1.0.0b" ] + }, + "steam_link" : { + "description": "Steam id command of the instance", + "type" : "string", + "examples" : [ + "steam://rungameid/{number}" + ] } } } \ No newline at end of file diff --git a/src/form.ui b/src/form.ui index 4f9913d..d33de02 100644 --- a/src/form.ui +++ b/src/form.ui @@ -7,7 +7,7 @@ 0 0 1302 - 910 + 923 diff --git a/src/lce_qt_launcher/managers/instance_manager.py b/src/lce_qt_launcher/managers/instance_manager.py index 22d6b51..3c77304 100644 --- a/src/lce_qt_launcher/managers/instance_manager.py +++ b/src/lce_qt_launcher/managers/instance_manager.py @@ -166,6 +166,7 @@ class Instance(QObject): instance_type : InstanceType = _DEFAULT_INST_TYPE, news_feed : str = _DEFAULT_NEWS_FEED, version : str = _DEFAULT_VERSION, + steam_link : str = "N/A" ) -> None: super().__init__(parent = None, objectName="Instance") self.name: str = name @@ -179,6 +180,7 @@ class Instance(QObject): self.image : str = image self.news_feed : str = news_feed self.version: str = version + self.steam_link : str = steam_link def load_inst_from_dict(self, inst_dict: dict[str, str]) -> None: """_summary_ Load A JSON to a empty Instance Object to import it @@ -197,6 +199,7 @@ class Instance(QObject): 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) + self.steam_link = inst_dict.get("steam_link", "N/A") def get_download_url(self) -> str: """_summary_ Get the download URL of a Instance @@ -233,7 +236,8 @@ class Instance(QObject): "instance_type" : self.instance_type.name, "image" : self.image, "news_feed" : self.news_feed, - "version" : self.version + "version" : self.version, + "steam_link": self.version } return dict_to_return @@ -250,6 +254,7 @@ class Instance(QObject): 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}") # print(f"servers : {self.servers}") class InstanceManager: diff --git a/src/lce_qt_launcher/views/launcher.py b/src/lce_qt_launcher/views/launcher.py index 8195cae..dbc710b 100644 --- a/src/lce_qt_launcher/views/launcher.py +++ b/src/lce_qt_launcher/views/launcher.py @@ -1,4 +1,5 @@ import os +import subprocess from PySide6.QtWidgets import ( QApplication, @@ -279,6 +280,9 @@ class Launcher(QMainWindow): _ = self.ui.actionImport_Instance.triggered.connect(loadInstanceActionCommand) _ = self.ui.actionInstall_Content.triggered.connect(installContentActionCommand) + loadSteam = lambda : 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")) _ = self.ui.actionInstances.triggered.connect(openAppInstancesData)