19
19
20
20
from nicegui import elements , ui
21
21
22
+ from openadapt import config
22
23
from openadapt .app .objects import console
23
24
from openadapt .scripts .reset_db import reset_db
24
25
@@ -97,7 +98,29 @@ def sync_switch(
97
98
switch: The switch object.
98
99
prop: The property object.
99
100
"""
100
- switch .value = prop .value
101
+ switch .value = prop .value if hasattr (prop , "value" ) else prop
102
+
103
+
104
+ def set_scrub (value : bool ) -> None :
105
+ """Set the scrubbing value.
106
+
107
+ Args:
108
+ value: The value to set.
109
+ """
110
+ if config .SCRUB_ENABLED != value :
111
+ config .persist_env ("SCRUB_ENABLED" , value )
112
+ config .SCRUB_ENABLED = value
113
+ ui .notify ("Scrubbing enabled." if value else "Scrubbing disabled." )
114
+ ui .notify ("You may need to restart the app for this to take effect." )
115
+
116
+
117
+ def get_scrub () -> bool :
118
+ """Get the scrubbing value.
119
+
120
+ Returns:
121
+ bool: The scrubbing value.
122
+ """
123
+ return config .SCRUB_ENABLED
101
124
102
125
103
126
def set_dark (dark_mode : ui .dark_mode , value : bool ) -> None :
@@ -107,4 +130,6 @@ def set_dark(dark_mode: ui.dark_mode, value: bool) -> None:
107
130
dark_mode: The dark mode object.
108
131
value: The value to set.
109
132
"""
110
- dark_mode .value = value
133
+ if dark_mode .value != value :
134
+ dark_mode .value = value
135
+ config .persist_env ("APP_DARK_MODE" , value )
0 commit comments