|
11 | 11 |
|
12 | 12 | class OSUpdate(Activity): |
13 | 13 |
|
14 | | - status_label = None |
15 | 14 | install_button = None |
16 | 15 | main_screen = None |
17 | 16 | keep_running = True |
18 | 17 |
|
19 | 18 | def onCreate(self): |
20 | 19 | 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) |
26 | 26 | install_label.set_text("Update OS") |
27 | 27 | install_label.center() |
28 | 28 | self.status_label = lv.label(self.main_screen) |
@@ -78,7 +78,7 @@ def handle_update_info(self, version, download_url, changelog): |
78 | 78 | label = f"Installed OS version: {mpos.info.CURRENT_OS_VERSION}\n" |
79 | 79 | if compare_versions(version, mpos.info.CURRENT_OS_VERSION): |
80 | 80 | label += "Available new" |
81 | | - self.install_button.remove_flag(lv.obj.FLAG.HIDDEN) |
| 81 | + self.install_button.remove_state(lv.STATE.DISABLED) |
82 | 82 | self.install_button.add_event_cb(lambda e, u=download_url: self.install_button_click(u), lv.EVENT.CLICKED, None) |
83 | 83 | else: |
84 | 84 | label += "isn't older than latest" |
|
0 commit comments