Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f0dfcc

Browse files
Launcher app: use automatically loaded icon_data
1 parentc34fcb6 commit1f0dfcc

File tree

2 files changed

+7
-15
lines changed
  • internal_filesystem/builtin/apps

2 files changed

+7
-15
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def download_icons(self):
129129
ifnotself.has_foreground():
130130
print(f"App is stopping, aborting icon downloads.")
131131
break
132+
#if app.icon_path:
132133
print(f"Downloading icon for{app.name}")
133134
image_dsc=self.download_icon(app.icon_url)
134135
app.image_dsc=image_dsc# save it for the app detail page

‎internal_filesystem/builtin/apps/com.micropythonos.launcher/assets/launcher.py‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def onResume(self, screen):
6060
forappinPackageManager.get_app_list():
6161
ifapp.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-
exceptExceptionase:
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-
exceptExceptionase:
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-
defload_icon(icon_path):
153+
defcreate_icon_dsc(icon_path):
163154
withopen(icon_path,'rb')asf:
164155
image_data=f.read()
165156
image_dsc=lv.image_dsc_t({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp