mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-08-02 06:09:36 +08:00
feat(theme): 引入 .altheme 主题文件格式与主题管理系统
- 新增 .altheme 文件格式(zip 压缩包包含 info.json 与 theme.qss) - 新增 utils/ThemeUtils.py:主题文件打包/解包/读取工具函数 - 新增 managers/theme/ThemeManager:主题目录管理器,支持导入/列举/删除/应用 - 新增 LightLake 浅色主题 QSS 文件 - 新增 CfgKey.GLOBAL.APPEARANCE.CUSTOM_THEME 配置键 - 配置模板新增 custom_theme 字段 - ALSettingsWidget 接入 ThemeManager,替换裸 QSS 路径模式 - AppInitializer 启动时恢复自定义主题状态 - Zip Slip 防护与线程安全保护
This commit is contained in:
@@ -81,9 +81,17 @@ def _initializeAppearance(
|
||||
saved_style = cfg.get(CfgKey.GLOBAL.APPEARANCE.STYLE, "Fusion")
|
||||
saved_theme = cfg.get(CfgKey.GLOBAL.APPEARANCE.THEME, "system")
|
||||
saved_qss = cfg.get(CfgKey.GLOBAL.APPEARANCE.CUSTOM_QSS, "")
|
||||
saved_custom_theme = cfg.get(CfgKey.GLOBAL.APPEARANCE.CUSTOM_THEME, "")
|
||||
app.setStyle(saved_style)
|
||||
_setActiveStyleName(saved_style)
|
||||
_applyQss(saved_qss)
|
||||
if saved_custom_theme:
|
||||
try:
|
||||
from managers.theme.ThemeManager import instance as themeInstance
|
||||
themeInstance().applyTheme(saved_custom_theme)
|
||||
except Exception:
|
||||
_applyQss(saved_qss)
|
||||
else:
|
||||
_applyQss(saved_qss)
|
||||
_applyTheme(saved_theme)
|
||||
|
||||
def initializeApp(
|
||||
|
||||
Reference in New Issue
Block a user