88# screens:
99main_screen = None
1010settings_screen = None
11+ settings_screen_detail = None
1112qr_screen = None
1213
1314# widgets
@@ -32,7 +33,6 @@ def __init__(self):
3233 ]
3334 self .keyboard = None
3435 self .textarea = None
35- self .msgbox = None
3636 self .radio_container = None
3737 self .active_radio_index = 0 # Track active radio button index
3838 self .screen = self .create_ui ()
@@ -71,8 +71,6 @@ def create_ui(self):
7171 value .set_style_text_color (lv .color_hex (0x666666 ), 0 )
7272 value .set_pos (0 , 20 )
7373 setting ["value_label" ] = value # Store reference for updating
74-
75- # Add click event to open msgbox
7674 setting_cont .add_event_cb (
7775 lambda e , s = setting : self .open_edit_popup (s ), lv .EVENT .CLICKED , None
7876 )
@@ -157,30 +155,44 @@ def cambutton_cb(self, event):
157155 time .sleep (0.25 )
158156
159157 def open_edit_popup (self , setting ):
158+ global settings_screen_detail
160159 # Close existing msgbox and keyboard if open
161- if self . msgbox :
160+ if settings_screen_detail :
162161 try :
163- self . msgbox .delete ()
162+ settings_screen_detail .delete ()
164163 except Exception as e :
165- print (f"Warning: could not delete msgbox: { e } " )
166- self .msgbox = None
164+ print (f"Warning: could not delete settings_screen_detail: { e } " )
167165 if self .keyboard :
168166 self .keyboard .add_flag (lv .obj .FLAG .HIDDEN )
169167
170168 # Create msgbox
171- self .msgbox = lv .msgbox ()
172- self .msgbox .add_title (setting ["title" ])
173- self .msgbox .set_width (lv .pct (85 ))
174- self .msgbox .center ()
175-
176- # Create content container
177- content = self .msgbox .get_content ()
178- content .set_style_pad_all (10 , 0 )
179- content .set_flex_flow (lv .FLEX_FLOW .COLUMN )
169+ settings_screen_detail = lv .obj ()
170+ settings_screen_detail .set_style_pad_all (10 , 0 )
171+ settings_screen_detail .set_flex_flow (lv .FLEX_FLOW .COLUMN )
172+
173+ top_cont = lv .obj (settings_screen_detail )
174+ top_cont .set_width (lv .pct (100 ))
175+ top_cont .set_height (lv .SIZE_CONTENT )
176+ top_cont .set_style_pad_all (0 , 0 )
177+ top_cont .set_flex_flow (lv .FLEX_FLOW .ROW )
178+ top_cont .set_style_flex_main_place (lv .FLEX_ALIGN .SPACE_BETWEEN , 0 )
179+
180+ setting_label = lv .label (top_cont )
181+ setting_label .set_text (setting ["title" ])
182+ setting_label .align (lv .ALIGN .TOP_LEFT ,0 ,0 )
183+ setting_label .set_style_text_font (lv .font_montserrat_22 , 0 )
184+
185+ # Camera for text
186+ self .cambutton = lv .button (top_cont )
187+ self .cambutton .align (lv .ALIGN .TOP_RIGHT ,0 ,0 )
188+ self .cambuttonlabel = lv .label (self .cambutton )
189+ self .cambuttonlabel .set_text ("CAM" )
190+ self .cambuttonlabel .center ()
191+ self .cambutton .add_event_cb (self .cambutton_cb , lv .EVENT .CLICKED , None )
180192
181193 if setting ["key" ] == "wallet_type" :
182194 # Create container for radio buttons
183- self .radio_container = lv .obj (content )
195+ self .radio_container = lv .obj (settings_screen_detail )
184196 self .radio_container .set_width (lv .pct (100 ))
185197 self .radio_container .set_height (lv .SIZE_CONTENT )
186198 self .radio_container .set_flex_flow (lv .FLEX_FLOW .COLUMN )
@@ -197,23 +209,16 @@ def open_edit_popup(self, setting):
197209 cb .add_state (lv .STATE .CHECKED )
198210 else :
199211 # Textarea for other settings
200- self .textarea = lv .textarea (content )
212+ self .textarea = lv .textarea (settings_screen_detail )
201213 self .textarea .set_width (lv .pct (100 ))
202214 self .textarea .set_height (lv .SIZE_CONTENT )
203215 self .textarea .set_text (self .prefs .get_string (setting ["key" ], "" ))
204216 self .textarea .add_event_cb (self .show_keyboard , lv .EVENT .CLICKED , None )
205217 self .textarea .add_event_cb (self .show_keyboard , lv .EVENT .FOCUSED , None )
206218 self .textarea .add_event_cb (self .hide_keyboard , lv .EVENT .DEFOCUSED , None )
207- # Camera for text
208- self .cambutton = lv .button (self .msgbox )
209- #self.cambutton.align(lv.ALIGN.TOP_RIGHT,0,0)
210- self .cambuttonlabel = lv .label (self .cambutton )
211- self .cambuttonlabel .set_text ("CAM" )
212- self .cambuttonlabel .center ()
213- self .cambutton .add_event_cb (self .cambutton_cb , lv .EVENT .CLICKED , None )
214-
219+
215220 # Button container
216- btn_cont = lv .obj (content )
221+ btn_cont = lv .obj (settings_screen_detail )
217222 btn_cont .set_width (lv .pct (100 ))
218223 btn_cont .set_height (lv .SIZE_CONTENT )
219224 btn_cont .set_style_pad_all (5 , 0 )
@@ -226,9 +231,7 @@ def open_edit_popup(self, setting):
226231 save_label = lv .label (save_btn )
227232 save_label .set_text ("Save" )
228233 save_label .center ()
229- save_btn .add_event_cb (
230- lambda e , s = setting : self .save_setting (s ), lv .EVENT .CLICKED , None
231- )
234+ save_btn .add_event_cb (lambda e , s = setting : self .save_setting (s ), lv .EVENT .CLICKED , None )
232235
233236 # Cancel button
234237 cancel_btn = lv .button (btn_cont )
@@ -238,6 +241,8 @@ def open_edit_popup(self, setting):
238241 cancel_label .center ()
239242 cancel_btn .add_event_cb (self .close_popup , lv .EVENT .CLICKED , None )
240243
244+ mpos .ui .load_screen (settings_screen_detail )
245+
241246 def save_setting (self , setting ):
242247 if setting ["key" ] == "wallet_type" and self .radio_container :
243248 selected_idx = self .active_radio_index
@@ -246,21 +251,19 @@ def save_setting(self, setting):
246251 new_value = self .textarea .get_text ()
247252 else :
248253 new_value = ""
249-
250254 editor = self .prefs .edit ()
251255 editor .put_string (setting ["key" ], new_value )
252256 editor .commit ()
253257 setting ["value_label" ].set_text (new_value if new_value else "Not set" )
254-
255258 if setting ["key" ] == "wallet_type" :
256259 self .update_setting_visibility ()
257-
258260 self .close_popup (None )
259261
260262 def close_popup (self , event ):
261- if self .msgbox :
262- self .msgbox .close ()
263- self .msgbox = None
263+ global settings_screen_detail
264+ mpos .ui .back_screen ()
265+ if settings_screen_detail :
266+ settings_screen_detail .delete ()
264267 if self .keyboard :
265268 self .hide_keyboard ()
266269
@@ -366,7 +369,7 @@ def janitor_cb(timer):
366369 wallet .start (redraw_balance_cb , redraw_payments_cb )
367370 else :
368371 print ("ERROR: could not start any wallet!" ) # maybe call the error callback to show the error to the user
369- elif lv .screen_active () != main_screen and lv .screen_active () != settings_screen and lv .screen_active () != qr_screen :
372+ elif lv .screen_active () != main_screen and lv .screen_active () != settings_screen and lv .screen_active () != qr_screen and lv . screen_active () != settings_screen_detail :
370373 print ("app backgrounded, cleaning up..." )
371374 janitor .delete ()
372375 wallet .stop ()
0 commit comments