Skip to content

Commit 742d30c

Browse files
Move is_valid_launcher() to App object
1 parent c70ed72 commit 742d30c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

internal_filesystem/lib/mpos/apps.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def start_app(fullname):
122122
start_script_fullpath = f"{app.installed_path}/{app.main_launcher_activity.get('entrypoint')}"
123123
execute_script(start_script_fullpath, True, app.installed_path + "/assets/", app.main_launcher_activity.get("classname"))
124124
# Launchers have the bar, other apps don't have it
125-
if PackageManager.is_valid_launcher(app):
125+
if app.is_valid_launcher():
126126
mpos.ui.topmenu.open_bar()
127127
else:
128128
mpos.ui.topmenu.close_bar()
@@ -135,9 +135,10 @@ def restart_launcher():
135135
mpos.ui.empty_screen_stack()
136136
# No need to stop the other launcher first, because it exits after building the screen
137137
for app in mpos.package_manager.PackageManager.get_app_list():
138-
if PackageManager.is_valid_launcher(app):
138+
if app.is_valid_launcher():
139139
print(f"Found launcher, starting {app.fullname}")
140140
start_app(app.fullname)
141+
break
141142

142143
class App:
143144
def __init__(self, name, publisher, short_description, long_description, icon_url, download_url, fullname, version, category, activities, installed_path=None):
@@ -180,6 +181,10 @@ def _find_main_launcher_activity(self):
180181
break
181182
return result
182183

184+
def is_valid_launcher(self):
185+
#print(f"checking is_valid_launcher for {app_obj}")
186+
return self.category == "launcher" and self.main_launcher_activity
187+
183188

184189
def parse_manifest(appdir):
185190
print(f"parse_manifest({appdir})")

internal_filesystem/lib/mpos/package_manager.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,3 @@ def is_installed_by_name(app_fullname):
220220
print(f"Checking if app {app_fullname} is installed...")
221221
return PackageManager.is_installed_by_path(f"apps/{app_fullname}") or PackageManager.is_installed_by_path(f"builtin/apps/{app_fullname}")
222222

223-
@staticmethod
224-
def is_valid_launcher(app_obj):
225-
#print(f"checking is_valid_launcher for {app_obj}")
226-
return app_obj.category == "launcher" and app_obj.main_launcher_activity

0 commit comments

Comments
 (0)