Skip to content

Commit 7a35d2f

Browse files
appstore: correct button states instead of clickable
1 parent af8e807 commit 7a35d2f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

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

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def create_apps_list(self):
8686
for app in self.apps:
8787
item = apps_list.add_button(None, "Test")
8888
item.set_style_pad_all(0, 0)
89-
item.add_flag(lv.obj.FLAG.CLICKABLE)
9089
item.set_size(lv.pct(100), lv.SIZE_CONTENT)
9190
item.add_event_cb(lambda e, a=app: self.show_app_detail(a), lv.EVENT.CLICKED, None)
9291
cont = lv.obj(item)
@@ -218,7 +217,6 @@ def onCreate(self):
218217
buttoncont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
219218
print(f"Adding (un)install button for url: {app.download_url}")
220219
self.install_button = lv.button(buttoncont)
221-
self.install_button.add_flag(lv.obj.FLAG.CLICKABLE)
222220
self.install_button.add_event_cb(lambda e, d=app.download_url, f=app.fullname: self.toggle_install(d,f), lv.EVENT.CLICKED, None)
223221
self.install_button.set_size(lv.pct(100), 40)
224222
self.install_label = lv.label(self.install_button)
@@ -304,7 +302,7 @@ def update_button_click(self, download_url, fullname):
304302
print("Could not start download_and_unzip thread: ", e)
305303

306304
def uninstall_app(self, app_folder, app_fullname):
307-
self.install_button.remove_flag(lv.obj.FLAG.CLICKABLE) # TODO: change color so it's clear the button is not clickable
305+
self.install_button.add_state(lv.STATE.DISABLED)
308306
self.install_label.set_text("Please wait...") # TODO: Put "Cancel" if cancellation is possible
309307
self.progress_bar.remove_flag(lv.obj.FLAG.HIDDEN)
310308
self.progress_bar.set_value(33, lv.ANIM.ON)
@@ -321,14 +319,14 @@ def uninstall_app(self, app_folder, app_fullname):
321319
self.progress_bar.add_flag(lv.obj.FLAG.HIDDEN)
322320
self.progress_bar.set_value(0, lv.ANIM.OFF)
323321
self.set_install_label(app_fullname)
324-
self.install_button.add_flag(lv.obj.FLAG.CLICKABLE)
322+
self.install_button.remove_state(lv.STATE.DISABLED)
325323
if self.is_builtin_app(app_fullname):
326324
self.update_button.remove_flag(lv.obj.FLAG.HIDDEN)
327325
self.install_button.set_size(lv.pct(47), 40) # if a builtin app was removed, then it was overridden, and a new version is available, so make space for update button
328326

329327

330328
def download_and_unzip(self, zip_url, dest_folder, app_fullname):
331-
self.install_button.remove_flag(lv.obj.FLAG.CLICKABLE) # TODO: change color so it's clear the button is not clickable
329+
self.install_button.add_state(lv.STATE.DISABLED)
332330
self.install_label.set_text("Please wait...") # TODO: Put "Cancel" if cancellation is possible
333331
self.progress_bar.remove_flag(lv.obj.FLAG.HIDDEN)
334332
self.progress_bar.set_value(20, lv.ANIM.ON)
@@ -387,7 +385,7 @@ def download_and_unzip(self, zip_url, dest_folder, app_fullname):
387385
self.progress_bar.add_flag(lv.obj.FLAG.HIDDEN)
388386
self.progress_bar.set_value(0, lv.ANIM.OFF)
389387
self.set_install_label(app_fullname)
390-
self.install_button.add_flag(lv.obj.FLAG.CLICKABLE)
388+
self.install_button.remove_state(lv.STATE.DISABLED)
391389

392390
@staticmethod
393391
def compare_versions(ver1: str, ver2: str) -> bool:

0 commit comments

Comments
 (0)