From ef0cb980f2dede3eb5ab0706d6086e5fe30a4d15 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Wed, 26 Nov 2025 09:25:43 +0100 Subject: [PATCH] Settings app: fix un-checking of radio button --- .../com.micropythonos.settings/assets/settings.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py b/internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py index 37b84e5a..51262e74 100644 --- a/internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py +++ b/internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py @@ -260,18 +260,18 @@ class SettingActivity(Activity): target_obj_state = target_obj.get_state() print(f"target_obj state {target_obj.get_text()} is {target_obj_state}") checked = target_obj_state & lv.STATE.CHECKED + current_checkbox_index = target_obj.get_index() + print(f"current_checkbox_index: {current_checkbox_index}") if not checked: - print("it's not checked, nothing to do!") + if self.active_radio_index == current_checkbox_index: + print(f"unchecking {current_checkbox_index}") + self.active_radio_index = -1 # nothing checked return else: - new_checked = target_obj.get_index() - print(f"new_checked: {new_checked}") - if self.active_radio_index >= 0: + if self.active_radio_index >= 0: # is there something to uncheck? old_checked = self.radio_container.get_child(self.active_radio_index) old_checked.remove_state(lv.STATE.CHECKED) - new_checked_obj = self.radio_container.get_child(new_checked) - new_checked_obj.add_state(lv.STATE.CHECKED) - self.active_radio_index = new_checked + self.active_radio_index = current_checkbox_index def create_radio_button(self, parent, text, index): cb = lv.checkbox(parent)