Skip to content

Commit 6a9ae72

Browse files
Appstore app: allow time to update UI
1 parent e1964ab commit 6a9ae72

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

internal_filesystem/builtin/apps/com.micropythonos.appstore/assets/appstore.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,27 @@ async def download_app_index(self, json_url):
6666
except Exception as e:
6767
print(f"Warning: could not add app from {json_url} to apps list: {e}")
6868
except Exception as e:
69-
self.please_wait_label.set_text(f"ERROR: could not parse reponse.text JSON: {e}")
69+
self.update_ui_threadsafe_if_foreground(self.please_wait_label.set_text, f"ERROR: could not parse reponse.text JSON: {e}")
7070
return
71+
self.update_ui_threadsafe_if_foreground(self.please_wait_label.set_text, f"Download successful, building list...")
72+
await TaskManager.sleep(0.1) # give the UI time to display the app list before starting to download
7173
print("Remove duplicates based on app.name")
7274
seen = set()
7375
self.apps = [app for app in self.apps if not (app.fullname in seen or seen.add(app.fullname))]
7476
print("Sort apps by app.name")
7577
self.apps.sort(key=lambda x: x.name.lower()) # Use .lower() for case-insensitive sorting
76-
print("Hiding please wait label...")
77-
self.update_ui_threadsafe_if_foreground(self.please_wait_label.add_flag, lv.obj.FLAG.HIDDEN)
7878
print("Creating apps list...")
7979
created_app_list_event = TaskManager.notify_event() # wait for the list to be shown before downloading the icons
8080
self.update_ui_threadsafe_if_foreground(self.create_apps_list, event=created_app_list_event)
8181
await created_app_list_event.wait()
82+
await TaskManager.sleep(0.1) # give the UI time to display the app list before starting to download
8283
print("awaiting self.download_icons()")
8384
await self.download_icons()
8485

8586
def create_apps_list(self):
8687
print("create_apps_list")
88+
print("Hiding please wait label...")
89+
self.please_wait_label.add_flag(lv.obj.FLAG.HIDDEN)
8790
apps_list = lv.list(self.main_screen)
8891
apps_list.set_style_border_width(0, 0)
8992
apps_list.set_style_radius(0, 0)

internal_filesystem/lib/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ This /lib folder contains:
99
- mip.install("collections") # used by aiohttp
1010
- mip.install("unittest")
1111
- mip.install("logging")
12+
- mip.install("aiorepl")
1213

0 commit comments

Comments
 (0)