File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
internal_filesystem/builtin/apps/com.micropythonos.settings/assets Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -260,18 +260,18 @@ def radio_event_handler(self, event):
260260 target_obj_state = target_obj .get_state ()
261261 print (f"target_obj state { target_obj .get_text ()} is { target_obj_state } " )
262262 checked = target_obj_state & lv .STATE .CHECKED
263+ current_checkbox_index = target_obj .get_index ()
264+ print (f"current_checkbox_index: { current_checkbox_index } " )
263265 if not checked :
264- print ("it's not checked, nothing to do!" )
266+ if self .active_radio_index == current_checkbox_index :
267+ print (f"unchecking { current_checkbox_index } " )
268+ self .active_radio_index = - 1 # nothing checked
265269 return
266270 else :
267- new_checked = target_obj .get_index ()
268- print (f"new_checked: { new_checked } " )
269- if self .active_radio_index >= 0 :
271+ if self .active_radio_index >= 0 : # is there something to uncheck?
270272 old_checked = self .radio_container .get_child (self .active_radio_index )
271273 old_checked .remove_state (lv .STATE .CHECKED )
272- new_checked_obj = self .radio_container .get_child (new_checked )
273- new_checked_obj .add_state (lv .STATE .CHECKED )
274- self .active_radio_index = new_checked
274+ self .active_radio_index = current_checkbox_index
275275
276276 def create_radio_button (self , parent , text , index ):
277277 cb = lv .checkbox (parent )
You can’t perform that action at this time.
0 commit comments