From edb57cbe3bb05125e29f6bbd0535982c82222cb6 Mon Sep 17 00:00:00 2001 From: Thomas Lake Date: Sun, 9 Sep 2018 16:05:17 +0100 Subject: [PATCH] Allow default launcher selection This allows e.g. speedlauncher to be used with any of the homescreen apps --- launcher/main.py | 2 +- lib/homescreen.py | 8 +++++++- settings/main.py | 7 +++++++ speedlauncher/main.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/launcher/main.py b/launcher/main.py index a5fe98e..d2498a1 100644 --- a/launcher/main.py +++ b/launcher/main.py @@ -2,7 +2,7 @@ ___title___ = "Launcher" ___license___ = "MIT" -___categories___ = ["System"] +___categories___ = ["System", "Launcher"] ___dependencies___ = ["dialogs", "app", "ugfx_helper"] ___launchable___ = False ___bootstrapped___ = True diff --git a/lib/homescreen.py b/lib/homescreen.py index 5afa460..19bf903 100644 --- a/lib/homescreen.py +++ b/lib/homescreen.py @@ -51,7 +51,13 @@ def sleep_or_exit(interval = 0.5): # todo: do this better - check button multiple times and sleep for only a short while if buttons.is_triggered(tilda.Buttons.BTN_Menu): clean_up() - App("launcher").boot() + launcher = "launcher" + try: + with open("default_launcher.txt", "r") as dl: + launcher=dl.readline() + except OSError: + pass + App(launcher).boot() sleep.sleep(interval) diff --git a/settings/main.py b/settings/main.py index ab344e2..f0bcdfe 100644 --- a/settings/main.py +++ b/settings/main.py @@ -33,12 +33,19 @@ def settings_startup_app(state): def settings_wifi(state): wifi.choose_wifi() +def settings_launcher(state): + apps = app.get_apps("Launcher") + selection = prompt_option([{"title": a.title, "app": a} for a in apps], text="Select App:", none_text="Back", title="Set default launcher") + if selection: + app.write_launch_file(selection["app"].name, "default_launcher.txt") + def settings_main(state): return selection({ "Homescreen Name": change_database_string("Set your name", "homescreen.name"), "Homescreen Callsign": change_database_string("Set your callsign", "homescreen.callsign"), "Wifi": settings_wifi, "Startup app": settings_startup_app, + "Default Launcher": settings_launcher, "Badge Store": settings_badge_store }, none_text="Exit") diff --git a/speedlauncher/main.py b/speedlauncher/main.py index f56174c..a78725d 100644 --- a/speedlauncher/main.py +++ b/speedlauncher/main.py @@ -2,7 +2,7 @@ ___name___ = "Speed Launcher" ___license___ = "WTFPL" -___categories___ = ["System"] +___categories___ = ["System", "Launcher"] ___dependencies___ = ["app", "ugfx_helper"] ___launchable___ = False ___bootstrapped___ = False