fix(examples) align with renamed Micropython APIs (#2338)

Align examples with renames on https://github.com/lvgl/lv_binding_micropython/issues/157
This commit is contained in:
Amir Gonnen
2021-06-30 00:03:07 +03:00
committed by GitHub
parent fcd4aa3924
commit fe4afe8ef2
10 changed files with 11 additions and 11 deletions

View File

@@ -2,7 +2,7 @@ def set_value(bar, v):
bar.set_value(v, lv.ANIM.OFF) bar.set_value(v, lv.ANIM.OFF)
def event_cb(e): def event_cb(e):
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
if dsc.part != lv.PART.INDICATOR: if dsc.part != lv.PART.INDICATOR:
return return

View File

@@ -5,7 +5,7 @@ def set_value(bar, v):
bar.set_value(v, lv.ANIM.OFF) bar.set_value(v, lv.ANIM.OFF)
def event_cb(e): def event_cb(e):
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
if dsc.part != lv.PART.INDICATOR: if dsc.part != lv.PART.INDICATOR:
return return

View File

@@ -22,7 +22,7 @@ def event_cb(e):
code = e.get_code() code = e.get_code()
obj = e.get_target() obj = e.get_target()
if code == lv.EVENT.DRAW_PART_BEGIN: if code == lv.EVENT.DRAW_PART_BEGIN:
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
# Change the draw descriptor the 2nd button # Change the draw descriptor the 2nd button
if dsc.id == 1: if dsc.id == 1:
dsc.rect_dsc.radius = 0; dsc.rect_dsc.radius = 0;
@@ -50,7 +50,7 @@ def event_cb(e):
dsc.label_dsc.opa = lv.OPA.TRANSP # Hide the text if any dsc.label_dsc.opa = lv.OPA.TRANSP # Hide the text if any
if code == lv.EVENT.DRAW_PART_END: if code == lv.EVENT.DRAW_PART_END:
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
# Add custom content to the 4th button when the button itself was drawn # Add custom content to the 4th button when the button itself was drawn
if dsc.id == 3: if dsc.id == 3:

View File

@@ -3,7 +3,7 @@ def draw_event_cb(e):
obj = lv.obj.__cast__(e.get_target()) obj = lv.obj.__cast__(e.get_target())
# Add the faded area before the lines are drawn # Add the faded area before the lines are drawn
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
if dsc.part != lv.PART.ITEMS: if dsc.part != lv.PART.ITEMS:
return return
if not dsc.p1 or not dsc.p2: if not dsc.p1 or not dsc.p2:

View File

@@ -1,6 +1,6 @@
def draw_event_cb(e): def draw_event_cb(e):
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
if dsc.part == lv.PART.TICKS and dsc.id == lv.chart.AXIS.PRIMARY_X: if dsc.part == lv.PART.TICKS and dsc.id == lv.chart.AXIS.PRIMARY_X:
month = ["Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"] month = ["Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"]
# dsc.text is defined char text[16], I must therefore convert the Python string to a byte_array # dsc.text is defined char text[16], I must therefore convert the Python string to a byte_array

View File

@@ -35,7 +35,7 @@ def event_cb(e):
a.y1 = coords.y1 + p.y - 30 a.y1 = coords.y1 + p.y - 30
a.y2 = coords.y1 + p.y - 10 a.y2 = coords.y1 + p.y - 10
clip_area = lv.area_t.cast(e.get_param()) clip_area = lv.area_t.__cast__(e.get_param())
lv.draw_rect(a, clip_area, draw_rect_dsc) lv.draw_rect(a, clip_area, draw_rect_dsc)
elif code == lv.EVENT.RELEASED: elif code == lv.EVENT.RELEASED:

View File

@@ -49,7 +49,7 @@ class ExampleChart_6():
elif code == lv.EVENT.DRAW_PART_END: elif code == lv.EVENT.DRAW_PART_END:
# print("EVENT.DRAW_PART_END") # print("EVENT.DRAW_PART_END")
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
# if dsc.p1 and dsc.p2: # if dsc.p1 and dsc.p2:
# print("p1, p2", dsc.p1,dsc.p2) # print("p1, p2", dsc.p1,dsc.p2)
# print("p1.y, p2.y", dsc.p1.y, dsc.p2.y) # print("p1.y, p2.y", dsc.p1.y, dsc.p2.y)

View File

@@ -8,7 +8,7 @@ def slider_event_cb(e):
elif code == lv.EVENT.DRAW_PART_END: elif code == lv.EVENT.DRAW_PART_END:
# print("DRAW_PART_END") # print("DRAW_PART_END")
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
# print(dsc) # print(dsc)
if dsc.part == lv.PART.INDICATOR: if dsc.part == lv.PART.INDICATOR:
label_text = "{:d} - {:d}".format(obj.get_left_value(),slider.get_value()) label_text = "{:d} - {:d}".format(obj.get_left_value(),slider.get_value())

View File

@@ -1,6 +1,6 @@
def draw_part_event_cb(e): def draw_part_event_cb(e):
obj = lv.table.__cast__(e.get_target()) obj = lv.table.__cast__(e.get_target())
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
# If the cells are drawn../ # If the cells are drawn../
if dsc.part == lv.PART.ITEMS: if dsc.part == lv.PART.ITEMS:
row = dsc.id // obj.get_col_cnt() row = dsc.id // obj.get_col_cnt()

View File

@@ -5,7 +5,7 @@ ITEM_CNT = 200
def draw_event_cb(e): def draw_event_cb(e):
obj = lv.table.__cast__(e.get_target()) obj = lv.table.__cast__(e.get_target())
dsc = lv.obj_draw_part_dsc_t.cast(e.get_param()) dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
# If the cells are drawn... # If the cells are drawn...
if dsc.part == lv.PART.ITEMS: if dsc.part == lv.PART.ITEMS:
chk = obj.has_cell_ctrl(dsc.id, 0, lv.table.CELL_CTRL.CUSTOM_1) chk = obj.has_cell_ctrl(dsc.id, 0, lv.table.CELL_CTRL.CUSTOM_1)