File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
internal_filesystem/apps/com.example.launcher/assets Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change 2525 app_cont .set_style_border_width (0 , 0 )
2626 app_cont .set_style_pad_all (0 , 0 )
2727 # Load and display icon
28- #icon_path = f"{base_path }/res/mipmap-mdpi/launcher_icon.png"
28+ #icon_path = f"{app_dir_fullpath }/res/mipmap-mdpi/launcher_icon.png"
2929 icon_path = "/resources/icon_64x64.bin"
30+ #icon_path = "/resources/icon_64x64.png"
3031 image = lv .image (app_cont )
3132 try :
3233 with open (icon_path , 'rb' ) as f :
33- f .seek (12 ) # first 12 bytes are headers
34- image_data = f .read ()
34+ png_data = f .read ()
3535 image_dsc = lv .image_dsc_t ({
36- "header" : {
37- "magic" : lv .IMAGE_HEADER_MAGIC ,
38- "w" : 64 ,
39- "h" : 64 ,
40- "stride" : 64 * 2 ,
41- "cf" : lv .COLOR_FORMAT .RGB565
42- },
43- 'data_size' : len (image_data ),
44- 'data' : image_data
36+ 'data_size' : len (png_data ),
37+ 'data' : png_data
4538 })
4639 image .set_src (image_dsc )
4740 except Exception as e :
4841 print (f"Error loading icon { icon_path } : { e } " )
49- image .set_src (lv .SYMBOL .DUMMY ) # Or use a default image
42+ image .set_src (lv .SYMBOL .STOP ) # square block
5043 image .align (lv .ALIGN .TOP_MID , 0 , 0 )
5144 image .set_size (icon_size , icon_size )
5245 # Create label
You can’t perform that action at this time.
0 commit comments