davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=fea03a787c706f5d179910e0b06b4c95ed84ff67

commit fea03a787c706f5d179910e0b06b4c95ed84ff67
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Mon Feb 8 19:42:22 2016 +0100

    Fix 2 examples to work with py2
---
 examples/elementary/test_combobox.py       | 15 ++++++++++-----
 examples/elementary/test_genlist_filter.py |  4 +++-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/examples/elementary/test_combobox.py 
b/examples/elementary/test_combobox.py
index 632e92e..97b5d53 100644
--- a/examples/elementary/test_combobox.py
+++ b/examples/elementary/test_combobox.py
@@ -40,6 +40,11 @@ def combobox_item_pressed_cb(cbox, item):
 def combobox_changed_cb(cbox):
     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):
     win = StandardWindow("combobox", "Combobox", autodel=True, size=(320, 500))
@@ -57,10 +62,10 @@ def combobox_clicked(obj):
                      size_hint_fill=FILL_HORIZ)
     cbox1.part_text_set("guide", "A short list (with callbacks attached)")
     cbox1.callback_item_pressed_add(combobox_item_pressed_cb)
-    cbox1.callback_dismissed_add(lambda cbox: print("DISMISSED", cbox))
-    cbox1.callback_expanded_add(lambda cbox: print("EXPANDED", cbox))
-    cbox1.callback_clicked_add(lambda cbox: print("CLICKED", cbox))
-    cbox1.callback_item_selected_add(lambda cbox, item: print("ITEM,SELECTED", 
item))
+    cbox1.callback_dismissed_add(generic_obj_cb, "DISMISSED")
+    cbox1.callback_expanded_add(generic_obj_cb, "EXPANDED")
+    cbox1.callback_clicked_add(generic_obj_cb, "CLICKED")
+    cbox1.callback_item_selected_add(generic_item_cb, "ITEM,SELECTED")
 
     for i in range(1, 7):
         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.callback_item_pressed_add(combobox_item_pressed_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):
         cbox2.item_append(itc, "Item # %d" % i)
diff --git a/examples/elementary/test_genlist_filter.py 
b/examples/elementary/test_genlist_filter.py
index 7b35491..ff69149 100644
--- a/examples/elementary/test_genlist_filter.py
+++ b/examples/elementary/test_genlist_filter.py
@@ -37,6 +37,8 @@ def gl_filter_get(obj, key, item_data):
 def entry_changed_cb(en, gl):
     gl.filter = en.text or None
 
+def filter_done_cb(gl):
+    print("filter,done")
 
 def test_genlist_filter(parent):
     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,
                  select_mode=elm.ELM_OBJECT_SELECT_MODE_ALWAYS,
                  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()
     box.pack_end(gl)
 

-- 


Reply via email to