Skip to content

Commit 4d3c06c

Browse files
committed
feat(config): 添加版本号到配置文件
- 在配置文件中添加 config_version 字段,存储处理后的版本号
1 parent 915cd3e commit 4d3c06c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

config_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import threading
44
from datetime import datetime
5-
from constants import DEFAULT_GEOMETRY, CONFIG_FILE
5+
from constants import DEFAULT_GEOMETRY, CONFIG_FILE, VERSION
66

77
class ConfigHandler:
88
def __init__(self):
@@ -165,7 +165,10 @@ def save_config(self):
165165
logger.log_debug(f"开始保存配置,最后天气位置: {self.last_weather_location}")
166166

167167
# 准备配置数据(添加窗口位置和缺失的配置项)
168+
# 处理版本号格式:去除点和横杠,只保留数字
169+
cleaned_version = ''.join(c for c in VERSION if c.isdigit())
168170
config_data = {
171+
"config_version": cleaned_version, # 使用特殊字段名并存储处理后的版本号
169172
"geometry": self.geometry if self.geometry else DEFAULT_GEOMETRY,
170173
"countdown_name": self.countdown_name,
171174
"countdown_date": self.countdown_date.strftime("%Y-%m-%d"),

constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
# 程序信息
99
APP_NAME = "桌面课程表 - Course Scheduler"
1010
AUTHOR = "dong"
11-
VERSION = "0.1.15beta"
11+
VERSION = "0.1.15-preview"
1212
PROJECT_URL = "https://github.com/dongkid/course_scheduler"

0 commit comments

Comments
 (0)