@@ -115,7 +115,13 @@ def on_pan_update(e: ft.DragUpdateEvent):
115
115
page .dark_theme = ft .Theme (color_scheme_seed = settings_values ['app_color' ])
116
116
page .theme = ft .Theme (color_scheme_seed = settings_values ['app_color' ])
117
117
118
- ft .MouseCursor .RESIZE_UP_DOWN
118
+ def page_theme ():
119
+ if settings_values ['dark_theme' ]:
120
+ page .theme_mode = ft .ThemeMode .DARK
121
+ else :
122
+ page .theme_mode = ft .ThemeMode .LIGHT
123
+
124
+ page_theme ()
119
125
120
126
def save_page_dimensions (e ):
121
127
try :
@@ -128,16 +134,13 @@ def save_page_dimensions(e):
128
134
print (f"Something went wrong with saving page dimensions, { e } " )
129
135
130
136
page .on_resize = save_page_dimensions
131
- page .snack_bar = ft .SnackBar (ft .Text ("" , ), duration = 3000 )
137
+ page .snack_bar = ft .SnackBar (ft .Text ("" ) )
132
138
133
139
def update_settings (e ):
134
140
if cg .value :
135
141
settings_values ['app_color' ] = cg .value
136
142
settings_values ['dark_theme' ] = theme_mode .value
137
- if settings_values ['dark_theme' ]:
138
- page .theme_mode = ft .ThemeMode .DARK
139
- else :
140
- page .theme_mode = ft .ThemeMode .LIGHT
143
+ page_theme ()
141
144
results_container .bgcolor = settings_values ['app_color' ]
142
145
printer_wiz_list_container .bgcolor = settings_values ['app_color' ]
143
146
page .dark_theme .color_scheme_seed = settings_values ['app_color' ]
@@ -151,7 +154,7 @@ def update_settings(e):
151
154
load_settings (e , update = True )
152
155
try :
153
156
if e .control .text == "Save" :
154
- show_message ("Settings have been saved." )
157
+ show_message ("Saved." , duration = 700 )
155
158
except AttributeError :
156
159
pass
157
160
page .update ()
@@ -530,7 +533,12 @@ def are_you_sure(e, text, **kwargs):
530
533
close_dynamic_modal (e )
531
534
return answer
532
535
533
- def show_message (message ):
536
+ def show_message (message , ** kwargs ):
537
+ duration = 3000
538
+ for key , value in kwargs .items ():
539
+ if key == "duration" :
540
+ duration = value
541
+ page .snack_bar .duration = duration
534
542
page .snack_bar .content .value = message
535
543
page .snack_bar .open = True
536
544
page .update ()
@@ -2420,7 +2428,7 @@ def clicked(e):
2420
2428
2421
2429
# -------------------- SETTINGS --------------------
2422
2430
# Settings color choice radio
2423
- app_color_label = ft .Text ("App Color :" , )
2431
+ app_color_label = ft .Text ("App appearance :" , )
2424
2432
red_color_radio = ft .Radio (value = "red" , label = "Red" , fill_color = "red" )
2425
2433
blue_color_radio = ft .Radio (value = "blue" , label = "Blue" , fill_color = "blue" )
2426
2434
green_color_radio = ft .Radio (value = "green" , label = "Green" , fill_color = "green" )
@@ -2450,7 +2458,7 @@ def clicked(e):
2450
2458
PowerShell 7, PsTools, and Python's subprocess module to launch built-in custom PowerShell \
2451
2459
scripts to retrieve the information from remote computers and perform other tasks." ], on_click = open_tutorial_modal )
2452
2460
2453
- theme_mode = ft .Switch (label = "Dark Theme" , value = True )
2461
+ theme_mode = ft .Switch (label = "Dark Theme" , value = settings_values [ 'dark_theme' ] )
2454
2462
2455
2463
settings_view = ft .Column ([
2456
2464
ft .Row ([
0 commit comments