@@ -60,8 +60,7 @@ def onResume(self, screen):
6060 for app in PackageManager .get_app_list ():
6161 if app .category == "launcher" :
6262 continue
63- icon_path = f"{ app .installed_path } /res/mipmap-mdpi/icon_64x64.png"
64- icon_hash = Launcher ._hash_file (icon_path ) # cheap SHA-1 of the icon file
63+ icon_hash = Launcher ._hash_file (app .icon_path ) # cheap SHA-1 of the icon file
6564 current_apps .append ((app .name , app .installed_path , icon_hash ))
6665
6766 # ------------------------------------------------------------------
@@ -111,19 +110,11 @@ def onResume(self, screen):
111110 app_cont .set_scrollbar_mode (lv .SCROLLBAR_MODE .OFF )
112111
113112 # ----- icon ----------------------------------------------------
114- icon_path = f"{ app_dir_fullpath } /res/mipmap-mdpi/icon_64x64.png"
115113 image = lv .image (app_cont )
116- try :
117- image .set_src (Launcher .load_icon (icon_path ))
118- except Exception as e :
119- print (f"Error loading icon { icon_path } : { e } - loading default" )
120- icon_path = "builtin/res/mipmap-mdpi/default_icon_64x64.png"
121- try :
122- image .set_src (Launcher .load_icon (icon_path ))
123- except Exception as e :
124- print (f"Error loading default { icon_path } : { e } - using symbol" )
125- image .set_src (lv .SYMBOL .STOP )
126-
114+ image .set_src (lv .image_dsc_t ({
115+ 'data_size' : len (app .icon_data ),
116+ 'data' : app .icon_data
117+ }))
127118 image .align (lv .ALIGN .TOP_MID , 0 , 0 )
128119 image .set_size (icon_size , icon_size )
129120
@@ -159,7 +150,7 @@ def onResume(self, screen):
159150
160151 # ------------------------------------------------------------------
161152 @staticmethod
162- def load_icon (icon_path ):
153+ def create_icon_dsc (icon_path ):
163154 with open (icon_path , 'rb' ) as f :
164155 image_data = f .read ()
165156 image_dsc = lv .image_dsc_t ({
0 commit comments