Skip to content

Commit a86ab00

Browse files
Fix appstore
1 parent 5fde5a8 commit a86ab00

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

  • internal_filesystem/builtin/apps/com.micropythonos.appstore/assets

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,30 +264,30 @@ def set_install_label(self, app_fullname):
264264
builtin_app = self.is_builtin_app(app_fullname)
265265
overridden_builtin_app = self.is_overridden_builtin_app(app_fullname)
266266
if not overridden_builtin_app:
267-
is_installed = is_installed_by_name(app_fullname)
267+
is_installed = AppDetail.is_installed_by_name(app_fullname)
268268
if is_installed:
269269
if builtin_app:
270270
if overridden_builtin_app:
271-
action_label = action_label_restore
271+
action_label = self.action_label_restore
272272
else:
273-
action_label = action_label_nothing
273+
action_label = self.action_label_nothing
274274
else:
275-
action_label = action_label_uninstall
275+
action_label = self.action_label_uninstall
276276
else:
277-
action_label = action_label_install
277+
action_label = self.action_label_install
278278
self.install_label.set_text(action_label)
279279

280280

281281
def toggle_install(self, download_url, fullname):
282282
print(f"Install button clicked for {download_url} and fullname {fullname}")
283283
label_text = self.install_label.get_text()
284-
if label_text == action_label_install:
284+
if label_text == self.action_label_install:
285285
try:
286286
_thread.stack_size(mpos.apps.good_stack_size())
287287
_thread.start_new_thread(self.download_and_unzip, (download_url, f"apps/{fullname}", fullname))
288288
except Exception as e:
289289
print("Could not start download_and_unzip thread: ", e)
290-
elif label_text == action_label_uninstall or label_text == action_label_restore:
290+
elif label_text == self.action_label_uninstall or label_text == self.action_label_restore:
291291
print("Uninstalling app....")
292292
try:
293293
_thread.stack_size(mpos.apps.good_stack_size())
@@ -417,26 +417,26 @@ def compare_versions(ver1: str, ver2: str) -> bool:
417417

418418
@staticmethod
419419
def is_builtin_app(app_fullname):
420-
return AppStore.is_installed_by_path(f"builtin/apps/{app_fullname}")
420+
return AppDetail.is_installed_by_path(f"builtin/apps/{app_fullname}")
421421

422422
@staticmethod
423423
def is_overridden_builtin_app(app_fullname):
424-
return AppStore.is_installed_by_path(f"apps/{app_fullname}") and AppStore.is_installed_by_path(f"builtin/apps/{app_fullname}")
424+
return AppDetail.is_installed_by_path(f"apps/{app_fullname}") and AppDetail.is_installed_by_path(f"builtin/apps/{app_fullname}")
425425

426426
@staticmethod
427427
def is_update_available(app_fullname, new_version):
428428
appdir = f"apps/{app_fullname}"
429429
builtinappdir = f"builtin/apps/{app_fullname}"
430430
installed_app=None
431-
if AppStore.is_installed_by_path(appdir):
431+
if AppDetail.is_installed_by_path(appdir):
432432
print(f"{appdir} found, getting version...")
433433
installed_app = mpos.apps.parse_manifest(f"{appdir}/META-INF/MANIFEST.JSON")
434-
elif AppStore.is_installed_by_path(builtinappdir):
434+
elif AppDetail.is_installed_by_path(builtinappdir):
435435
print(f"{builtinappdir} found, getting version...")
436436
installed_app = mpos.apps.parse_manifest(f"{builtinappdir}/META-INF/MANIFEST.JSON")
437437
if not installed_app or installed_app.version == "0.0.0": # special case, if the installed app doesn't have a version number then there's no update
438438
return False
439-
return compare_versions(new_version, installed_app.version)
439+
return AppDetail.compare_versions(new_version, installed_app.version)
440440

441441
@staticmethod
442442
def is_installed_by_path(dir_path):
@@ -452,5 +452,5 @@ def is_installed_by_path(dir_path):
452452
@staticmethod
453453
def is_installed_by_name(app_fullname):
454454
print(f"Checking if app {app_fullname} is installed...")
455-
return AppStore.is_installed_by_path(f"apps/{app_fullname}") or AppStore.is_installed_by_path(f"builtin/apps/{app_fullname}")
455+
return AppDetail.is_installed_by_path(f"apps/{app_fullname}") or AppDetail.is_installed_by_path(f"builtin/apps/{app_fullname}")
456456

0 commit comments

Comments
 (0)