refactor: scr -> screen, act->active, del->delete, remove in obj_clear_flag/state
This commit is contained in:
@@ -8,14 +8,14 @@ def sw_event_cb(e,panel):
|
||||
if sw.has_state(lv.STATE.CHECKED):
|
||||
panel.add_flag(lv.obj.FLAG.SCROLL_ONE)
|
||||
else:
|
||||
panel.clear_flag(lv.obj.FLAG.SCROLL_ONE)
|
||||
panel.remove_flag(lv.obj.FLAG.SCROLL_ONE)
|
||||
|
||||
|
||||
#
|
||||
# Show an example to scroll snap
|
||||
#
|
||||
|
||||
panel = lv.obj(lv.scr_act())
|
||||
panel = lv.obj(lv.screen_active())
|
||||
panel.set_size(280, 150)
|
||||
panel.set_scroll_snap_x(lv.SCROLL_SNAP.CENTER)
|
||||
panel.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
@@ -28,7 +28,7 @@ for i in range(10):
|
||||
label = lv.label(button)
|
||||
if i == 3:
|
||||
label.set_text("Panel {:d}\nno snap".format(i))
|
||||
button.clear_flag(lv.obj.FLAG.SNAPPABLE)
|
||||
button.remove_flag(lv.obj.FLAG.SNAPPABLE)
|
||||
else:
|
||||
label.set_text("Panel {:d}".format(i))
|
||||
label.center()
|
||||
@@ -37,10 +37,10 @@ panel.update_snap(lv.ANIM.ON)
|
||||
|
||||
|
||||
# Switch between "One scroll" and "Normal scroll" mode
|
||||
sw = lv.switch(lv.scr_act())
|
||||
sw = lv.switch(lv.screen_active())
|
||||
sw.align(lv.ALIGN.TOP_RIGHT, -20, 10)
|
||||
sw.add_event(lambda evt: sw_event_cb(evt,panel), lv.EVENT.ALL, None)
|
||||
label = lv.label(lv.scr_act())
|
||||
label = lv.label(lv.screen_active())
|
||||
label.set_text("One scroll")
|
||||
label.align_to(sw, lv.ALIGN.OUT_BOTTOM_MID, 0, 5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user