Skip to content

Commit 8662df0

Browse files
committed
Hide setting depending on switch state
1 parent cdd170d commit 8662df0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/config_editor/settings.py

+12
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,24 @@ def on_resume(self) -> None:
5656
print("Settings screen resumed. Updating settings.")
5757
self.target_select.set_select_value(self.app.setting_target)
5858
self.enable_copy_switch.value = self.app.setting_enable_copy
59+
if self.app.setting_enable_copy:
60+
self.arduino_path_input.visible = True
61+
else:
62+
self.arduino_path_input.visible = False
5963
self.arduino_path_input.set_input_value(self.app.setting_arduino_path)
6064
self.arduino_branch_input.set_input_value(self.app.setting_arduino_branch)
6165
self.idf_branch_input.set_input_value(self.app.setting_idf_branch)
6266
self.idf_commit_input.set_input_value(self.app.setting_idf_commit)
6367
self.idf_debug_select.set_select_value(self.app.setting_debug_level)
6468

69+
def on_switch_changed(self, event: Switch.Changed) -> None:
70+
# Event handler called when a switch is changed
71+
if event.switch.id == "enable-copy-switch":
72+
if event.switch.value:
73+
self.arduino_path_input.visible = True
74+
else:
75+
self.arduino_path_input.visible = False
76+
6577
def compose(self) -> ComposeResult:
6678
# Compose the target selection screen
6779
yield Header()

0 commit comments

Comments
 (0)