fix(examples) fix MicroPython examples and run the examples with CI (#2339)

* Fixes to micropython examples

Added missing images and fonts under 'assets'. Since .bin is in gitignore, renamed fonts to .fnt

* Update build_micropython workflow

Build the unix port dev variant and run tests.

See: https://github.com/lvgl/lv_binding_micropython/issues/151
This commit is contained in:
Amir Gonnen
2021-07-01 15:37:57 +03:00
committed by GitHub
parent 3668e54f06
commit 4114dc30e8
18 changed files with 26 additions and 31 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

View File

@@ -3,7 +3,7 @@
#
def get_icon(filename,xres,yres):
try:
sdl_filename = "../../assets/" + filename + "_" + str(xres) + "x" + str(yres) + "_argb8888.bin"
sdl_filename = "../../assets/" + filename + "_" + str(xres) + "x" + str(yres) + "_argb8888.fnt"
print("file name: ", sdl_filename)
with open(sdl_filename,'rb') as f:
icon_data = f.read()

View File

@@ -55,7 +55,7 @@ a2.set_custom_exec_cb(lambda a,val: set_zoom(img,val))
a2.set_values(128, 256)
a2.set_time(5000)
a2.set_playback_time(3000)
a2.set_repeat_count(LV_ANIM_REPEAT_INFINITE)
a2.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
lv.anim_t.start(a2)

View File

@@ -13,7 +13,7 @@ fs_driver.fs_register(fs_drv, 'S')
try:
ltr_label.set_style_text_font(ltr_label, lv.font_montserrat_16, 0)
except:
font_montserrat_16 = lv.font_load("S:../../assets/font/montserrat-16.bin")
font_montserrat_16 = lv.font_load("S:../../assets/font/montserrat-16.fnt")
ltr_label.set_style_text_font(font_montserrat_16, 0)
ltr_label.set_width(310)
@@ -26,7 +26,7 @@ rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
rtl_label.set_width(310)
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.bin")
font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
cz_label = lv.label(lv.scr_act())
cz_label.set_style_text_font(font_simsun_16_cjk, 0)

View File

@@ -35,6 +35,6 @@ btn_battery.add_event_cb(event_handler,lv.EVENT.ALL, None)
list1.add_text("Exit")
btn_apply = list1.add_btn(lv.SYMBOL.OK, "Apply")
btn_apply.add_event_cb(event_handler,lv.EVENT.ALL, None)
btn_close = list1.add_btn(LV_SYMBOL.CLOSE, "Close")
btn_close = list1.add_btn(lv.SYMBOL.CLOSE, "Close")
btn_close.add_event_cb(event_handler,lv.EVENT.ALL, None)

View File

@@ -38,6 +38,6 @@ btn_battery.add_event_cb(event_handler,lv.EVENT.ALL, None)
list1.add_text("Exit")
btn_apply = list1.add_btn(lv.SYMBOL.OK, "Apply")
btn_apply.add_event_cb(event_handler,lv.EVENT.ALL, None)
btn_close = list1.add_btn(LV_SYMBOL.CLOSE, "Close")
btn_close = list1.add_btn(lv.SYMBOL.CLOSE, "Close")
btn_close.add_event_cb(event_handler,lv.EVENT.ALL, None)

View File

@@ -61,7 +61,7 @@ a3.set_repeat_delay(100)
a3.set_playback_delay(100)
a3.set_playback_time(2000)
a3.set_var(indic3)
a3.set_repeat_count(LV_ANIM_REPEAT_INFINITE)
a3.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a3.set_custom_exec_cb(lambda a,val: set_value(indic3,val))
lv.anim_t.start(a3)

View File

@@ -27,6 +27,6 @@ meter.set_indicator_start_value(indic2, 40) # Start from the previous
meter.set_indicator_end_value(indic2, 80)
indic3 = meter.add_arc(scale, indic_w, lv.palette_main(lv.PALETTE.DEEP_ORANGE), 0)
meter_set_indicator_start_value(indic3, 80) # Start from the previous
meter_set_indicator_end_value(indic3, 100)
meter.set_indicator_start_value(indic3, 80) # Start from the previous
meter.set_indicator_end_value(indic3, 100)

View File

@@ -22,7 +22,7 @@ except:
fs_drv = lv.fs_drv_t()
fs_driver.fs_register(fs_drv, 'S')
print("montserrat-22 not enabled in lv_conf.h, dynamically loading the font")
font_montserrat_22 = lv.font_load("S:" + "../../assets/font/montserrat-22.bin")
font_montserrat_22 = lv.font_load("S:" + "../../assets/font/montserrat-22.fnt")
style_sel.set_text_font(font_montserrat_22)
opts = "\n".join(["1","2","3","4","5","6","7","8","9","10"])

View File

@@ -23,6 +23,6 @@ sw.add_state(lv.STATE.DISABLED)
sw.add_event_cb(event_handler, lv.EVENT.ALL, None)
sw = lv.switch(lv.scr_act())
sw.add_state(STATE.CHECKED | lv.STATE.DISABLED)
sw.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
sw.add_event_cb(event_handler, lv.EVENT.ALL, None)

View File

@@ -6,20 +6,20 @@ def draw_part_event_cb(e):
row = dsc.id // obj.get_col_cnt()
col = dsc.id - row * obj.get_col_cnt()
# Make the texts in the first cell center aligned
if row == 0:
dsc.label_dsc.align = lv.TEXT_ALIGN.CENTER
dsc.rect_dsc.bg_color = lv.palette_main(lv.PALETTE.BLUE).color_mix(dsc.rect_dsc.bg_color, lv.OPA._20)
dsc.rect_dsc.bg_opa = lv.OPA.COVER
# Make the texts in the first cell center aligned
if row == 0:
dsc.label_dsc.align = lv.TEXT_ALIGN.CENTER
dsc.rect_dsc.bg_color = lv.palette_main(lv.PALETTE.BLUE).color_mix(dsc.rect_dsc.bg_color, lv.OPA._20)
dsc.rect_dsc.bg_opa = lv.OPA.COVER
# In the first column align the texts to the right
elif col == 0:
dsc.label_dsc.flag = lv.TEXT_ALIGN.RIGHT
# In the first column align the texts to the right
elif col == 0:
dsc.label_dsc.flag = lv.TEXT_ALIGN.RIGHT
# Make every 2nd row grayish
if row != 0 and (row % 2) == 0:
dsc.rect_dsc.bg_color = lv.palette_main(lv.PALETTE.GREY).color_mix(dsc.rect_dsc.bg_color, lv.OPA._10)
dsc.rect_dsc.bg_opa = lv.OPA.COVER
# Make every 2nd row grayish
if row != 0 and (row % 2) == 0:
dsc.rect_dsc.bg_color = lv.palette_main(lv.PALETTE.GREY).color_mix(dsc.rect_dsc.bg_color, lv.OPA._10)
dsc.rect_dsc.bg_opa = lv.OPA.COVER
table = lv.table(lv.scr_act())