From ca57a5ae98be0cd57865bbc4f26fdd627fbddce2 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Wed, 11 Jun 2025 17:54:21 +0200 Subject: [PATCH] fix esp32 run if there's no focus group --- internal_filesystem/lib/mpos/apps.py | 4 +++- internal_filesystem/lib/mpos/clipboard.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal_filesystem/lib/mpos/apps.py b/internal_filesystem/lib/mpos/apps.py index 5f1da7e1..dae6832a 100644 --- a/internal_filesystem/lib/mpos/apps.py +++ b/internal_filesystem/lib/mpos/apps.py @@ -346,7 +346,9 @@ class ActivityNavigator: activity._result_callback = result_callback # Pass callback to activity start_time = utime.ticks_ms() # Remove objects from previous screens from the focus group: - lv.group_get_default().remove_all_objs() # might be better to save and restore the group for "back" actions + group = lv.group_get_default() + if group: # on esp32 this may not be set + group.remove_all_objs() # might be better to save and restore the group for "back" actions activity.onCreate() end_time = utime.ticks_diff(utime.ticks_ms(), start_time) print(f"apps.py _launch_activity: activity.onCreate took {end_time}ms") diff --git a/internal_filesystem/lib/mpos/clipboard.py b/internal_filesystem/lib/mpos/clipboard.py index 4ea6c567..391686a7 100644 --- a/internal_filesystem/lib/mpos/clipboard.py +++ b/internal_filesystem/lib/mpos/clipboard.py @@ -11,6 +11,8 @@ def get(): def paste_text(text): # called when CTRL-V is pressed on the keyboard print(f"mpos.ui.clipboard.py paste_text adding {text}") group = lv.group_get_default() + if not group: + return focused_obj = group.get_focused() if focused_obj and isinstance(focused_obj, lv.textarea): focused_obj.add_text(text)