@@ -15,7 +15,7 @@ def __init__(self):
1515 ("Dark Slate" ,"2f4f4f" ),
1616 ("Forest Green" ,"228b22" ),
1717 ("Piggy Pink" ,"ff69b4" ),
18- ("Matrix Green" ,"00ff00 " ),
18+ ("Matrix Green" ,"03a062 " ),
1919 ("Midnight Blue" ,"191970" ),
2020 ("Nostr Purple" ,"ff00ff" ),
2121 ("Saddle Brown" ,"8b4513" ),
@@ -136,28 +136,23 @@ def onCreate(self):
136136self .radio_container .set_height (lv .SIZE_CONTENT )
137137self .radio_container .set_flex_flow (lv .FLEX_FLOW .COLUMN )
138138self .radio_container .add_event_cb (self .radio_event_handler ,lv .EVENT .CLICKED ,None )
139- # Create radio buttons
139+ # Create radio buttons and check the right one
140140self .active_radio_index = - 1 # none
141- # currently only supports 2 options, could be more generic:
142- if current_setting == ui_options [0 ][1 ]:
143- self .active_radio_index = 0
144- elif current_setting == ui_options [1 ][1 ]:
145- self .active_radio_index = 1
146- # create radio buttons and check the right one
147- for i , (text ,_ )in enumerate (ui_options ):
148- cb = self .create_radio_button (self .radio_container ,text ,i )
149- if i == self .active_radio_index :
141+ for i , (option_text ,option_value )in enumerate (ui_options ):
142+ cb = self .create_radio_button (self .radio_container ,option_text ,i )
143+ if current_setting == option_value :
144+ self .active_radio_index = i
150145cb .add_state (lv .STATE .CHECKED )
151146elif ui and ui == "dropdown" and ui_options :
152147self .dropdown = lv .dropdown (settings_screen_detail )
153148self .dropdown .set_width (lv .pct (100 ))
154149options_with_newlines = "\n " .join (f"{ option [0 ]} ({ option [1 ]} )" for option in ui_options )
155150self .dropdown .set_options (options_with_newlines )
156151# select the right one:
157- for i , (option )in enumerate (ui_options ):
158- if option [ 1 ] == current_setting :
152+ for i , (option_text , option_value )in enumerate (ui_options ):
153+ if current_setting == option_value :
159154self .dropdown .set_selected (i )
160- break
155+ break # no need to check the rest because only one can be selected
161156else :
162157# Textarea for other settings
163158self .textarea = lv .textarea (settings_screen_detail )