1- from mpos .apps import Activity , Intent
1+ from mpos .apps import Activity , ActivityNavigator , Intent
2+
23import mpos .config
34import mpos .ui
45
5- class Hello (Activity ):
6-
7- def onCreate (self ):
8- screen = lv .obj ()
9- label = lv .label (screen )
10- label .set_text ('Hello World!' )
11- label .center ()
12- self .setContentView (screen )
13-
146
157# Used to list and edit all settings:
168class SettingsActivity (Activity ):
@@ -20,9 +12,10 @@ def __init__(self):
2012 self .settings = [
2113 {"title" : "Light/Dark Theme" , "key" : "theme_light_dark" , "value_label" : None , "cont" : None },
2214 {"title" : "Theme Color" , "key" : "theme_primary_color" , "value_label" : None , "cont" : None , "placeholder" : "HTML hex color, like: EC048C" },
15+ {"title" : "Restart to Bootloader" , "key" : "boot_mode" , "value_label" : None , "cont" : None }, # special that doesn't get saved
16+ # This is currently only in the drawer but would make sense to have it here for completeness:
2317 #{"title": "Display Brightness", "key": "display_brightness", "value_label": None, "cont": None, "placeholder": "A value from 0 to 100."},
2418 # Maybe also add font size (but ideally then all fonts should scale up/down)
25- #{"title": "Reboot into Bootloader", "key": "boot_mode", "value_label": None, "cont": None}, # special that doesn't get saved
2619 #{"title": "Timezone", "key": "timezone", "value_label": None, "cont": None, "placeholder": "Example: Europe/Prague"},
2720 ]
2821
@@ -238,6 +231,13 @@ def cambutton_cb_unused(self, event):
238231 self .startActivityForResult (Intent (activity_class = CameraApp ).putExtra ("scanqr_mode" , True ), self .gotqr_result_callback )
239232
240233 def save_setting (self , setting ):
234+ if setting ["key" ] == "boot_mode" and self .radio_container :
235+ if self .active_radio_index == 1 :
236+ from mpos .bootloader import ResetIntoBootloader
237+ intent = Intent (activity_class = ResetIntoBootloader )
238+ ActivityNavigator .startActivity (intent )
239+ return
240+
241241 if ( setting ["key" ] == "theme_light_dark" or setting ["key" ] == "boot_mode" ) and self .radio_container :
242242 if setting ["key" ] == "boot_mode" :
243243 options = [("Normal" , "normal" ), ("Bootloader" , "bootloader" )]
0 commit comments