From 65e9cd1058c16de4220fed79b211e572627944a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= <pippin@gimp.org>
Date: Sun, 27 Aug 2023 16:24:32 +0200
Subject: [PATCH] st3m: add a run_app utility

---
 python_payload/st3m/run.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/python_payload/st3m/run.py b/python_payload/st3m/run.py
index 68a3c4613b..b5d2b79098 100644
--- a/python_payload/st3m/run.py
+++ b/python_payload/st3m/run.py
@@ -11,7 +11,12 @@ from st3m.ui.menu import (
 from st3m.ui.elements import overlays
 from st3m.ui.view import View, ViewManager, ViewTransitionBlend
 from st3m.ui.elements.menus import SimpleMenu, SunMenu
-from st3m.application import BundleManager, BundleMetadata, MenuItemAppLaunch
+from st3m.application import (
+    BundleManager,
+    BundleMetadata,
+    MenuItemAppLaunch,
+    ApplicationContext,
+)
 from st3m.about import About
 from st3m import settings, logging, processors, wifi
 
@@ -125,6 +130,10 @@ def run_view(v: View) -> None:
     reactor.run()
 
 
+def run_app(klass):
+    run_view(klass(ApplicationContext()))
+
+
 def _yeet_local_changes() -> None:
     os.remove("/flash/sys/.sys-installed")
     machine.reset()
-- 
GitLab