From f889657ec62ca2decd03e19ca4611f09969e446f Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Sat, 10 Jan 2026 21:30:05 +0100 Subject: [PATCH] AppStore app: also refresh focus group --- .../assets/appstore.py | 18 ++++++++++++++---- .../lib/mpos/ui/focus_direction.py | 14 +------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/internal_filesystem/builtin/apps/com.micropythonos.appstore/assets/appstore.py b/internal_filesystem/builtin/apps/com.micropythonos.appstore/assets/appstore.py index 55098c25..c309bb45 100644 --- a/internal_filesystem/builtin/apps/com.micropythonos.appstore/assets/appstore.py +++ b/internal_filesystem/builtin/apps/com.micropythonos.appstore/assets/appstore.py @@ -38,6 +38,7 @@ class AppStore(Activity): # Widgets: main_screen = None + app_list = None update_button = None install_button = None install_label = None @@ -146,16 +147,25 @@ class AppStore(Activity): def create_apps_list(self): print("create_apps_list") + print("Hiding please wait label...") self.please_wait_label.add_flag(lv.obj.FLAG.HIDDEN) - apps_list = lv.list(self.main_screen) - self._apply_default_styles(apps_list) - apps_list.set_size(lv.pct(100), lv.pct(100)) + + print("Emptying focus group") + # removing objects or even cleaning the screen doesn't seem to empty the focus group + focusgroup = lv.group_get_default() + if focusgroup: + focusgroup.remove_all_objs() + focusgroup.add_obj(self.settings_button) + + self.apps_list = lv.list(self.main_screen) + self._apply_default_styles(self.apps_list) + self.apps_list.set_size(lv.pct(100), lv.pct(100)) self._icon_widgets = {} # Clear old icons print("create_apps_list iterating") for app in self.apps: print(app) - item = apps_list.add_button(None, "") + item = self.apps_list.add_button(None, "") item.set_style_pad_all(0, 0) item.set_size(lv.pct(100), lv.SIZE_CONTENT) self._add_click_handler(item, self.show_app_detail, app) diff --git a/internal_filesystem/lib/mpos/ui/focus_direction.py b/internal_filesystem/lib/mpos/ui/focus_direction.py index f99a00a0..bfed35fe 100644 --- a/internal_filesystem/lib/mpos/ui/focus_direction.py +++ b/internal_filesystem/lib/mpos/ui/focus_direction.py @@ -144,18 +144,6 @@ def find_closest_obj_in_direction(focus_group, current_focused, direction_degree return closest_obj - - - - - - - - - - - - # This function is missing so emulate it using focus_next(): def emulate_focus_obj(focusgroup, target): if not focusgroup: @@ -168,7 +156,7 @@ def emulate_focus_obj(focusgroup, target): currently_focused = focusgroup.get_focused() #print ("emulate_focus_obj: currently focused:") ; mpos.util.print_lvgl_widget(currently_focused) if currently_focused is target: - print("emulate_focus_obj: found target, stopping") + #print("emulate_focus_obj: found target, stopping") return else: focusgroup.focus_next()