aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2015-01-19 23:44:27 +0100
committerDave Andreoli <dave@gurumeditation.it>2015-01-19 23:44:27 +0100
commite44d8b176bd4d62695320bf34ad78f0582db102d (patch)
treef1ae0b898296b68d83b9c438280f32700f1886b7 /examples/elementary
parentDocs: improved evas pages (diff)
downloadpython-efl-e44d8b176bd4d62695320bf34ad78f0582db102d.tar.gz
Genlist: new test for reorder mode
Diffstat (limited to 'examples/elementary')
-rwxr-xr-xexamples/elementary/test.py7
-rw-r--r--examples/elementary/test_genlist.py61
2 files changed, 66 insertions, 2 deletions
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index 8b6c117..19fdf25 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -156,8 +156,10 @@ items = [
("Input events", "test_input_events", "elm_input_events_clicked"),
("Gesture Layer", "test_gesture_layer", "gesture_layer_clicked"),
]),
- ("Lists", [
+ ("Lists - Gengrid", [
("Gengrid", "test_gengrid", "gengrid_clicked"),
+ ]),
+ ("Lists - Genlist", [
("Genlist", "test_genlist", "genlist_clicked"),
("Genlist 2", "test_genlist", "genlist2_clicked"),
("Genlist Group", "test_genlist", "genlist3_clicked"),
@@ -166,6 +168,9 @@ items = [
("Genlist Decorate Item Mode", "test_genlist", "genlist10_clicked"),
("Genlist Decorate All Mode", "test_genlist", "genlist15_clicked"),
("Genlist Search By Text", "test_genlist", "genlist20_clicked"),
+ ("Genlist Reorder Mode", "test_genlist", "genlist11_clicked"),
+ ]),
+ ("Lists - List", [
("List", "test_list", "list_clicked"),
("List 2", "test_list", "list2_clicked"),
("List 3", "test_list", "list3_clicked"),
diff --git a/examples/elementary/test_genlist.py b/examples/elementary/test_genlist.py
index 57756a3..6b14eb0 100644
--- a/examples/elementary/test_genlist.py
+++ b/examples/elementary/test_genlist.py
@@ -685,7 +685,6 @@ def genlist20_search_cb(en, gl, tg):
en.focus = True
elif gl.selected_item:
gl.selected_item.selected = False
-
def genlist20_clicked(obj, item=None):
win = StandardWindow("genlist-search-by-text",
@@ -738,6 +737,65 @@ def genlist20_clicked(obj, item=None):
win.show()
+
+### Genlist reorder mode
+class ItemClass11(GenlistItemClass):
+ def text_get(self, obj, part, data):
+ if part == "elm.text":
+ return "Item # %d" % data
+
+ def content_get(self, obj, part, data):
+ if part == "elm.swallow.icon":
+ return Icon(obj, file=os.path.join(img_path, "logo_small.png"))
+
+def genlist11_focus_highlight_ck_changed_cb(chk, win):
+ win.focus_highlight_enabled = chk.state
+
+def genlist11_reorder_tg_changed_cb(chk, gl):
+ gl.reorder_mode = chk.state
+
+def genlist11_clicked(obj, item=None):
+ win = StandardWindow("genlist-reorder-mode", "Genlist Reorder Mode",
+ autodel=True, size=(350, 500))
+
+ gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
+
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
+ win.resize_object_add(bx)
+ bx.show()
+
+ lb = Label(win)
+ lb.text = "<align=left>Enable reorder mode if you want to move items.<br>" \
+ "To move longress with mouse.</align>"
+ fr = Frame(win, text="Reorder Mode", content=lb,
+ size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
+ bx.pack_end(fr)
+ fr.show()
+
+ hbx = Box(win, horizontal=True, padding=(20,0),
+ size_hint_weight=EXPAND_HORIZ)
+ bx.pack_end(hbx)
+ hbx.show()
+
+ tg = Check(win, style="toggle", text="Reorder Mode:")
+ tg.callback_changed_add(genlist11_reorder_tg_changed_cb, gl)
+ hbx.pack_end(tg)
+ tg.show()
+
+ ck = Check(win, text="Focus Highlight")
+ ck.state = win.focus_highlight_enabled
+ ck.callback_changed_add(genlist11_focus_highlight_ck_changed_cb, win)
+ hbx.pack_end(ck)
+ ck.show()
+
+ itc11 = ItemClass11()
+ for i in range(1,50):
+ gl.item_append(itc11, i)
+ bx.pack_end(gl)
+ gl.show()
+
+ win.show()
+
if __name__ == "__main__":
elementary.init()
win = StandardWindow("test", "python-elementary test application",
@@ -767,6 +825,7 @@ if __name__ == "__main__":
("Genlist Decorate Item Mode", genlist10_clicked),
("Genlist Decorate All Mode", genlist15_clicked),
("Genlist Search By Text", genlist20_clicked),
+ ("Genlist Reorder Mode", genlist11_clicked),
]
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)