Add config saving feedback in settings.py with print statements and update button label to "Save Config".
This commit is contained in:
@@ -36,21 +36,23 @@ def open_settings_tab(page: ft.Page, tab_manager):
|
|||||||
try:
|
try:
|
||||||
success = storage.save_config(config_field.value)
|
success = storage.save_config(config_field.value)
|
||||||
if success:
|
if success:
|
||||||
|
print("Config saved successfully. Please restart the app.")
|
||||||
page.snack_bar = ft.SnackBar(
|
page.snack_bar = ft.SnackBar(
|
||||||
ft.Text("Config saved successfully. Please restart the app."),
|
ft.Text("Config saved successfully. Please restart the app."),
|
||||||
open=True,
|
open=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
print("Error saving config: Storage operation failed")
|
||||||
page.snack_bar = ft.SnackBar(
|
page.snack_bar = ft.SnackBar(
|
||||||
ft.Text("Error saving config: Storage operation failed"), open=True
|
ft.Text("Error saving config: Storage operation failed"), open=True
|
||||||
)
|
)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
print(f"Error saving config: {ex}")
|
||||||
page.snack_bar = ft.SnackBar(
|
page.snack_bar = ft.SnackBar(
|
||||||
ft.Text(f"Error saving config: {ex}"), open=True
|
ft.Text(f"Error saving config: {ex}"), open=True
|
||||||
)
|
)
|
||||||
page.update()
|
|
||||||
|
|
||||||
save_btn = ft.ElevatedButton("Save and Restart", on_click=on_save_config)
|
save_btn = ft.ElevatedButton("Save Config", on_click=on_save_config)
|
||||||
error_field = ft.TextField(
|
error_field = ft.TextField(
|
||||||
label="Error Logs",
|
label="Error Logs",
|
||||||
value="",
|
value="",
|
||||||
|
|||||||
Reference in New Issue
Block a user