From dd5e6d78034856aef52da4f9c440af6368ffc77b Mon Sep 17 00:00:00 2001 From: RedDeadDepresso <94017243+RedDeadDepresso@users.noreply.github.com> Date: Mon, 25 Dec 2023 17:51:56 +0000 Subject: [PATCH] feat: auto-generate MCE/config.json --- MCE/config.json | 12 ------------ MCE/utils.py | 19 ++++++++++++++++++- module/config/i18n/en-US.json | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) delete mode 100644 MCE/config.json diff --git a/MCE/config.json b/MCE/config.json deleted file mode 100644 index a4bda17..0000000 --- a/MCE/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "ResetDaily": false, - "LastRun": "2023-12-24 21:41:55", - "ResetTime": "11:21:30", - "RechargeAP": true, - "PreferredTemplate": "template1", - "Queue": [], - "Event": false, - "Templates": { - "template1": [] - } -} \ No newline at end of file diff --git a/MCE/utils.py b/MCE/utils.py index 3647a88..139584d 100644 --- a/MCE/utils.py +++ b/MCE/utils.py @@ -1,12 +1,29 @@ import customtkinter import json import sys -from MCE.custom_widgets.ctk_notification import CTkNotification +import os class Config: def __init__(self, linker, config_file): + self.default_config = { + "ResetDaily": False, + "LastRun": "2023-12-24 21:41:55", + "ResetTime": "11:21:30", + "RechargeAP": False, + "PreferredTemplate": "template1", + "Queue": [], + "Event": False, + "Templates": { + "template1": [] + } + } self.linker = linker self.config_file = config_file + + if not os.path.exists(self.config_file): + with open(self.config_file, "w") as f: + json.dump(self.default_config, f, indent=2) + self.config_data = self.read() self.linker.widgets = self.set_values_to_none(self.config_data) self.locked = False diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 6d3bf99..a97c31c 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -52,7 +52,7 @@ }, "Mission": { "name": "Mission/Commissions/Event", - "help": "Open MCE Manager for additional settings" + "help": "Open MCE Manager for additional settings. Must be opened if it's your first time!" }, "Circle": { "name": "Club",