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:
@@ -2,7 +2,7 @@ def set_value(bar, v):
|
||||
bar.set_value(v, lv.ANIM.OFF)
|
||||
|
||||
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:
|
||||
return
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ def set_value(bar, v):
|
||||
bar.set_value(v, lv.ANIM.OFF)
|
||||
|
||||
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:
|
||||
return
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ def event_cb(e):
|
||||
code = e.get_code()
|
||||
obj = e.get_target()
|
||||
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
|
||||
if dsc.id == 1:
|
||||
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
|
||||
|
||||
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
|
||||
if dsc.id == 3:
|
||||
|
||||
@@ -3,7 +3,7 @@ def draw_event_cb(e):
|
||||
obj = lv.obj.__cast__(e.get_target())
|
||||
|
||||
# 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:
|
||||
return
|
||||
if not dsc.p1 or not dsc.p2:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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:
|
||||
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
|
||||
|
||||
@@ -35,7 +35,7 @@ def event_cb(e):
|
||||
a.y1 = coords.y1 + p.y - 30
|
||||
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)
|
||||
|
||||
elif code == lv.EVENT.RELEASED:
|
||||
|
||||
@@ -49,7 +49,7 @@ class ExampleChart_6():
|
||||
|
||||
elif code == lv.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:
|
||||
# print("p1, p2", dsc.p1,dsc.p2)
|
||||
# print("p1.y, p2.y", dsc.p1.y, dsc.p2.y)
|
||||
|
||||
@@ -8,7 +8,7 @@ def slider_event_cb(e):
|
||||
|
||||
elif code == lv.EVENT.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)
|
||||
if dsc.part == lv.PART.INDICATOR:
|
||||
label_text = "{:d} - {:d}".format(obj.get_left_value(),slider.get_value())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
def draw_part_event_cb(e):
|
||||
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 dsc.part == lv.PART.ITEMS:
|
||||
row = dsc.id // obj.get_col_cnt()
|
||||
|
||||
@@ -5,7 +5,7 @@ ITEM_CNT = 200
|
||||
|
||||
def draw_event_cb(e):
|
||||
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 dsc.part == lv.PART.ITEMS:
|
||||
chk = obj.has_cell_ctrl(dsc.id, 0, lv.table.CELL_CTRL.CUSTOM_1)
|
||||
|
||||
Reference in New Issue
Block a user