@@ -45,21 +45,6 @@ class CameraApp(Activity):
4545 status_label = None
4646 status_label_cont = None
4747
48- def load_resolution_preference (self ):
49- """Load resolution preference from SharedPreferences and update width/height."""
50- prefs = SharedPreferences ("com.micropythonos.camera" )
51- resolution_str = prefs .get_string ("resolution" , f"{ self .DEFAULT_WIDTH } x{ self .DEFAULT_HEIGHT } " )
52- self .colormode = prefs .get_bool ("colormode" , False )
53- try :
54- width_str , height_str = resolution_str .split ('x' )
55- self .width = int (width_str )
56- self .height = int (height_str )
57- print (f"Camera resolution loaded: { self .width } x{ self .height } " )
58- except Exception as e :
59- print (f"Error parsing resolution '{ resolution_str } ': { e } , using default 320x240" )
60- self .width = self .DEFAULT_WIDTH
61- self .height = self .DEFAULT_HEIGHT
62-
6348 def onCreate (self ):
6449 self .scanqr_mode = self .getIntent ().extras .get ("scanqr_mode" )
6550 self .main_screen = lv .obj ()
@@ -180,6 +165,21 @@ def onPause(self, screen):
180165 print (f"Warning: powering off camera got exception: { e } " )
181166 print ("camera app cleanup done." )
182167
168+ def load_resolution_preference (self ):
169+ """Load resolution preference from SharedPreferences and update width/height."""
170+ prefs = SharedPreferences ("com.micropythonos.camera" )
171+ resolution_str = prefs .get_string ("resolution" , f"{ self .DEFAULT_WIDTH } x{ self .DEFAULT_HEIGHT } " )
172+ self .colormode = prefs .get_bool ("colormode" , False )
173+ try :
174+ width_str , height_str = resolution_str .split ('x' )
175+ self .width = int (width_str )
176+ self .height = int (height_str )
177+ print (f"Camera resolution loaded: { self .width } x{ self .height } " )
178+ except Exception as e :
179+ print (f"Error parsing resolution '{ resolution_str } ': { e } , using default 320x240" )
180+ self .width = self .DEFAULT_WIDTH
181+ self .height = self .DEFAULT_HEIGHT
182+
183183 def update_preview_image (self ):
184184 self .image_dsc = lv .image_dsc_t ({
185185 "header" : {
0 commit comments