forked from taurusduan/EleFunAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaoyan_setting_test.py
More file actions
29 lines (22 loc) · 925 Bytes
/
daoyan_setting_test.py
File metadata and controls
29 lines (22 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from PySide6.QtCore import QSettings
class TestModeManager:
_instance = None
@classmethod
def get_instance(cls):
if cls._instance is None:
cls._instance = cls()
return cls._instance
def __init__(self):
# 使用 QSettings 存储设置,保持跨会话持久化
# Organization: GhostOS, Application: DirectorTestMode
self.settings = QSettings("GhostOS", "DirectorTestMode")
def is_enabled(self):
# 默认值为 False (不开启)
return self.settings.value("test_mode_enabled", False, type=bool)
def set_enabled(self, enabled):
self.settings.setValue("test_mode_enabled", enabled)
# 辅助函数,方便外部调用
def is_test_mode_enabled():
return TestModeManager.get_instance().is_enabled()
def set_test_mode_enabled(enabled):
TestModeManager.get_instance().set_enabled(enabled)