2020
2121from app .tools .personalised import get_theme_icon
2222from app .tools .settings_access import readme_settings_async , update_settings
23+ from app .tools .settings_visibility_manager import is_setting_visible
2324from 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