关于界面初始化和设置的代码清理和功能更新

This commit is contained in:
moyanj 2024-09-09 22:55:00 +08:00
parent 7794ccf886
commit 08c625d991
2 changed files with 3 additions and 5 deletions

View File

@ -2,6 +2,4 @@ from PyQt5.QtWidgets import QWidget
class AboutWidget(QWidget): class AboutWidget(QWidget):
def __init__(self, typex="init"): def __init__(self, typex="init"):
self.init_ui()
def init_ui()

View File

@ -35,7 +35,7 @@ class SettingWidget(QWidget):
def save(self): def save(self):
# 保存配置到 JSON 文件 # 保存配置到 JSON 文件
with open("config.json", "w") as config_file: with open(os.path.join(env.dirs.user_config_path, "config.json"), "w") as config_file:
config_file.write(self.c1.toPlainText()) config_file.write(self.c1.toPlainText())
InfoBar.success( InfoBar.success(
@ -50,7 +50,7 @@ class SettingWidget(QWidget):
def reload(self): def reload(self):
# 重新加载 JSON 配置 # 重新加载 JSON 配置
with open("config.json", "r") as config_file: with open(os.path.join(env.dirs.user_config_path, "config.json"), "r") as config_file:
config_data = config_file.read() config_data = config_file.read()
self.c1.setPlainText(config_data) self.c1.setPlainText(config_data)