fix(examples) adjust constant names in Micropython examples (#3532)

Due to spurious enums (https://github.com/lvgl/lv_binding_micropython/issues/199) wrong constant names were generated. Fix these constants.
This commit is contained in:
Amir Gonnen
2022-07-30 18:10:56 +03:00
committed by GitHub
parent 2461ac0758
commit 7a23be73ab
38 changed files with 64 additions and 64 deletions

View File

@@ -47,7 +47,7 @@ animimg0 = lv.animimg(lv.scr_act())
animimg0.center()
animimg0.set_src(anim_imgs, 3)
animimg0.set_duration(1000)
animimg0.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
animimg0.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
animimg0.start()

View File

@@ -26,7 +26,7 @@ a.set_time(3000)
a.set_playback_time(3000)
a.set_var(bar)
a.set_values(-20, 40)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a, val: set_temp(bar,val))
lv.anim_t.start(a)

View File

@@ -49,6 +49,6 @@ a.set_values(0, 100)
a.set_custom_exec_cb(lambda a,val: set_value(bar,val))
a.set_time(2000)
a.set_playback_time(2000)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a)

View File

@@ -52,6 +52,6 @@ a.set_values(0, 100)
a.set_custom_exec_cb(lambda a,val: set_value(bar,val))
a.set_time(2000)
a.set_playback_time(2000)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a)

View File

@@ -25,7 +25,7 @@ btn2.add_event_cb(event_handler,lv.EVENT.ALL, None)
btn2.align(lv.ALIGN.CENTER,0,40)
btn2.add_flag(lv.obj.FLAG.CHECKABLE)
btn2.set_height(lv.SIZE.CONTENT)
btn2.set_height(lv.SIZE_CONTENT)
label=lv.label(btn2)
label.set_text("Toggle")

View File

@@ -51,7 +51,7 @@ btn1 = lv.btn(lv.scr_act())
btn1.remove_style_all() # Remove the style coming from the theme
btn1.add_style(style, 0)
btn1.add_style(style_pr, lv.STATE.PRESSED)
btn1.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
btn1.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
btn1.center()
label = lv.label(btn1)

View File

@@ -39,7 +39,7 @@ def event_cb(e):
# Change the draw descriptor the 3rd button
elif dsc.id == 2:
dsc.rect_dsc.radius = lv.RADIUS.CIRCLE
dsc.rect_dsc.radius = lv.RADIUS_CIRCLE
if obj.get_selected_btn() == dsc.id:
dsc.rect_dsc.bg_color = lv.palette_darken(lv.PALETTE.RED, 3)
else:

View File

@@ -30,7 +30,7 @@ style_bg.init()
style_bg.set_pad_all(0)
style_bg.set_pad_gap(0)
style_bg.set_clip_corner(True)
style_bg.set_radius(lv.RADIUS.CIRCLE)
style_bg.set_radius(lv.RADIUS_CIRCLE)
style_bg.set_border_width(0)

View File

@@ -10,7 +10,7 @@ def event_cb(e):
elif code == lv.EVENT.DRAW_POST_END:
id = lv.chart.get_pressed_point(chart)
if id == lv.CHART_POINT.NONE:
if id == lv.CHART_POINT_NONE:
return
# print("Selected point ", id)
for i in range(len(series)):

View File

@@ -76,13 +76,13 @@ chart.set_point_count(pcnt)
chart.set_ext_y_array(ser, ecg_sample)
slider = lv.slider(lv.scr_act())
slider.set_range(lv.IMG_ZOOM.NONE, lv.IMG_ZOOM.NONE * 10)
slider.set_range(lv.IMG_ZOOM_NONE, lv.IMG_ZOOM_NONE * 10)
slider.add_event_cb(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(200,10)
slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
slider = lv.slider(lv.scr_act())
slider.set_range(lv.IMG_ZOOM.NONE, lv.IMG_ZOOM.NONE * 10)
slider.set_range(lv.IMG_ZOOM_NONE, lv.IMG_ZOOM_NONE * 10)
slider.add_event_cb(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(10, 150)
slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0)

View File

@@ -42,7 +42,7 @@ class ExampleChart_6():
if code == lv.EVENT.VALUE_CHANGED:
# print("last_id: ",self.last_id)
self.last_id = chart.get_pressed_point()
if self.last_id != lv.CHART_POINT.NONE:
if self.last_id != lv.CHART_POINT_NONE:
p = lv.point_t()
chart.get_point_pos_by_id(self.ser, self.last_id, p)
chart.set_cursor_point(self.cursor, None, self.last_id)

View File

@@ -8,9 +8,9 @@ def add_data(t):
s = chart.get_x_start_point(ser)
a = chart.get_y_array(ser)
a[(s + 1) % p] = lv.CHART_POINT.NONE
a[(s + 2) % p] = lv.CHART_POINT.NONE
a[(s + 3) % p] = lv.CHART_POINT.NONE
a[(s + 1) % p] = lv.CHART_POINT_NONE
a[(s + 2) % p] = lv.CHART_POINT_NONE
a[(s + 3) % p] = lv.CHART_POINT_NONE
chart.refresh()
#

View File

@@ -45,7 +45,7 @@ a1.set_var(img)
a1.set_custom_exec_cb(lambda a,val: set_angle(img,val))
a1.set_values(0, 3600)
a1.set_time(5000)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
lv.anim_t.start(a1)
a2 = lv.anim_t()
@@ -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

@@ -45,7 +45,7 @@ a.set_var(img)
a.set_values(0, 100)
a.set_time(3000)
a.set_playback_time(500)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a,val: ofs_y_anim(img,val))
lv.anim_t.start(a)

View File

@@ -42,6 +42,6 @@ float_btn.set_size(50, 50)
float_btn.add_flag(lv.obj.FLAG.FLOATING)
float_btn.align(lv.ALIGN.BOTTOM_RIGHT, -10, -10)
float_btn.add_event_cb(float_btn_event_cb, lv.EVENT.CLICKED, None)
float_btn.set_style_radius(lv.RADIUS.CIRCLE, 0)
float_btn.set_style_radius(lv.RADIUS_CIRCLE, 0)
float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0)
float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0)

View File

@@ -52,7 +52,7 @@ a.set_time(2000)
a.set_repeat_delay(100)
a.set_playback_time(500)
a.set_playback_delay(100)
a.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a.set_custom_exec_cb(lambda a,val: set_value(indic,val))
lv.anim_t.start(a)

View File

@@ -37,7 +37,7 @@ a1.set_repeat_delay(100)
a1.set_playback_delay(100)
a1.set_playback_time(500)
a1.set_var(indic1)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a1.set_custom_exec_cb(lambda a,val: set_value(indic1,val))
lv.anim_t.start(a1)
@@ -49,7 +49,7 @@ a2.set_repeat_delay(100)
a2.set_playback_delay(100)
a2.set_playback_time(1000)
a2.set_var(indic2)
a2.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a2.set_custom_exec_cb(lambda a,val: set_value(indic2,val))
lv.anim_t.start(a2)
@@ -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

@@ -67,7 +67,7 @@ indic_hour = meter.add_needle_img(scale_min, img_hand_hour_dsc, 5, 5)
a1 = lv.anim_t()
a1.init()
a1.set_values(0, 60)
a1.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
a1.set_time(2000) # 2 sec for 1 turn of the minute hand (1 hour)
a1.set_var(indic_min)
a1.set_custom_exec_cb(lambda a1,val: set_value(indic_min,val))

View File

@@ -13,13 +13,13 @@ style_pressed_color = lv.style_t()
style_main.init()
style_main.set_bg_opa(lv.OPA.COVER)
style_main.set_bg_color(lv.color_hex3(0xbbb))
style_main.set_radius(lv.RADIUS.CIRCLE)
style_main.set_radius(lv.RADIUS_CIRCLE)
style_main.set_pad_ver(-2) # Makes the indicator larger
style_indicator.init()
style_indicator.set_bg_opa(lv.OPA.COVER)
style_indicator.set_bg_color(lv.palette_main(lv.PALETTE.CYAN))
style_indicator.set_radius(lv.RADIUS.CIRCLE)
style_indicator.set_radius(lv.RADIUS_CIRCLE)
style_indicator.set_transition(transition_dsc)
style_knob.init()
@@ -27,7 +27,7 @@ style_knob.set_bg_opa(lv.OPA.COVER)
style_knob.set_bg_color(lv.palette_main(lv.PALETTE.CYAN))
style_knob.set_border_color(lv.palette_darken(lv.PALETTE.CYAN, 3))
style_knob.set_border_width(2)
style_knob.set_radius(lv.RADIUS.CIRCLE)
style_knob.set_radius(lv.RADIUS_CIRCLE)
style_knob.set_pad_all(6) # Makes the knob larger
style_knob.set_transition(transition_dsc)

View File

@@ -18,7 +18,7 @@ def draw_event_cb(e):
else:
rect_dsc.bg_color = lv.palette_lighten(lv.PALETTE.GREY, 2)
rect_dsc.radius = lv.RADIUS.CIRCLE
rect_dsc.radius = lv.RADIUS_CIRCLE
sw_area = lv.area_t()
sw_area.x1 = dsc.draw_area.x2 - 50

View File

@@ -19,7 +19,7 @@ btn = lv.btn(tile2)
label = lv.label(btn)
label.set_text("Scroll up or right")
btn.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
btn.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
btn.center()
# Tile3: a list