Fix 2 examples to work with py2
This commit is contained in:
parent
b6f729dc3a
commit
fea03a787c
|
@ -40,6 +40,11 @@ def combobox_item_pressed_cb(cbox, item):
|
||||||
def combobox_changed_cb(cbox):
|
def combobox_changed_cb(cbox):
|
||||||
cbox.filter = cbox.text
|
cbox.filter = cbox.text
|
||||||
|
|
||||||
|
def generic_obj_cb(cbox, event_name):
|
||||||
|
print("EV", event_name, cbox)
|
||||||
|
|
||||||
|
def generic_item_cb(cbox, item, event_name):
|
||||||
|
print("EV", event_name, item)
|
||||||
|
|
||||||
def combobox_clicked(obj):
|
def combobox_clicked(obj):
|
||||||
win = StandardWindow("combobox", "Combobox", autodel=True, size=(320, 500))
|
win = StandardWindow("combobox", "Combobox", autodel=True, size=(320, 500))
|
||||||
|
@ -57,10 +62,10 @@ def combobox_clicked(obj):
|
||||||
size_hint_fill=FILL_HORIZ)
|
size_hint_fill=FILL_HORIZ)
|
||||||
cbox1.part_text_set("guide", "A short list (with callbacks attached)")
|
cbox1.part_text_set("guide", "A short list (with callbacks attached)")
|
||||||
cbox1.callback_item_pressed_add(combobox_item_pressed_cb)
|
cbox1.callback_item_pressed_add(combobox_item_pressed_cb)
|
||||||
cbox1.callback_dismissed_add(lambda cbox: print("DISMISSED", cbox))
|
cbox1.callback_dismissed_add(generic_obj_cb, "DISMISSED")
|
||||||
cbox1.callback_expanded_add(lambda cbox: print("EXPANDED", cbox))
|
cbox1.callback_expanded_add(generic_obj_cb, "EXPANDED")
|
||||||
cbox1.callback_clicked_add(lambda cbox: print("CLICKED", cbox))
|
cbox1.callback_clicked_add(generic_obj_cb, "CLICKED")
|
||||||
cbox1.callback_item_selected_add(lambda cbox, item: print("ITEM,SELECTED", item))
|
cbox1.callback_item_selected_add(generic_item_cb, "ITEM,SELECTED")
|
||||||
|
|
||||||
for i in range(1, 7):
|
for i in range(1, 7):
|
||||||
cbox1.item_append(itc, "Item # %d" % i)
|
cbox1.item_append(itc, "Item # %d" % i)
|
||||||
|
@ -73,7 +78,7 @@ def combobox_clicked(obj):
|
||||||
cbox2.part_text_set("guide", "A long list (with item filtering)")
|
cbox2.part_text_set("guide", "A long list (with item filtering)")
|
||||||
cbox2.callback_item_pressed_add(combobox_item_pressed_cb)
|
cbox2.callback_item_pressed_add(combobox_item_pressed_cb)
|
||||||
cbox2.callback_changed_add(combobox_changed_cb)
|
cbox2.callback_changed_add(combobox_changed_cb)
|
||||||
cbox2.callback_filter_done_add(lambda cbox: print("FILTER,DONE", cbox))
|
cbox2.callback_filter_done_add(generic_obj_cb, "FILTER,DONE")
|
||||||
|
|
||||||
for i in range(1, 1001):
|
for i in range(1, 1001):
|
||||||
cbox2.item_append(itc, "Item # %d" % i)
|
cbox2.item_append(itc, "Item # %d" % i)
|
||||||
|
|
|
@ -37,6 +37,8 @@ def gl_filter_get(obj, key, item_data):
|
||||||
def entry_changed_cb(en, gl):
|
def entry_changed_cb(en, gl):
|
||||||
gl.filter = en.text or None
|
gl.filter = en.text or None
|
||||||
|
|
||||||
|
def filter_done_cb(gl):
|
||||||
|
print("filter,done")
|
||||||
|
|
||||||
def test_genlist_filter(parent):
|
def test_genlist_filter(parent):
|
||||||
win = StandardWindow("genlist-filter", "Genlist Filter", autodel=True,
|
win = StandardWindow("genlist-filter", "Genlist Filter", autodel=True,
|
||||||
|
@ -52,7 +54,7 @@ def test_genlist_filter(parent):
|
||||||
gl = Genlist(win, mode=elm.ELM_LIST_COMPRESS, homogeneous=True,
|
gl = Genlist(win, mode=elm.ELM_LIST_COMPRESS, homogeneous=True,
|
||||||
select_mode=elm.ELM_OBJECT_SELECT_MODE_ALWAYS,
|
select_mode=elm.ELM_OBJECT_SELECT_MODE_ALWAYS,
|
||||||
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
|
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
|
||||||
gl.callback_filter_done_add(lambda g: print("filter,done"))
|
gl.callback_filter_done_add(filter_done_cb)
|
||||||
gl.show()
|
gl.show()
|
||||||
box.pack_end(gl)
|
box.pack_end(gl)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue