Skip to content

Commit 70f1977

Browse files
committed
新增 精简设置模式,仅显示推荐的功能项,减少用户操作难度
1 parent 8488d21 commit 70f1977

14 files changed

Lines changed: 463 additions & 280 deletions

CHANGELOG/v2.1.0/CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
v2.0 - Koharu(小鸟游星野) release 2
2+
3+
## 🚀 主要更新
4+
5+
- 新增 **精简设置模式**,仅显示推荐的功能项,减少用户操作难度
6+
7+
## 💡 功能优化
8+
9+
-
10+
11+
## 🐛 修复问题
12+
13+
-
14+
15+
## 🔧 其它变更
16+
17+
-
18+
19+
---
20+
21+
💝 **感谢所有贡献者为 SecRandom 项目付出的努力!**
22+
23+
<!--
24+
撰写 CHANGELOG.md 时,请统一采用「新增/优化/修复」+「**功能名称**」+「更新内容」的句式,示例:
25+
- 新增 **更新通知弹窗**,「今日不再提醒」选项
26+
- 优化 **课间禁用功能**,点名/抽奖「开始」按钮的禁用提示
27+
- 修复 **DPI 缩放问题**,界面字体与比例异常修复
28+
29+
要求:
30+
1. 关键名称或特性加**粗**;
31+
2. 同类项合并,保持顺序一致。
32+
-->

app/Language/modules/basic_settings.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
"description": "管理软件的数据导入和导出",
99
},
1010
"personalised": {"name": "个性化", "description": "自定义软件外观和用户体验"},
11+
"simplified_mode": {
12+
"name": "精简设置模式",
13+
"description": "隐藏高级设置项,仅显示推荐设置",
14+
"switchbutton_name": {"enable": "", "disable": ""},
15+
},
16+
"simplified_mode_notification": {
17+
"enable": "已开启精简设置模式",
18+
"disable": "已关闭精简设置模式",
19+
},
1120
"autostart": {
1221
"name": "开机自启",
1322
"description": "设置软件是否随系统启动自动运行",
@@ -196,6 +205,14 @@
196205
"name": "Customization",
197206
"description": "Customize the look and experience of software",
198207
},
208+
"simplified_mode": {
209+
"name": "Simplified mode",
210+
"description": "Hide advanced settings, show only recommended settings",
211+
},
212+
"simplified_mode_notification": {
213+
"enable": "Simplified mode enabled",
214+
"disable": "Simplified mode disabled",
215+
},
199216
"autostart": {
200217
"name": "Start on boot",
201218
"description": "Set whether the software is running automatically with the system",

app/page_building/settings_window_page.py

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,24 @@ class notification_settings_page(PivotPageTemplate):
7474
"""创建通知服务页面"""
7575

7676
def __init__(self, parent: QFrame = None, is_preview=False):
77-
page_config = {
78-
"roll_call_notification_settings": get_content_name_async(
79-
"roll_call_notification_settings", "title"
80-
),
81-
"quick_draw_notification_settings": get_content_name_async(
82-
"quick_draw_notification_settings", "title"
83-
),
84-
"lottery_notification_settings": get_content_name_async(
85-
"lottery_notification_settings", "title"
86-
),
87-
# "more_notification_settings": get_content_name_async("more_notification_settings", "title")
88-
}
77+
if readme_settings_async("basic_settings", "simplified_mode"):
78+
page_config = {
79+
"quick_draw_notification_settings": get_content_name_async(
80+
"quick_draw_notification_settings", "title"
81+
),
82+
}
83+
else:
84+
page_config = {
85+
"roll_call_notification_settings": get_content_name_async(
86+
"roll_call_notification_settings", "title"
87+
),
88+
"quick_draw_notification_settings": get_content_name_async(
89+
"quick_draw_notification_settings", "title"
90+
),
91+
"lottery_notification_settings": get_content_name_async(
92+
"lottery_notification_settings", "title"
93+
),
94+
}
8995
super().__init__(page_config, parent, is_preview_mode=is_preview)
9096
self.set_base_path("app.view.settings.notification_settings")
9197

@@ -138,16 +144,20 @@ class more_settings_page(PivotPageTemplate):
138144
"""创建更多设置页面"""
139145

140146
def __init__(self, parent: QFrame = None, is_preview=False):
141-
page_config = {
142-
"fair_draw": get_content_name_async("fair_draw_settings", "title"),
143-
"time_settings": get_content_name_async("time_settings", "title"),
144-
"music_settings": get_content_name_async("music_settings", "title"),
145-
"page_management": get_content_name_async("page_management", "title"),
146-
"sidebar_tray_management": get_content_name_async(
147-
"sidebar_tray_management", "title"
148-
),
149-
# "debug": get_content_name_async("debug", "title"),
150-
}
147+
if readme_settings_async("basic_settings", "simplified_mode"):
148+
page_config = {
149+
"time_settings": get_content_name_async("time_settings", "title"),
150+
}
151+
else:
152+
page_config = {
153+
"fair_draw": get_content_name_async("fair_draw_settings", "title"),
154+
"time_settings": get_content_name_async("time_settings", "title"),
155+
"music_settings": get_content_name_async("music_settings", "title"),
156+
"page_management": get_content_name_async("page_management", "title"),
157+
"sidebar_tray_management": get_content_name_async(
158+
"sidebar_tray_management", "title"
159+
),
160+
}
151161
super().__init__(page_config, parent, is_preview_mode=is_preview)
152162
self.set_base_path("app.view.settings.more_settings")
153163

app/tools/settings_default_storage.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"basic_function": {"default_value": None},
3030
"data_management": {"default_value": None},
3131
"personalised": {"default_value": None},
32+
"simplified_mode": {"default_value": True},
3233
"autostart": {"default_value": False},
3334
"show_startup_window": {"default_value": True},
3435
"background_resident": {"default_value": True},
@@ -197,7 +198,6 @@
197198
"window_mode": {"default_value": None},
198199
"floating_window_mode": {"default_value": None},
199200
"call_notification_service": {"default_value": False},
200-
"notification_mode": {"default_value": 0},
201201
"animation": {"default_value": True},
202202
"auto_close_time": {"default_value": 5},
203203
"enabled_monitor": {"default_value": "OFF"},
@@ -222,7 +222,6 @@
222222
"window_mode": {"default_value": None},
223223
"floating_window_mode": {"default_value": None},
224224
"call_notification_service": {"default_value": True},
225-
"notification_mode": {"default_value": 0},
226225
"animation": {"default_value": True},
227226
"auto_close_time": {"default_value": 5},
228227
"enabled_monitor": {"default_value": "OFF"},
@@ -245,7 +244,6 @@
245244
"window_mode": {"default_value": None},
246245
"floating_window_mode": {"default_value": None},
247246
"call_notification_service": {"default_value": False},
248-
"notification_mode": {"default_value": 0},
249247
"animation": {"default_value": True},
250248
"auto_close_time": {"default_value": 5},
251249
"enabled_monitor": {"default_value": "OFF"},
@@ -287,16 +285,6 @@
287285
"import_version_mismatch_switch": {"default_value": False},
288286
"preview_settings_switch": {"default_value": False},
289287
},
290-
"advanced_safety_settings": {
291-
"title": {"default_value": None},
292-
"strong_protection": {"default_value": None},
293-
"data_encryption": {"default_value": None},
294-
"encryption_strong_switch": {"default_value": False},
295-
"encryption_strong_mode": {"default_value": 0},
296-
"encryption_list_switch": {"default_value": False},
297-
"encryption_history_switch": {"default_value": False},
298-
"encryption_temp_switch": {"default_value": False},
299-
},
300288
"custom_settings": {"title": {"default_value": None}},
301289
"page_management": {
302290
"title": {"default_value": None},
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ==================================================
2+
# 设置项可见性配置
3+
# ==================================================
4+
SETTINGS_VISIBILITY_CONFIG = {
5+
"basic_settings": {
6+
"background_resident": False,
7+
"auto_save_window_size": False,
8+
"url_protocol": False,
9+
"ipc_port": False,
10+
},
11+
"roll_call_settings": {
12+
"use_global_font": False,
13+
"custom_font": False,
14+
"animation_interval": False,
15+
"autoplay_count": False,
16+
"color_theme": False,
17+
},
18+
"quick_draw_settings": {
19+
"use_global_font": False,
20+
"custom_font": False,
21+
"animation_interval": False,
22+
"autoplay_count": False,
23+
"color_theme": False,
24+
},
25+
"lottery_settings": {
26+
"use_global_font": False,
27+
"custom_font": False,
28+
"animation_interval": False,
29+
"autoplay_count": False,
30+
"color_theme": False,
31+
},
32+
"quick_draw_notification_settings": {
33+
"floating_window_enabled_monitor": False,
34+
},
35+
"basic_safety_settings": {
36+
"totp_switch": False,
37+
"restart_switch": False,
38+
"diagnostic_export_switch": False,
39+
"data_export_switch": False,
40+
"import_overwrite_switch": False,
41+
"import_version_mismatch_switch": False,
42+
},
43+
"floating_window_management": {
44+
"floating_window_long_press_duration": False,
45+
"floating_window_stick_to_edge_display_style": False,
46+
"floating_window_draggable": False,
47+
"floating_window_size": False,
48+
},
49+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from app.tools.settings_visibility_config import SETTINGS_VISIBILITY_CONFIG
2+
from app.tools.settings_access import readme_settings_async
3+
4+
5+
def is_setting_visible(category: str, setting_name: str) -> bool:
6+
"""
7+
检查设置项是否可见
8+
9+
Args:
10+
category: 设置类别
11+
setting_name: 设置项名称
12+
is_simplified_mode: 是否为简化模式
13+
14+
Returns:
15+
bool: True表示可见,False表示隐藏
16+
"""
17+
simplified_mode = readme_settings_async("basic_settings", "simplified_mode")
18+
if simplified_mode:
19+
return SETTINGS_VISIBILITY_CONFIG[category][setting_name]
20+
else:
21+
return True

app/view/settings/basic_settings.py

Lines changed: 81 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from app.tools.personalised import get_theme_icon
2222
from app.tools.settings_access import readme_settings_async, update_settings
23+
from app.tools.settings_visibility_manager import is_setting_visible
2324
from app.Language.obtain_language import (
2425
get_all_languages_name,
2526
get_any_position_value_async,
@@ -75,6 +76,25 @@ def __init__(self, parent=None):
7576
self.setTitle(get_content_name_async("basic_settings", "basic_function"))
7677
self.setBorderRadius(8)
7778

79+
# 精简设置模式开关
80+
self.simplified_mode_switch = SwitchButton()
81+
self.simplified_mode_switch.setOffText(
82+
get_content_switchbutton_name_async(
83+
"basic_settings", "simplified_mode", "disable"
84+
)
85+
)
86+
self.simplified_mode_switch.setOnText(
87+
get_content_switchbutton_name_async(
88+
"basic_settings", "simplified_mode", "enable"
89+
)
90+
)
91+
self.simplified_mode_switch.setChecked(
92+
readme_settings_async("basic_settings", "simplified_mode")
93+
)
94+
self.simplified_mode_switch.checkedChanged.connect(
95+
self.__on_simplified_mode_changed
96+
)
97+
7898
# 开机自启设置
7999
self.autostart_switch = SwitchButton()
80100
self.autostart_switch.setOffText(
@@ -179,6 +199,12 @@ def __init__(self, parent=None):
179199
self.url_protocol_switch.checkedChanged.connect(self.__on_url_protocol_changed)
180200

181201
# 添加设置项到分组
202+
self.addGroup(
203+
get_theme_icon("ic_fluent_filter_20_filled"),
204+
get_content_name_async("basic_settings", "simplified_mode"),
205+
get_content_description_async("basic_settings", "simplified_mode"),
206+
self.simplified_mode_switch,
207+
)
182208
self.addGroup(
183209
get_theme_icon("ic_fluent_arrow_sync_20_filled"),
184210
get_content_name_async("basic_settings", "autostart"),
@@ -191,30 +217,61 @@ def __init__(self, parent=None):
191217
get_content_description_async("basic_settings", "show_startup_window"),
192218
self.show_startup_window_switch,
193219
)
194-
self.addGroup(
195-
get_theme_icon("ic_fluent_save_20_filled"),
196-
get_content_name_async("basic_settings", "auto_save_window_size"),
197-
get_content_description_async("basic_settings", "auto_save_window_size"),
198-
self.auto_save_window_size_switch,
199-
)
200-
self.addGroup(
201-
get_theme_icon("ic_fluent_resize_20_filled"),
202-
get_content_name_async("basic_settings", "background_resident"),
203-
get_content_description_async("basic_settings", "background_resident"),
204-
self.resident_switch,
205-
)
206-
self.addGroup(
207-
get_theme_icon("ic_fluent_link_20_filled"),
208-
get_content_name_async("basic_settings", "url_protocol"),
209-
get_content_description_async("basic_settings", "url_protocol"),
210-
self.url_protocol_switch,
211-
)
212-
self.addGroup(
213-
get_theme_icon("ic_fluent_server_20_filled"),
214-
get_content_name_async("basic_settings", "ipc_port"),
215-
get_content_description_async("basic_settings", "ipc_port"),
216-
self.ipc_port_spinbox,
217-
)
220+
if is_setting_visible("basic_settings", "auto_save_window_size"):
221+
self.addGroup(
222+
get_theme_icon("ic_fluent_save_20_filled"),
223+
get_content_name_async("basic_settings", "auto_save_window_size"),
224+
get_content_description_async(
225+
"basic_settings", "auto_save_window_size"
226+
),
227+
self.auto_save_window_size_switch,
228+
)
229+
if is_setting_visible("basic_settings", "background_resident"):
230+
self.addGroup(
231+
get_theme_icon("ic_fluent_resize_20_filled"),
232+
get_content_name_async("basic_settings", "background_resident"),
233+
get_content_description_async("basic_settings", "background_resident"),
234+
self.resident_switch,
235+
)
236+
if is_setting_visible("basic_settings", "url_protocol"):
237+
self.addGroup(
238+
get_theme_icon("ic_fluent_link_20_filled"),
239+
get_content_name_async("basic_settings", "url_protocol"),
240+
get_content_description_async("basic_settings", "url_protocol"),
241+
self.url_protocol_switch,
242+
)
243+
if is_setting_visible("basic_settings", "ipc_port"):
244+
self.addGroup(
245+
get_theme_icon("ic_fluent_server_20_filled"),
246+
get_content_name_async("basic_settings", "ipc_port"),
247+
get_content_description_async("basic_settings", "ipc_port"),
248+
self.ipc_port_spinbox,
249+
)
250+
251+
def __on_simplified_mode_changed(self, checked):
252+
update_settings("basic_settings", "simplified_mode", checked)
253+
if checked:
254+
show_notification(
255+
NotificationType.SUCCESS,
256+
NotificationConfig(
257+
title=get_content_name_async("basic_settings", "simplified_mode"),
258+
content=get_any_position_value_async(
259+
"basic_settings", "simplified_mode_notification", "enable"
260+
),
261+
),
262+
parent=self.window(),
263+
)
264+
else:
265+
show_notification(
266+
NotificationType.INFO,
267+
NotificationConfig(
268+
title=get_content_name_async("basic_settings", "simplified_mode"),
269+
content=get_any_position_value_async(
270+
"basic_settings", "simplified_mode_notification", "disable"
271+
),
272+
),
273+
parent=self.window(),
274+
)
218275

219276
def __on_autostart_changed(self, checked):
220277
update_settings("basic_settings", "autostart", checked)

0 commit comments

Comments
 (0)