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

Commitc34fcb6

Browse files
App class: automatically load icon_data
1 parent12f6dd8 commitc34fcb6

File tree

1 file changed

+12
-2
lines changed
  • internal_filesystem/lib/mpos/app

1 file changed

+12
-2
lines changed

‎internal_filesystem/lib/mpos/app/app.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def __init__(
1010
short_description="",
1111
long_description="",
1212
icon_url="",
13+
icon_path="builtin/res/mipmap-mdpi/default_icon_64x64.png",
1314
download_url="",
1415
fullname="Unknown",
1516
version="0.0.0",
@@ -32,16 +33,25 @@ def __init__(
3233
self.image=None
3334
self.image_dsc=None
3435
self.icon_path=self._find_icon_path()
36+
ifself.icon_path:
37+
self.icon_data=self._load_icon_data(self.icon_path)
3538
self.main_launcher_activity=self._find_main_launcher_activity()
3639

3740
def__str__(self):
38-
returnf"App({self.name}, v{self.version},{self.category})"
41+
returnf"App({self.name}, version{self.version},{self.category})"
42+
43+
def_load_icon_data(self,icon_path):
44+
try:
45+
f=open(icon_path,'rb')
46+
returnf.read()
47+
exceptExceptionase:
48+
print(f"open{icon_path} got error:{e}")
3949

4050
def_check_icon_path(self,tocheck):
4151
try:
4252
#print(f"checking {tocheck}")
4353
st=os.stat(tocheck)
44-
#print(f"_find_icon_pathgot {st}")
54+
print(f"_find_icon_pathfor{tocheck} found{st}")
4555
returntocheck
4656
exceptExceptionase:
4757
#print(f"No app icon found: {e}")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp