diff --git a/python_payload/apps/demo_scroll/__init__.py b/python_payload/apps/demo_scroll/__init__.py index c6efb3abc75fa7391c6e397bc632d48e063c4f21..0fd2231310b91888c12de8f28d70bb87e2b0d26c 100644 --- a/python_payload/apps/demo_scroll/__init__.py +++ b/python_payload/apps/demo_scroll/__init__.py @@ -18,6 +18,8 @@ class ScrollDemo(Application): def __init__(self, app_ctx: ApplicationContext) -> None: super().__init__(app_ctx) + # this class is deprecated, please don't use it for new apps + # check out st3m.ui.widgets.Scroller instead! self.scroll = CapScrollController() def draw(self, ctx: Context) -> None: diff --git a/python_payload/st3m/input.py b/python_payload/st3m/input.py index 00aebf7966ca7e035964e6b4acd1464361200c51..023b5407469fc707106c2d72cea8b0ea667172cf 100644 --- a/python_payload/st3m/input.py +++ b/python_payload/st3m/input.py @@ -285,6 +285,8 @@ class TouchableState(Enum): class Touchable: """ + Deprecated, don't use for new applications! + A Touchable processes incoming captouch positional state into higher-level simple gestures. diff --git a/python_payload/st3m/main_menu.py b/python_payload/st3m/main_menu.py index d24f918248a6a388216f44d65f3ac9bf499a6423..23c1763ccefb81e9ed897b9d2483ce64238aa07f 100644 --- a/python_payload/st3m/main_menu.py +++ b/python_payload/st3m/main_menu.py @@ -234,12 +234,30 @@ class RestoreMenu(OSMenu): class ApplicationMenu(RestoreMenu): - def __init__(self, items: List[MenuItem]) -> None: + def __init__(self, items: List[MenuItem], name=None) -> None: super().__init__(items) self._button_latch = True self.input.buttons.app.middle.repeat_enable(1000, 1000) self._vm = None self._update_tags() + self._name = name + + def get_help(self): + if self._name is None: + ret = f"This is an app launcher menu." + else: + ret = f"This is the app launcher menu of the {self._name} category." + + ret += "\n\n" + ( + "You can long-press the app button to open a context menu that " + "allows you to delete apps, sort them to the top of the list " + 'with the "<3" option or start them automatically at boot with the ' + '"boot" option.' + ) + + ret += "\n\n" + super().get_help() + + return ret def _update_tags(self): for item in self._items: @@ -359,6 +377,16 @@ class MenuItemApplicationMenu(MenuItemForeground): ctx.restore() +class SystemMenu(RestoreMenu): + def get_help(self): + ret = ( + "This is the system menu of flow3r, where you can access the app store, " + "change settings, update your firmware and more!" + ) + ret += "\n\n" + super().get_help() + return ret + + class MainMenu(SunMenu): def __init__(self, bundles: Optional[list] = None) -> None: if bundles: @@ -369,6 +397,15 @@ class MainMenu(SunMenu): self.load_menu(reload_bundles=False) + def get_help(self): + ret = ( + "Welcome to flow3r! This is the main menu, where you can select different " + "app categories or download apps and updates and change settings " + "in the System option." + ) + ret += "\n\n" + super().get_help() + return ret + def load_menu(self, reload_bundles: bool = True) -> None: """ (Re)loads the menu. @@ -382,10 +419,9 @@ class MainMenu(SunMenu): def build_menu_items(self) -> None: menu_settings = settings.build_menu() - menu_system = RestoreMenu( + menu_system = SystemMenu( [ MenuItemBack(), - MenuItemLaunchPersistentView("About", About), MenuItemForeground("Settings", menu_settings), MenuItemAppLaunch(BundleMetadata("/flash/sys/apps/gr33nhouse")), MenuItemAppLaunch(BundleMetadata("/flash/sys/apps/updat3r")), @@ -394,6 +430,7 @@ class MainMenu(SunMenu): MenuItemAction("Yeet Local Changes", _yeet_local_changes), MenuItemAction("Clear Autostart", _clear_autostart), MenuItemAction("Reboot", machine.reset), + MenuItemLaunchPersistentView("About", About), ], ) @@ -405,7 +442,7 @@ class MainMenu(SunMenu): categories = [ MenuItemApplicationMenu( - kind, ApplicationMenu([MenuItemApplicationBack()] + entries) + kind, ApplicationMenu([MenuItemApplicationBack()] + entries, name=kind) ) for kind in menu_categories if (entries := _get_bundle_menu_entries(self._bundles, kind)) diff --git a/python_payload/st3m/settings_menu.py b/python_payload/st3m/settings_menu.py index aaf0052ef88cf5d3a5eabdfb69631acb24c63d53..70bb54bd27cdb3985bdba861e4db46e3795d602e 100644 --- a/python_payload/st3m/settings_menu.py +++ b/python_payload/st3m/settings_menu.py @@ -214,6 +214,16 @@ class SettingsMenu(OSMenu): super().select() self.captouch_active = onoff_touch_os.value + def get_help(self): + ret = ( + "This is the settings menu. Right now it's a bit of a unstructured mix " + "with both user-facing and debug options, apologies! You probably don't " + 'want to use "Show FPS", "Debug: ftop" and "Touch Overlay" in regular ' + "operation as these may slow down or outright block regular functionality. " + ) + ret += "\n\n" + super().get_help() + return ret + SIZE_LARGE = 20 SIZE_SMALL = 15 diff --git a/python_payload/st3m/ui/elements/menus.py b/python_payload/st3m/ui/elements/menus.py index 902b57fa5900ef1291d2e5cc88d8b2096f4b9a44..92a565b289bf04eff0c7a15fe7605bfaef996b36 100644 --- a/python_payload/st3m/ui/elements/menus.py +++ b/python_payload/st3m/ui/elements/menus.py @@ -45,13 +45,20 @@ class SimpleMenu(MenuController): item.draw(ctx) ctx.restore() + def get_help(self): + ret = ( + "You can scroll though this menu with the app button left and right. To go " + "back use the os button middle, to go forward use the app button middle." + ) + return ret + class OSMenu(SimpleMenu): def get_help(self): if self.captouch_active: ret = ( "You can scroll though this menu by swiping across petals 2 and 8 or by " - "tapping the other top petals or the app button l/r. To go back use " + "tapping the other top petals or the app button left/right. To go back use " "petals 1 or 9 or the os button middle, to go forward use petals 3 and 7 " "or the app button middle." ) diff --git a/python_payload/st3m/ui/interactions.py b/python_payload/st3m/ui/interactions.py index c0fb5fd66e912f5ab1ca55adf4f928f8498ba0d7..b316e197c5a0bfd26a8a31cec1d7d87f2bb73add 100644 --- a/python_payload/st3m/ui/interactions.py +++ b/python_payload/st3m/ui/interactions.py @@ -175,6 +175,8 @@ class ScrollController(st3m.Responder): class CapScrollController: """ + Deprecated, use st3m.ui.widgets.Scroller instead! + A Capacitive Touch based Scroll Controller. You can think of it as a virtual trackball controlled by a touch petal. It