fix esp32 run if there's no focus group

This commit is contained in:
Thomas Farstrike
2025-06-11 17:54:21 +02:00
parent b728aa77e3
commit ca57a5ae98
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -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")
@@ -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)