From d43fc54f985434505523208f9909fd5e62bee92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 09:18:34 +0900 Subject: [PATCH 01/16] fix #98 decode error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/launch.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/DMMGamePlayerFastLauncher/launch.py b/DMMGamePlayerFastLauncher/launch.py index 2592207..55f7871 100644 --- a/DMMGamePlayerFastLauncher/launch.py +++ b/DMMGamePlayerFastLauncher/launch.py @@ -90,9 +90,12 @@ def launch(self, id: str): process = ProcessManager.run([str(game_path.absolute())] + dmm_args) assert process.stdout is not None - for line in process.stdout: - text = line.decode("utf-8").strip() - logging.debug(text) + + if AppConfig.DATA.debug_window.get(): + for line in process.stdout: + logging.debug(decode(line)) + else: + process.wait() class LanchLauncher(CTk): @@ -133,9 +136,11 @@ def launch(self, id: str): process = ProcessManager().run([str(dgp)]) assert process.stdout is not None - for line in process.stdout: - text = line.decode("utf-8").strip() - logging.debug(text) + if AppConfig.DATA.debug_window.get(): + for line in process.stdout: + logging.debug(decode(line)) + else: + process.wait() with DgpSessionWrap() as session: session.read() @@ -145,3 +150,15 @@ def launch(self, id: str): session.cookies.clear() session.write() + + +def decode(s: bytes) -> str: + try: + return s.decode("utf-8").strip() + except Exception: + pass + try: + return s.decode("cp932").strip() + except Exception: + pass + return str(s) From 15deae9c9f55275e91bef440ae4ab1059261864e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 09:31:19 +0900 Subject: [PATCH 02/16] fix #100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py index cfe5c4e..7db1229 100644 --- a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py +++ b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py @@ -16,6 +16,10 @@ def loder(master: LanchLauncher): + DataPathConfig.ACCOUNT.mkdir(exist_ok=True, parents=True) + DataPathConfig.SHORTCUT.mkdir(exist_ok=True, parents=True) + DataPathConfig.SCHTASKS.mkdir(exist_ok=True, parents=True) + config_loder() i18n.load_path.append(str(AssetsPathConfig.I18N)) i18n.set("locale", AppConfig.DATA.lang.get()) @@ -44,10 +48,6 @@ def loder(master: LanchLauncher): if AppConfig.DATA.proxy_https.get() != "": os.environ["HTTPS_PROXY"] = AppConfig.DATA.proxy_https.get() - DataPathConfig.ACCOUNT.mkdir(exist_ok=True) - DataPathConfig.SHORTCUT.mkdir(exist_ok=True) - DataPathConfig.SCHTASKS.mkdir(exist_ok=True) - ctk.set_default_color_theme(str(AssetsPathConfig.THEMES.joinpath(AppConfig.DATA.theme.get()).with_suffix(".json"))) ctk.set_appearance_mode(AppConfig.DATA.appearance_mode.get()) From c6176889e40175f1380989713f3a88e6d3724bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 09:37:26 +0900 Subject: [PATCH 03/16] add i18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/tab/account.py | 2 +- assets/i18n/app.ja.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/DMMGamePlayerFastLauncher/tab/account.py b/DMMGamePlayerFastLauncher/tab/account.py index a8a421c..838856b 100644 --- a/DMMGamePlayerFastLauncher/tab/account.py +++ b/DMMGamePlayerFastLauncher/tab/account.py @@ -258,7 +258,7 @@ def select_callback(self, value: str): children_destroy(self) self.create() - self.toast.info(i18n.t("app.account.auth_success")) + self.toast.info(i18n.t("app.account.device_list_success")) @error_toast def delete_callback(self, id: str): diff --git a/assets/i18n/app.ja.yml b/assets/i18n/app.ja.yml index 73f6068..ea4c3fb 100644 --- a/assets/i18n/app.ja.yml +++ b/assets/i18n/app.ja.yml @@ -94,6 +94,7 @@ ja: メールに記載の英数字を入力してください send_auth_code_success: 認証コードを送信しました。 auth_success: 認証に成功しました。 + device_list_success: デバイス一覧を取得しました。 delete_success: 削除しました。 device_registrations: "登録されたデバイス数 : %{count} / %{limit}" From 699ddec814afaeb28b1606921897862f4780fe68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 09:44:46 +0900 Subject: [PATCH 04/16] add admin check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/tab/shortcut.py | 14 +++++++++----- assets/i18n/app.ja.yml | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/DMMGamePlayerFastLauncher/tab/shortcut.py b/DMMGamePlayerFastLauncher/tab/shortcut.py index cbe5586..4d642f5 100644 --- a/DMMGamePlayerFastLauncher/tab/shortcut.py +++ b/DMMGamePlayerFastLauncher/tab/shortcut.py @@ -105,10 +105,11 @@ def bypass_callback(self): if task.check(): task.set() try: - name, icon = self.get_game_info() + name, icon, admin = self.get_game_info() except Exception: name, icon = self.filename.get(), None self.toast.error(i18n.t("app.shortcut.game_info_error")) + sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") args = ["/run", "/tn", task.name] Shortcut().create(sorce=sorce, target=Env.SCHTASKS, args=args, icon=icon) @@ -120,11 +121,14 @@ def save_callback(self): self.save_check() try: - name, icon = self.get_game_info() + name, icon, admin = self.get_game_info() except Exception: - name, icon = self.filename.get(), None + name, icon, admin = self.filename.get(), None, False self.toast.error(i18n.t("app.shortcut.game_info_error")) + if admin: + raise Exception(i18n.t("app.shortcut.administrator_error")) + sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") args = [self.filename.get()] Shortcut().create(sorce=sorce, args=args, icon=icon) @@ -137,7 +141,7 @@ def save_only_callback(self): self.save() self.toast.info(i18n.t("app.shortcut.save_success")) - def get_game_info(self) -> tuple[str, Path]: + def get_game_info(self) -> tuple[str, Path, bool]: game = [x for x in self.dgp_config["contents"] if x["productId"] == self.data.product_id.get()][0] game_path = Path(game["detail"]["path"]) path = DataPathConfig.ACCOUNT.joinpath(self.data.account_path.get()).with_suffix(".bytes") @@ -152,7 +156,7 @@ def get_game_info(self) -> tuple[str, Path]: title = title.replace(":", "").replace("*", "").replace("?", "") title = title.replace('"', "").replace("<", "").replace(">", "").replace("|", "") - return title, game_path.joinpath(data["exec_file_name"]) + return title, game_path.joinpath(data["exec_file_name"]), data["is_administrator"] class ShortcutEdit(ShortcutCreate): diff --git a/assets/i18n/app.ja.yml b/assets/i18n/app.ja.yml index ea4c3fb..0a7520e 100644 --- a/assets/i18n/app.ja.yml +++ b/assets/i18n/app.ja.yml @@ -55,6 +55,7 @@ ja: product_id_not_entered: product_idが入力されていません。 filename_not_entered: ファイル名が入力されていません。 game_info_error: ゲーム情報の取得に失敗しました。 + administrator_error: 管理者権限が必要です。`UAC自動昇格ショートカット` を作成してください。 file_not_selected: ファイルが選択されていません。 save_success: 保存しました。 delete: 削除 From 220a22507e3bbdb61a98596aa3646a56936e97dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 09:49:28 +0900 Subject: [PATCH 05/16] fix #93 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/component/logger.py | 1 + 1 file changed, 1 insertion(+) diff --git a/DMMGamePlayerFastLauncher/component/logger.py b/DMMGamePlayerFastLauncher/component/logger.py index 543befe..b743781 100644 --- a/DMMGamePlayerFastLauncher/component/logger.py +++ b/DMMGamePlayerFastLauncher/component/logger.py @@ -18,6 +18,7 @@ def __init__(self, master): self.title("Log") self.geometry("600x300") self.box = CTkTextbox(self, height=30) + self.protocol("WM_DELETE_WINDOW", lambda: self.withdraw()) def create(self): self.box.pack(fill=ctk.BOTH, padx=10, pady=(0, 10), expand=True) From 37d81cea9cd5ed79d2233e381c448a6d341b5306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 11:23:28 +0900 Subject: [PATCH 06/16] add url launch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- .../DMMGamePlayerFastLauncher.py | 1 + DMMGamePlayerFastLauncher/launch.py | 17 +- .../models/shortcut_data.py | 6 + DMMGamePlayerFastLauncher/static/config.py | 1 + DMMGamePlayerFastLauncher/tab/shortcut.py | 238 +++++++++++++----- assets/i18n/app.ja.yml | 9 + 6 files changed, 199 insertions(+), 73 deletions(-) diff --git a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py index 7db1229..51577eb 100644 --- a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py +++ b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py @@ -17,6 +17,7 @@ def loder(master: LanchLauncher): DataPathConfig.ACCOUNT.mkdir(exist_ok=True, parents=True) + DataPathConfig.ACCOUNT_SHORTCUT.mkdir(exist_ok=True, parents=True) DataPathConfig.SHORTCUT.mkdir(exist_ok=True, parents=True) DataPathConfig.SCHTASKS.mkdir(exist_ok=True, parents=True) diff --git a/DMMGamePlayerFastLauncher/launch.py b/DMMGamePlayerFastLauncher/launch.py index 55f7871..f992269 100644 --- a/DMMGamePlayerFastLauncher/launch.py +++ b/DMMGamePlayerFastLauncher/launch.py @@ -14,7 +14,7 @@ from lib.thread import threading_wrapper from lib.toast import ErrorWindow from models.setting_data import AppConfig -from models.shortcut_data import ShortcutData +from models.shortcut_data import LauncherShortcutData, ShortcutData from static.config import DataPathConfig from static.env import Env from tab.home import HomeTab @@ -125,15 +125,22 @@ def thread(self, id: str): raise def launch(self, id: str): - path = DataPathConfig.ACCOUNT.joinpath(id).with_suffix(".bytes") + path = DataPathConfig.ACCOUNT_SHORTCUT.joinpath(id).with_suffix(".json") + with open(path, "r", encoding="utf-8") as f: + data = LauncherShortcutData.from_dict(json.load(f)) + + account_path = DataPathConfig.ACCOUNT.joinpath(data.account_path.get()).with_suffix(".bytes") + with DgpSessionWrap() as session: - session.read_bytes(str(path)) + session.read_bytes(str(account_path)) if session.cookies.get("login_secure_id", **session.cookies_kwargs) is None: raise Exception(i18n.t("app.launch.export_error")) session.write() dgp = AppConfig.DATA.dmm_game_player_program_folder.get_path().joinpath("DMMGamePlayer.exe").absolute() - process = ProcessManager().run([str(dgp)]) + + dmm_args = data.dgp_args.get().split(" ") + process = ProcessManager().run([str(dgp)] + dmm_args) assert process.stdout is not None if AppConfig.DATA.debug_window.get(): @@ -146,7 +153,7 @@ def launch(self, id: str): session.read() if session.cookies.get("login_secure_id", **session.cookies_kwargs) is None: raise Exception(i18n.t("app.launch.import_error")) - session.write_bytes(str(path)) + session.write_bytes(str(account_path)) session.cookies.clear() session.write() diff --git a/DMMGamePlayerFastLauncher/models/shortcut_data.py b/DMMGamePlayerFastLauncher/models/shortcut_data.py index bc20e36..67eb884 100644 --- a/DMMGamePlayerFastLauncher/models/shortcut_data.py +++ b/DMMGamePlayerFastLauncher/models/shortcut_data.py @@ -12,3 +12,9 @@ class ShortcutData(VariableBase): game_args: StringVar = field(default_factory=StringVar) auto_update: BooleanVar = field(default_factory=lambda: BooleanVar(value=True)) game_type: StringVar = field(default_factory=lambda: StringVar(value="GCL")) + + +@dataclass +class LauncherShortcutData(VariableBase): + account_path: PathVar = field(default_factory=PathVar) + dgp_args: StringVar = field(default_factory=StringVar) diff --git a/DMMGamePlayerFastLauncher/static/config.py b/DMMGamePlayerFastLauncher/static/config.py index ec32595..dbd9897 100644 --- a/DMMGamePlayerFastLauncher/static/config.py +++ b/DMMGamePlayerFastLauncher/static/config.py @@ -6,6 +6,7 @@ class DataPathConfig(Dump): DATA = Path("data") ACCOUNT = DATA.joinpath("account") + ACCOUNT_SHORTCUT = DATA.joinpath("account_shortcut") SHORTCUT = DATA.joinpath("shortcut") APP_CONFIG = DATA.joinpath("config.json") SCHTASKS = DATA.joinpath("schtasks") diff --git a/DMMGamePlayerFastLauncher/tab/shortcut.py b/DMMGamePlayerFastLauncher/tab/shortcut.py index 4d642f5..0613236 100644 --- a/DMMGamePlayerFastLauncher/tab/shortcut.py +++ b/DMMGamePlayerFastLauncher/tab/shortcut.py @@ -10,7 +10,7 @@ from lib.DGPSessionWrap import DgpSessionWrap from lib.process_manager import Schtasks, Shortcut from lib.toast import ToastController, error_toast -from models.shortcut_data import ShortcutData +from models.shortcut_data import LauncherShortcutData, ShortcutData from static.config import DataPathConfig from static.env import Env from utils.utils import children_destroy, file_create @@ -30,6 +30,7 @@ def create(self): self.tab.add(text=i18n.t("app.tab.create"), callback=self.create_callback) self.tab.add(text=i18n.t("app.tab.edit"), callback=self.edit_callback) self.tab.add(text=i18n.t("app.tab.launch_create"), callback=self.launch_create_callback) + self.tab.add(text=i18n.t("app.tab.launch_edit"), callback=self.launch_edit_callback) return self def create_callback(self, master: CTkBaseClass): @@ -39,13 +40,16 @@ def edit_callback(self, master: CTkBaseClass): ShortcutEdit(master).create().pack(expand=True, fill=ctk.BOTH) def launch_create_callback(self, master: CTkBaseClass): - AccountShortcutCreate(master).create().pack(expand=True, fill=ctk.BOTH) + LauncherShortcutCreate(master).create().pack(expand=True, fill=ctk.BOTH) + + def launch_edit_callback(self, master: CTkBaseClass): + LauncherShortcutEdit(master).create().pack(expand=True, fill=ctk.BOTH) # ===== Shortcut Body ===== -class ShortcutCreate(CTkScrollableFrame): +class ShortcutBase(CTkScrollableFrame): toast: ToastController data: ShortcutData filename: StringVar @@ -63,9 +67,6 @@ def __init__(self, master: Frame): self.account_name_list = [x.stem for x in DataPathConfig.ACCOUNT.iterdir() if x.suffix == ".bytes"] def create(self): - if not self.winfo_children(): - CTkLabel(self, text=i18n.t("app.shortcut.add_detail"), justify=ctk.LEFT).pack(anchor=ctk.W) - EntryComponent(self, text=i18n.t("app.shortcut.filename"), tooltip=i18n.t("app.shortcut.filename_tooltip"), required=True, variable=self.filename).create() text = i18n.t("app.shortcut.product_id") OptionMenuComponent(self, text=text, tooltip=i18n.t("app.shortcut.product_id_tooltip"), values=self.product_ids, variable=self.data.product_id).create() @@ -83,61 +84,63 @@ def create(self): CTkButton(self, text=i18n.t("app.shortcut.save_only"), command=self.save_only_callback).pack(fill=ctk.X, pady=5) return self - def save_check(self, exists=False): + def save(self): if self.data.product_id.get() == "": raise Exception(i18n.t("app.shortcut.product_id_not_entered")) if self.filename.get() == "": raise Exception(i18n.t("app.shortcut.filename_not_entered")) + if self.data.account_path.get() == "": + raise Exception(i18n.t("app.shortcut.account_path_not_entered")) path = DataPathConfig.SHORTCUT.joinpath(self.filename.get()).with_suffix(".json") - if not exists: - file_create(path, name=i18n.t("app.shortcut.filename")) - - def save(self): - path = DataPathConfig.SHORTCUT.joinpath(self.filename.get()).with_suffix(".json") + file_create(path, name=i18n.t("app.shortcut.filename")) with open(path, "w", encoding="utf-8") as f: f.write(json.dumps(self.data.to_dict())) @error_toast def bypass_callback(self): - self.save_check() - task = Schtasks(self.filename.get()) - if task.check(): - task.set() + self.save() try: - name, icon, admin = self.get_game_info() + task = Schtasks(self.filename.get()) + if task.check(): + task.set() + try: + name, icon, admin = self.get_game_info() + except Exception: + name, icon = self.filename.get(), None + self.toast.error(i18n.t("app.shortcut.game_info_error")) + + sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") + args = ["/run", "/tn", task.name] + Shortcut().create(sorce=sorce, target=Env.SCHTASKS, args=args, icon=icon) + self.toast.info(i18n.t("app.shortcut.save_success")) except Exception: - name, icon = self.filename.get(), None - self.toast.error(i18n.t("app.shortcut.game_info_error")) - - sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") - args = ["/run", "/tn", task.name] - Shortcut().create(sorce=sorce, target=Env.SCHTASKS, args=args, icon=icon) - self.save() - self.toast.info(i18n.t("app.shortcut.save_success")) + DataPathConfig.SHORTCUT.joinpath(self.filename.get()).with_suffix(".json").unlink() + raise @error_toast def save_callback(self): - self.save_check() - + self.save() try: - name, icon, admin = self.get_game_info() + try: + name, icon, admin = self.get_game_info() + except Exception: + name, icon, admin = self.filename.get(), None, False + self.toast.error(i18n.t("app.shortcut.game_info_error")) + + if admin: + raise Exception(i18n.t("app.shortcut.administrator_error")) + + sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") + args = [self.filename.get()] + Shortcut().create(sorce=sorce, args=args, icon=icon) + self.toast.info(i18n.t("app.shortcut.save_success")) except Exception: - name, icon, admin = self.filename.get(), None, False - self.toast.error(i18n.t("app.shortcut.game_info_error")) - - if admin: - raise Exception(i18n.t("app.shortcut.administrator_error")) - - sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") - args = [self.filename.get()] - Shortcut().create(sorce=sorce, args=args, icon=icon) - self.save() - self.toast.info(i18n.t("app.shortcut.save_success")) + DataPathConfig.SHORTCUT.joinpath(self.filename.get()).with_suffix(".json").unlink() + raise @error_toast def save_only_callback(self): - self.save_check() self.save() self.toast.info(i18n.t("app.shortcut.save_success")) @@ -159,7 +162,15 @@ def get_game_info(self) -> tuple[str, Path, bool]: return title, game_path.joinpath(data["exec_file_name"]), data["is_administrator"] -class ShortcutEdit(ShortcutCreate): +class ShortcutCreate(ShortcutBase): + def create(self): + if not self.winfo_children(): + CTkLabel(self, text=i18n.t("app.shortcut.add_detail"), justify=ctk.LEFT).pack(anchor=ctk.W) + super().create() + return self + + +class ShortcutEdit(ShortcutBase): selected: StringVar values: list[str] @@ -184,20 +195,17 @@ def create(self): def save(self): selected = DataPathConfig.SHORTCUT.joinpath(self.selected.get()).with_suffix(".json") - selected.unlink() - super().save() - self.values.remove(self.selected.get()) - self.values.append(self.filename.get()) - self.selected.set(self.filename.get()) - self.option_callback("_") - - def save_check(self): - path = DataPathConfig.SHORTCUT.joinpath(self.filename.get()).with_suffix(".json") - selected = DataPathConfig.SHORTCUT.joinpath(self.selected.get()).with_suffix(".json") - if path == selected: - super().save_check(exists=True) - else: - super().save_check() + selected.rename(selected.with_suffix(".json.bak")) + try: + super().save() + selected.with_suffix(".json.bak").unlink() + self.values.remove(self.selected.get()) + self.values.append(self.filename.get()) + self.selected.set(self.filename.get()) + self.option_callback("_") + except Exception: + selected.with_suffix(".json.bak").rename(selected.with_suffix(".json")) + raise @error_toast def delete_callback(self): @@ -219,32 +227,126 @@ def read(self) -> ShortcutData: return ShortcutData.from_dict(json.load(f)) -class AccountShortcutCreate(CTkScrollableFrame): +class LauncherShortcutBase(CTkScrollableFrame): toast: ToastController account_name_list: list[str] - account_path: StringVar + filename: StringVar + data: LauncherShortcutData def __init__(self, master: Frame): super().__init__(master, fg_color="transparent") self.toast = ToastController(self) self.account_name_list = [x.stem for x in DataPathConfig.ACCOUNT.iterdir() if x.suffix == ".bytes"] - self.account_path = StringVar() + self.filename = StringVar() + self.data = LauncherShortcutData() def create(self): - CTkLabel(self, text=i18n.t("app.shortcut.account_create_detail"), justify=ctk.LEFT).pack(anchor=ctk.W) + text = i18n.t("app.shortcut.filename") + EntryComponent(self, text=i18n.t("app.shortcut.filename"), tooltip=i18n.t("app.shortcut.filename_tooltip"), required=True, variable=self.filename).create() text = i18n.t("app.shortcut.account_path") - OptionMenuComponent(self, text=text, values=self.account_name_list, variable=self.account_path).create() - CTkButton(self, text=i18n.t("app.shortcut.create_shortcut_and_save"), command=self.callback).pack(fill=ctk.X, pady=5) + OptionMenuComponent(self, text=text, values=self.account_name_list, variable=self.data.account_path).create() + text = i18n.t("app.shortcut.dgp_args") + EntryComponent(self, text=text, tooltip=i18n.t("app.shortcut.dgp_args_tooltip"), variable=self.data.dgp_args).create() + + PaddingComponent(self, height=5).create() + CTkButton(self, text=i18n.t("app.shortcut.create_shortcut_and_save"), command=self.save_callback).pack(fill=ctk.X, pady=5) + CTkButton(self, text=i18n.t("app.shortcut.save_only"), command=self.save_only_callback).pack(fill=ctk.X, pady=5) return self - @error_toast - def callback(self): - if self.account_path.get() == "": + def save(self): + if self.filename.get() == "": + raise Exception(i18n.t("app.shortcut.filename_not_entered")) + if self.data.account_path.get() == "": raise Exception(i18n.t("app.shortcut.file_not_selected")) - name = self.account_path.get() - sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") - args = [name, "--type", "launcher"] - Shortcut().create(sorce=sorce, args=args) + path = DataPathConfig.ACCOUNT_SHORTCUT.joinpath(self.filename.get()).with_suffix(".json") + file_create(path, name=i18n.t("app.shortcut.filename")) + with open(path, "w", encoding="utf-8") as f: + f.write(json.dumps(self.data.to_dict())) + @error_toast + def save_callback(self): + self.save() + try: + name = self.filename.get() + sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") + args = [name, "--type", "launcher"] + Shortcut().create(sorce=sorce, args=args) + self.toast.info(i18n.t("app.shortcut.save_success")) + except Exception: + DataPathConfig.ACCOUNT_SHORTCUT.joinpath(self.filename.get()).with_suffix(".json").unlink() + raise + + @error_toast + def save_only_callback(self): + self.save() self.toast.info(i18n.t("app.shortcut.save_success")) + + +class LauncherShortcutCreate(LauncherShortcutBase): + toast: ToastController + account_name_list: list[str] + filename: StringVar + data: LauncherShortcutData + + def create(self): + CTkLabel(self, text=i18n.t("app.shortcut.account_create_detail"), justify=ctk.LEFT).pack(anchor=ctk.W) + super().create() + return self + + +class LauncherShortcutEdit(LauncherShortcutBase): + selected: StringVar + values: list[str] + + def __init__(self, master: Frame): + super().__init__(master) + self.values = [x.stem for x in DataPathConfig.ACCOUNT_SHORTCUT.iterdir() if x.suffix == ".json"] + self.selected = StringVar() + + def create(self): + CTkLabel(self, text=i18n.t("app.shortcut.account_edit_detail"), justify=ctk.LEFT).pack(anchor=ctk.W) + + LabelComponent(self, text=i18n.t("app.shortcut.file_select")).create() + CTkOptionMenu(self, values=self.values, variable=self.selected, command=self.option_callback).pack(fill=ctk.X) + + if self.selected.get() in self.values: + self.data = self.read() + super().create() + self.filename.set(self.selected.get()) + CTkButton(self, text=i18n.t("app.shortcut.delete"), command=self.delete_callback).pack(fill=ctk.X, pady=5) + + return self + + def save(self): + selected = DataPathConfig.ACCOUNT_SHORTCUT.joinpath(self.selected.get()).with_suffix(".json") + selected.rename(selected.with_suffix(".json.bak")) + try: + super().save() + selected.with_suffix(".json.bak").unlink() + self.values.remove(self.selected.get()) + self.values.append(self.filename.get()) + self.selected.set(self.filename.get()) + self.option_callback("_") + except Exception: + selected.with_suffix(".json.bak").rename(selected.with_suffix(".json")) + raise + + @error_toast + def delete_callback(self): + path = DataPathConfig.ACCOUNT_SHORTCUT.joinpath(self.selected.get()).with_suffix(".json") + path.unlink() + self.values.remove(self.selected.get()) + self.selected.set("") + self.option_callback("_") + self.toast.info(i18n.t("app.shortcut.save_success")) + + @error_toast + def option_callback(self, _: str): + children_destroy(self) + self.create() + + def read(self) -> LauncherShortcutData: + path = DataPathConfig.ACCOUNT_SHORTCUT.joinpath(self.selected.get()).with_suffix(".json") + with open(path, "r", encoding="utf-8") as f: + return LauncherShortcutData.from_dict(json.load(f)) diff --git a/assets/i18n/app.ja.yml b/assets/i18n/app.ja.yml index 0a7520e..2ed1cc1 100644 --- a/assets/i18n/app.ja.yml +++ b/assets/i18n/app.ja.yml @@ -12,6 +12,7 @@ ja: create: 作成 edit: 編集 launch_create: ランチャー作成 + launch_edit: ランチャー編集 import: インポート device: デバイス登録 device_list: デバイス一覧 @@ -60,6 +61,14 @@ ja: save_success: 保存しました。 delete: 削除 + account_edit_detail: ショートカットの設定ファイルを編集します。 + dgp_args: DMMGamePlayerの引数 + dgp_args_tooltip: |- + DMMGamePlayerに渡す引数を指定します。 + 例えば `dmmgameplayer://play/GCL/priconner/cl/win` と入力すると + DMMGamePlayerが起動した際にプリコネRが起動します。 + 空欄の場合はDMMGamePlayerのみが起動します。 + account: import_detail: |- DMMGamePlayerのアカウント情報をFastLauncherにインポートします。 From 8a1f1f08b207f1a8aa817c729fb99286307cd61e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 11:41:31 +0900 Subject: [PATCH 07/16] update 5.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/static/env.py | 2 +- setup.iss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DMMGamePlayerFastLauncher/static/env.py b/DMMGamePlayerFastLauncher/static/env.py index d460377..979a187 100644 --- a/DMMGamePlayerFastLauncher/static/env.py +++ b/DMMGamePlayerFastLauncher/static/env.py @@ -8,7 +8,7 @@ class Env(Dump): - VERSION = "v5.1.2" + VERSION = "v5.2.0" RELEASE_VERSION = requests.get(UrlConfig.RELEASE_API).json().get("tag_name", VERSION) DEVELOP: bool = os.environ.get("ENV") == "DEVELOP" diff --git a/setup.iss b/setup.iss index 903e0a0..48d6fd9 100644 --- a/setup.iss +++ b/setup.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "DMMGamePlayerFastLauncher" -#define MyAppVersion "5.1.2" +#define MyAppVersion "5.2.0" #define MyAppPublisher "yuki" #define MyAppURL "https://github.com/fa0311/DMMGamePlayerFastLauncher" #define MyAppExeName "DMMGamePlayerFastLauncher.exe" From 7f8f8cd8fc5e58af841490c7419bb663d1e42d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 12:11:11 +0900 Subject: [PATCH 08/16] fix icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/tab/shortcut.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DMMGamePlayerFastLauncher/tab/shortcut.py b/DMMGamePlayerFastLauncher/tab/shortcut.py index 0613236..f4f756e 100644 --- a/DMMGamePlayerFastLauncher/tab/shortcut.py +++ b/DMMGamePlayerFastLauncher/tab/shortcut.py @@ -10,6 +10,7 @@ from lib.DGPSessionWrap import DgpSessionWrap from lib.process_manager import Schtasks, Shortcut from lib.toast import ToastController, error_toast +from models.setting_data import AppConfig from models.shortcut_data import LauncherShortcutData, ShortcutData from static.config import DataPathConfig from static.env import Env @@ -271,7 +272,8 @@ def save_callback(self): name = self.filename.get() sorce = Env.DESKTOP.joinpath(name).with_suffix(".lnk") args = [name, "--type", "launcher"] - Shortcut().create(sorce=sorce, args=args) + icon = AppConfig.DATA.dmm_game_player_program_folder.get_path().joinpath("DMMGamePlayer.exe") + Shortcut().create(sorce=sorce, args=args, icon=icon) self.toast.info(i18n.t("app.shortcut.save_success")) except Exception: DataPathConfig.ACCOUNT_SHORTCUT.joinpath(self.filename.get()).with_suffix(".json").unlink() From 2cb9676f43770ee53a5fd36a0ff1f5fda65fa6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 12:11:17 +0900 Subject: [PATCH 09/16] fix log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/launch.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/DMMGamePlayerFastLauncher/launch.py b/DMMGamePlayerFastLauncher/launch.py index f992269..4c6c7f8 100644 --- a/DMMGamePlayerFastLauncher/launch.py +++ b/DMMGamePlayerFastLauncher/launch.py @@ -91,11 +91,8 @@ def launch(self, id: str): process = ProcessManager.run([str(game_path.absolute())] + dmm_args) assert process.stdout is not None - if AppConfig.DATA.debug_window.get(): - for line in process.stdout: - logging.debug(decode(line)) - else: - process.wait() + for line in process.stdout: + logging.debug(decode(line)) class LanchLauncher(CTk): @@ -143,11 +140,8 @@ def launch(self, id: str): process = ProcessManager().run([str(dgp)] + dmm_args) assert process.stdout is not None - if AppConfig.DATA.debug_window.get(): - for line in process.stdout: - logging.debug(decode(line)) - else: - process.wait() + for line in process.stdout: + logging.debug(decode(line)) with DgpSessionWrap() as session: session.read() From c6aeee987ed3e31b16d91409ce7f47a2d5c182f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 8 Sep 2023 23:47:53 +0900 Subject: [PATCH 10/16] fix #101 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/launch.py | 4 ++-- DMMGamePlayerFastLauncher/lib/process_manager.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DMMGamePlayerFastLauncher/launch.py b/DMMGamePlayerFastLauncher/launch.py index 4c6c7f8..dad4d2d 100644 --- a/DMMGamePlayerFastLauncher/launch.py +++ b/DMMGamePlayerFastLauncher/launch.py @@ -78,7 +78,7 @@ def launch(self, id: str): if response["data"]["latest_version"] != game["detail"]["version"]: if data.auto_update.get(): - download = session.download(response["data"]["file_list_url"], game_path.parent) + download = session.download(response["data"]["file_list_url"], game_file) box = CTkProgressWindow(self).create() for progress, file in download: box.set(progress) @@ -88,7 +88,7 @@ def launch(self, id: str): dmm_args = response["data"]["execute_args"].split(" ") + data.game_args.get().split(" ") - process = ProcessManager.run([str(game_path.absolute())] + dmm_args) + process = ProcessManager.run([str(game_path.relative_to(game_file))] + dmm_args, cwd=str(game_file)) assert process.stdout is not None for line in process.stdout: diff --git a/DMMGamePlayerFastLauncher/lib/process_manager.py b/DMMGamePlayerFastLauncher/lib/process_manager.py index 5e5007e..21cf322 100644 --- a/DMMGamePlayerFastLauncher/lib/process_manager.py +++ b/DMMGamePlayerFastLauncher/lib/process_manager.py @@ -26,9 +26,9 @@ def admin_check() -> bool: return False @staticmethod - def run(args: list[str]) -> subprocess.Popen[bytes]: - logging.info(args) - return subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + def run(args: list[str], cwd: Optional[str] = None) -> subprocess.Popen: + logging.info({"cwd": cwd, "args": args}) + return subprocess.Popen(args, cwd=cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @staticmethod def run_ps(args: str) -> int: From 05ef5e79a6ae1ca7b26ecd1ab69abf0d159acfac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 11 Sep 2023 10:20:03 +0900 Subject: [PATCH 11/16] update dgp lunch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/launch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DMMGamePlayerFastLauncher/launch.py b/DMMGamePlayerFastLauncher/launch.py index dad4d2d..965b84d 100644 --- a/DMMGamePlayerFastLauncher/launch.py +++ b/DMMGamePlayerFastLauncher/launch.py @@ -134,10 +134,10 @@ def launch(self, id: str): raise Exception(i18n.t("app.launch.export_error")) session.write() - dgp = AppConfig.DATA.dmm_game_player_program_folder.get_path().joinpath("DMMGamePlayer.exe").absolute() + dgp = AppConfig.DATA.dmm_game_player_program_folder.get_path() dmm_args = data.dgp_args.get().split(" ") - process = ProcessManager().run([str(dgp)] + dmm_args) + process = ProcessManager.run(["DMMGamePlayer.exe"] + dmm_args, cwd=str(dgp.absolute())) assert process.stdout is not None for line in process.stdout: From 1a5f89ecc9f9cc6ff485212ca7dc9a8d1f613a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 11 Sep 2023 10:39:41 +0900 Subject: [PATCH 12/16] update error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/lib/DGPSessionV2.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DMMGamePlayerFastLauncher/lib/DGPSessionV2.py b/DMMGamePlayerFastLauncher/lib/DGPSessionV2.py index 6cd494f..802940e 100644 --- a/DMMGamePlayerFastLauncher/lib/DGPSessionV2.py +++ b/DMMGamePlayerFastLauncher/lib/DGPSessionV2.py @@ -243,6 +243,9 @@ def download_save(file: dict): f.write(content) return file["size"], file + if data["data"]["page"] > 1: + raise Exception("Not supported multiple pages") + size = sum([x["size"] for x in data["data"]["file_list"]]) download_size = 0 From 3c4a1569fcff271bc5d5238d38db2f6bbb4413de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 11 Sep 2023 11:13:09 +0900 Subject: [PATCH 13/16] update CTkProgressWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/component/component.py | 10 ++++++++-- assets/i18n/app.ja.yml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DMMGamePlayerFastLauncher/component/component.py b/DMMGamePlayerFastLauncher/component/component.py index d41e5ab..36c7878 100644 --- a/DMMGamePlayerFastLauncher/component/component.py +++ b/DMMGamePlayerFastLauncher/component/component.py @@ -243,6 +243,7 @@ def no(self): class CTkProgressWindow(CTkToplevel): + label: CTkLabel progress: CTkProgressBar now: int max: int @@ -250,6 +251,7 @@ class CTkProgressWindow(CTkToplevel): def __init__(self, master: Misc, now: int = 0, max: int = 1): super().__init__(master) self.geometry("300x100") + self.label = CTkLabel(self, text="0.00%", justify=ctk.LEFT, anchor=ctk.W) self.progress = CTkProgressBar(self, width=300) self.deiconify() @@ -260,15 +262,19 @@ def __init__(self, master: Misc, now: int = 0, max: int = 1): self.max = max def create(self): - CTkLabel(self, text=i18n.t("app.component.download")).pack(side=ctk.TOP, fill=ctk.X, expand=True, padx=10, pady=10) - self.progress.pack(expand=True, fill="x", padx=10, pady=10) + CTkLabel(self, text=i18n.t("app.component.download")).pack(fill=ctk.X, expand=True, padx=10, pady=(10, 0)) + self.label.pack(fill=ctk.X, expand=True, padx=10, pady=0) + self.progress.pack(fill=ctk.X, expand=True, padx=10, pady=(0, 10)) + self.progress.set(self.now / self.max) return self def add(self, value: int): self.now += value self.progress.set(self.now / self.max) + self.label.configure(text=f"{(self.now / self.max * 100):.2f}%") def set(self, value: int): self.now = value self.progress.set(self.now / self.max) + self.label.configure(text=f"{(self.now / self.max * 100):.2f}%") diff --git a/assets/i18n/app.ja.yml b/assets/i18n/app.ja.yml index 2ed1cc1..fa3d9dc 100644 --- a/assets/i18n/app.ja.yml +++ b/assets/i18n/app.ja.yml @@ -157,7 +157,7 @@ ja: "yes": はい "no": いいえ - download: ダウンロード + download: ダウンロード中です... toast: report: 報告 From c89f7b3199a7ba77306e48cdb4cb64ce0fd433e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 11 Sep 2023 11:51:18 +0900 Subject: [PATCH 14/16] add output_logfile conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- .../DMMGamePlayerFastLauncher.py | 47 ++++++++++++------- .../models/setting_data.py | 1 + DMMGamePlayerFastLauncher/static/config.py | 1 + DMMGamePlayerFastLauncher/tab/setting.py | 1 + assets/i18n/app.ja.yml | 1 + 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py index 51577eb..59b9637 100644 --- a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py +++ b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py @@ -1,6 +1,7 @@ import argparse import logging import os +import time import customtkinter as ctk import i18n @@ -25,24 +26,38 @@ def loder(master: LanchLauncher): i18n.load_path.append(str(AssetsPathConfig.I18N)) i18n.set("locale", AppConfig.DATA.lang.get()) - if AppConfig.DATA.debug_window.get() and not logging.getLogger().hasHandlers(): + handlers = [] + + if AppConfig.DATA.output_logfile.get() and not any([isinstance(x, logging.FileHandler) for x in logging.getLogger().handlers]): + DataPathConfig.LOG.mkdir(exist_ok=True, parents=True) + handler = logging.FileHandler(DataPathConfig.LOG.joinpath(f"{time.strftime('%Y%m%d%H%M%S')}.log")) + handlers.append(handler) + + if AppConfig.DATA.debug_window.get() and not any([isinstance(x, LoggingHandler) for x in logging.getLogger().handlers]): handler = LoggingHandler(TkinkerLogger(master).create().box, scheme=StyleScheme) handler.setFormatter(ColoredFormatter("[%(levelname)s] [%(asctime)s] %(message)s")) - logging.basicConfig(level=logging.DEBUG, handlers=[handler]) - - logging.debug("==================================================") - logging.debug("===== DMMGamePlayerFastLauncher Environment =====") - logging.debug("==================================================") - logging.debug(Env.dump()) - logging.debug(AppConfig.DATA.to_dict()) - logging.debug(AppConfig.DEVICE.to_dict()) - logging.debug(DataPathConfig.dump()) - logging.debug(AssetsPathConfig.dump()) - logging.debug(UrlConfig.dump()) - logging.debug(SchtasksConfig.dump()) - logging.debug("==================================================") - logging.debug("==================================================") - logging.debug("==================================================") + handlers.append(handler) + + if not any([isinstance(x, logging.StreamHandler) for x in logging.getLogger().handlers]): + handler = logging.StreamHandler() + handler.setFormatter(ColoredFormatter("[%(levelname)s] [%(asctime)s] %(message)s")) + handlers.append(handler) + + logging.basicConfig(level=logging.DEBUG, handlers=handlers) + + logging.debug("==================================================") + logging.debug("===== DMMGamePlayerFastLauncher Environment =====") + logging.debug("==================================================") + logging.debug(Env.dump()) + logging.debug(AppConfig.DATA.to_dict()) + logging.debug(AppConfig.DEVICE.to_dict()) + logging.debug(DataPathConfig.dump()) + logging.debug(AssetsPathConfig.dump()) + logging.debug(UrlConfig.dump()) + logging.debug(SchtasksConfig.dump()) + logging.debug("==================================================") + logging.debug("==================================================") + logging.debug("==================================================") if AppConfig.DATA.proxy_http.get() != "": os.environ["HTTP_PROXY"] = AppConfig.DATA.proxy_http.get() diff --git a/DMMGamePlayerFastLauncher/models/setting_data.py b/DMMGamePlayerFastLauncher/models/setting_data.py index 30ad9b9..be6c823 100644 --- a/DMMGamePlayerFastLauncher/models/setting_data.py +++ b/DMMGamePlayerFastLauncher/models/setting_data.py @@ -18,6 +18,7 @@ class SettingData(VariableBase): appearance_mode: StringVar = field(default_factory=lambda: StringVar(value="dark")) window_scaling: DoubleVar = field(default_factory=lambda: DoubleVar(value=1.0)) debug_window: BooleanVar = field(default_factory=lambda: BooleanVar(value=False)) + output_logfile: BooleanVar = field(default_factory=lambda: BooleanVar(value=False)) def update(self): DgpSessionV2.DGP5_PATH = self.dmm_game_player_program_folder.get_path() diff --git a/DMMGamePlayerFastLauncher/static/config.py b/DMMGamePlayerFastLauncher/static/config.py index dbd9897..9a43e74 100644 --- a/DMMGamePlayerFastLauncher/static/config.py +++ b/DMMGamePlayerFastLauncher/static/config.py @@ -8,6 +8,7 @@ class DataPathConfig(Dump): ACCOUNT = DATA.joinpath("account") ACCOUNT_SHORTCUT = DATA.joinpath("account_shortcut") SHORTCUT = DATA.joinpath("shortcut") + LOG = DATA.joinpath("log") APP_CONFIG = DATA.joinpath("config.json") SCHTASKS = DATA.joinpath("schtasks") DEVICE = DATA.joinpath("device.json") diff --git a/DMMGamePlayerFastLauncher/tab/setting.py b/DMMGamePlayerFastLauncher/tab/setting.py index 27aeab2..ede653c 100644 --- a/DMMGamePlayerFastLauncher/tab/setting.py +++ b/DMMGamePlayerFastLauncher/tab/setting.py @@ -66,6 +66,7 @@ def create(self): PaddingComponent(self, height=5).create() CheckBoxComponent(self, text=i18n.t("app.setting.debug_window"), variable=self.data.debug_window).create() + CheckBoxComponent(self, text=i18n.t("app.setting.output_logfile"), variable=self.data.output_logfile).create() PaddingComponent(self, height=5).create() CTkButton(self, text=i18n.t("app.setting.save"), command=self.save_callback).pack(fill=ctk.X, pady=10) diff --git a/assets/i18n/app.ja.yml b/assets/i18n/app.ja.yml index fa3d9dc..6c618be 100644 --- a/assets/i18n/app.ja.yml +++ b/assets/i18n/app.ja.yml @@ -125,6 +125,7 @@ ja: window_scaling: ウィンドウの拡大率 debug_window: デバッグウィンドウ + output_logfile: ログをファイル出力 device_detail: |- デバイス認証に使用するデバイス情報を設定します。 From 5033c537c5a5f61843d7074d6fbc65a7a17f9e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 11 Sep 2023 11:59:33 +0900 Subject: [PATCH 15/16] add log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py index 59b9637..17f7c05 100644 --- a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py +++ b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py @@ -1,6 +1,7 @@ import argparse import logging import os +import sys import time import customtkinter as ctk @@ -55,6 +56,7 @@ def loder(master: LanchLauncher): logging.debug(AssetsPathConfig.dump()) logging.debug(UrlConfig.dump()) logging.debug(SchtasksConfig.dump()) + logging.debug(sys.argv) logging.debug("==================================================") logging.debug("==================================================") logging.debug("==================================================") From 6dcc937755e30d4bc9b65cc2a2b9b717564b23d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Mon, 11 Sep 2023 12:12:36 +0900 Subject: [PATCH 16/16] fix encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py index 17f7c05..feb2cb5 100644 --- a/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py +++ b/DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py @@ -31,7 +31,7 @@ def loder(master: LanchLauncher): if AppConfig.DATA.output_logfile.get() and not any([isinstance(x, logging.FileHandler) for x in logging.getLogger().handlers]): DataPathConfig.LOG.mkdir(exist_ok=True, parents=True) - handler = logging.FileHandler(DataPathConfig.LOG.joinpath(f"{time.strftime('%Y%m%d%H%M%S')}.log")) + handler = logging.FileHandler(DataPathConfig.LOG.joinpath(f"{time.strftime('%Y%m%d%H%M%S')}.log"), encoding="utf-8") handlers.append(handler) if AppConfig.DATA.debug_window.get() and not any([isinstance(x, LoggingHandler) for x in logging.getLogger().handlers]):