Skip to content

Commit 848420f

Browse files
Improve appstore.py
1 parent d5efae0 commit 848420f

File tree

1 file changed

+16
-12
lines changed
  • internal_filesystem/apps/com.example.appstore/assets

1 file changed

+16
-12
lines changed

internal_filesystem/apps/com.example.appstore/assets/appstore.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def create_apps_list():
7878
icon_spacer.add_event_cb(lambda e, a=app: show_app_detail(a), lv.EVENT.CLICKED, None)
7979
label_cont = lv.obj(cont)
8080
label_cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
81-
label_cont.set_size(lv.pct(100), lv.SIZE_CONTENT)
81+
label_cont.set_size(lv.pct(75), lv.SIZE_CONTENT)
8282
label_cont.add_event_cb(lambda e, a=app: show_app_detail(a), lv.EVENT.CLICKED, None)
8383
name_label = lv.label(label_cont)
8484
name_label.set_text(app.name)
@@ -109,6 +109,7 @@ def show_app_detail(app):
109109
cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
110110
#
111111
headercont = lv.obj(cont)
112+
headercont.set_style_pad_all(0, 0)
112113
headercont.set_flex_flow(lv.FLEX_FLOW.ROW)
113114
headercont.set_size(lv.pct(100), lv.SIZE_CONTENT)
114115
headercont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
@@ -118,15 +119,21 @@ def show_app_detail(app):
118119
icon_spacer.set_size(64, 64)
119120
#
120121
detail_cont = lv.obj(headercont)
122+
detail_cont.set_style_pad_all(0, 0)
121123
detail_cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
122-
detail_cont.set_size(lv.pct(100), lv.SIZE_CONTENT)
124+
detail_cont.set_size(lv.pct(80), lv.SIZE_CONTENT)
123125
name_label = lv.label(detail_cont)
124126
name_label.set_text(app.name)
125127
name_label.set_style_text_font(lv.font_montserrat_24, 0)
126128
publisher_label = lv.label(detail_cont)
127129
publisher_label.set_text(app.publisher)
128130
publisher_label.set_style_text_font(lv.font_montserrat_16, 0)
129131
#
132+
progress_bar = lv.bar(cont)
133+
progress_bar.set_width(lv.pct(100))
134+
#progress_bar.align(lv.ALIGN.BOTTOM_MID, 0, -50)
135+
progress_bar.set_range(0, 100)
136+
progress_bar.set_value(50, lv.ANIM.OFF)
130137
install_button = lv.button(cont)
131138
install_button.align_to(detail_cont, lv.ALIGN.OUT_BOTTOM_MID, 0, lv.pct(5))
132139
install_button.set_size(lv.pct(100), 40)
@@ -169,14 +176,11 @@ def back_to_main(event):
169176
import network
170177
if not network.WLAN(network.STA_IF).isconnected():
171178
please_wait_label.set_text("Error: WiFi is not connected.")
172-
import sys
173-
sys.exit() # stops the script but doesn't return to launcher so the user can read the error
174-
175-
download_apps("http://demo.lnpiggy.com:2121/apps.json")
176-
177-
# Wait until the user stops the app
178-
import time
179-
while appscreen == lv.screen_active() or app_detail_screen == lv.screen_active():
180-
time.sleep_ms(100)
181-
179+
else:
180+
download_apps("http://demo.lnpiggy.com:2121/apps.json")
181+
# Wait until the user stops the app
182+
import time
183+
while appscreen == lv.screen_active() or app_detail_screen == lv.screen_active():
184+
time.sleep_ms(100)
185+
182186
print("appstore.py ending")

0 commit comments

Comments
 (0)