@@ -24,7 +24,6 @@ class AppStore(Activity):
2424install_label = None
2525please_wait_label = None
2626progress_bar = None
27- _icon_widgets = {}
2827
2928def onCreate (self ):
3029self .main_screen = lv .obj ()
@@ -64,7 +63,7 @@ def download_app_index(self, json_url):
6463print (f"Warning: could not add app from{ json_url } to apps list:{ e } " )
6564# Remove duplicates based on app.name
6665seen = set ()
67- self .apps = [app for app in self .apps if not (app .name in seen or seen .add (app .name ))]
66+ self .apps = [app for app in self .apps if not (app .fullname in seen or seen .add (app .fullname ))]
6867# Sort apps by app.name
6968self .apps .sort (key = lambda x :x .name .lower ())# Use .lower() for case-insensitive sorting
7069time .sleep_ms (200 )
@@ -84,15 +83,12 @@ def create_apps_list(self):
8483apps_list .set_style_radius (0 ,0 )
8584apps_list .set_style_pad_all (0 ,0 )
8685apps_list .set_size (lv .pct (100 ),lv .pct (100 ))
87- # Clear old icons
88- self ._icon_widgets = {}
86+ self ._icon_widgets = {}# Clear old icons
8987print ("create_apps_list iterating" )
9088for app in self .apps :
9189print (app )
9290item = apps_list .add_button (None ,"Test" )
9391item .set_style_pad_all (0 ,0 )
94- #item.set_style_border_width(0, 0)
95- #item.set_style_radius(0, 0)
9692item .set_size (lv .pct (100 ),lv .SIZE_CONTENT )
9793item .add_event_cb (lambda e ,a = app :self .show_app_detail (a ),lv .EVENT .CLICKED ,None )
9894cont = lv .obj (item )
@@ -106,8 +102,8 @@ def create_apps_list(self):
106102icon_spacer = lv .image (cont )
107103icon_spacer .set_size (64 ,64 )
108104icon_spacer .set_src (lv .SYMBOL .REFRESH )
109- self ._icon_widgets [app .fullname ]= icon_spacer
110105icon_spacer .add_event_cb (lambda e ,a = app :self .show_app_detail (a ),lv .EVENT .CLICKED ,None )
106+ app .image_icon_widget = icon_spacer # save it so it can be later set to the actual image
111107label_cont = lv .obj (cont )
112108label_cont .set_style_border_width (0 ,0 )
113109label_cont .set_style_radius (0 ,0 )
@@ -130,17 +126,16 @@ def download_icons(self):
130126print (f"App is stopping, aborting icon downloads." )
131127break
132128if not app .icon_data :
133- print (f"No icon_data found for{ app } , downloading..." )
134129app .icon_data = self .download_icon_data (app .icon_url )
135130if app .icon_data :
136131print ("download_icons has icon_data, showing it..." )
137- icon_widget = self . _icon_widgets . get ( app .fullname )
138- if icon_widget :
132+ image_icon_widget = app .image_icon_widget
133+ if image_icon_widget :
139134image_dsc = lv .image_dsc_t ({
140135'data_size' :len (app .icon_data ),
141136'data' :app .icon_data
142137 })
143- self .update_ui_threadsafe_if_foreground (icon_widget .set_src ,image_dsc )# error: 'App' object has no attribute 'image'
138+ self .update_ui_threadsafe_if_foreground (image_icon_widget .set_src ,image_dsc )# error: 'App' object has no attribute 'image'
144139print ("Finished downloading icons." )
145140
146141def show_app_detail (self ,app ):