Skip to content

Commit 0b07e08

Browse files
Fix osupdate
1 parent 4e6c315 commit 0b07e08

File tree

1 file changed

+7
-7
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.osupdate/assets

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111

1212
class OSUpdate(Activity):
1313

14-
status_label = None
1514
install_button = None
1615
main_screen = None
1716
keep_running = True
1817

1918
def onCreate(self):
2019
self.main_screen = lv.obj()
21-
install_button = lv.button(self.main_screen)
22-
install_button.align(lv.ALIGN.TOP_RIGHT, 0, mpos.ui.NOTIFICATION_BAR_HEIGHT)
23-
install_button.add_flag(lv.obj.FLAG.HIDDEN) # button will be shown if there is an update available
24-
install_button.set_size(lv.SIZE_CONTENT, lv.pct(20))
25-
install_label = lv.label(install_button)
20+
self.main_screen.set_style_pad_all(mpos.ui.pct_of_display_width(2), 0)
21+
self.install_button = lv.button(self.main_screen)
22+
self.install_button.align(lv.ALIGN.TOP_RIGHT, 0, mpos.ui.NOTIFICATION_BAR_HEIGHT)
23+
self.install_button.add_state(lv.STATE.DISABLED) # button will be enabled if there is an update available
24+
self.install_button.set_size(lv.SIZE_CONTENT, lv.pct(25))
25+
install_label = lv.label(self.install_button)
2626
install_label.set_text("Update OS")
2727
install_label.center()
2828
self.status_label = lv.label(self.main_screen)
@@ -78,7 +78,7 @@ def handle_update_info(self, version, download_url, changelog):
7878
label = f"Installed OS version: {mpos.info.CURRENT_OS_VERSION}\n"
7979
if compare_versions(version, mpos.info.CURRENT_OS_VERSION):
8080
label += "Available new"
81-
self.install_button.remove_flag(lv.obj.FLAG.HIDDEN)
81+
self.install_button.remove_state(lv.STATE.DISABLED)
8282
self.install_button.add_event_cb(lambda e, u=download_url: self.install_button_click(u), lv.EVENT.CLICKED, None)
8383
else:
8484
label += "isn't older than latest"

0 commit comments

Comments
 (0)