1212# Used to list and edit all settings:
1313class Settings (SettingsActivity ):
1414
15- def __init__ (self ):
16- super ().__init__ ()
17- self .prefs = mpos .config .SharedPreferences ("com.micropythonos.settings" )
15+ """Override getIntent to provide prefs and settings via Intent extras"""
16+ def getIntent (self ):
1817 theme_colors = [
1918 ("Aqua Blue" , "00ffff" ),
2019 ("Bitcoin Orange" , "f0a010" ),
@@ -40,13 +39,19 @@ def __init__(self):
4039 ("Teal" , "008080" ),
4140 ("Turquoise" , "40e0d0" )
4241 ]
43- self .settings = [
42+ # Create a mock intent-like object with extras
43+ class MockIntent :
44+ def __init__ (self , extras ):
45+ self .extras = extras
46+
47+ return MockIntent ({
48+ "prefs" : mpos .config .SharedPreferences ("com.micropythonos.settings" ),
49+ "settings" : [
4450 # Basic settings, alphabetically:
4551 {"title" : "Light/Dark Theme" , "key" : "theme_light_dark" , "ui" : "radiobuttons" , "ui_options" : [("Light" , "light" ), ("Dark" , "dark" )], "changed_callback" : self .theme_changed },
4652 {"title" : "Theme Color" , "key" : "theme_primary_color" , "placeholder" : "HTML hex color, like: EC048C" , "ui" : "dropdown" , "ui_options" : theme_colors , "changed_callback" : self .theme_changed },
4753 {"title" : "Timezone" , "key" : "timezone" , "ui" : "dropdown" , "ui_options" : [(tz , tz ) for tz in mpos .time .get_timezones ()], "changed_callback" : lambda * args : mpos .time .refresh_timezone_preference ()},
4854 # Advanced settings, alphabetically:
49- #{"title": "Audio Output Device", "key": "audio_device", "ui": "radiobuttons", "ui_options": [("Auto-detect", "auto"), ("I2S (Digital Audio)", "i2s"), ("Buzzer (PWM Tones)", "buzzer"), ("Both I2S and Buzzer", "both"), ("Disabled", "null")], "changed_callback": self.audio_device_changed},
5055 {"title" : "Auto Start App" , "key" : "auto_start_app" , "ui" : "radiobuttons" , "ui_options" : [(app .name , app .fullname ) for app in PackageManager .get_app_list ()]},
5156 {"title" : "Check IMU Calibration" , "key" : "check_imu_calibration" , "ui" : "activity" , "activity_class" : CheckIMUCalibrationActivity },
5257 {"title" : "Calibrate IMU" , "key" : "calibrate_imu" , "ui" : "activity" , "activity_class" : CalibrateIMUActivity },
@@ -56,7 +61,8 @@ def __init__(self):
5661 # This is currently only in the drawer but would make sense to have it here for completeness:
5762 #{"title": "Display Brightness", "key": "display_brightness", "placeholder": "A value from 0 to 100."},
5863 # Maybe also add font size (but ideally then all fonts should scale up/down)
59- ]
64+ ]
65+ })
6066
6167 # Change handlers:
6268 def reset_into_bootloader (self , new_value ):
0 commit comments