aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary/test_naviframe.py
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
commitb58be93f121c2ca240b888d1dd41896d4779927f (patch)
tree371d4e331b3e685e106b211ce3e28b31e9886ada /examples/elementary/test_naviframe.py
parentPython-EFL: Cleanup and enable compilation of emotion, cleaned also the test. (diff)
downloadpython-efl-b58be93f121c2ca240b888d1dd41896d4779927f.tar.gz
move elementary and emotion tests in a new examples dir. Now tests/ contain only unittest while examples/ all the other tests that need user interaction
SVN revision: 83964
Diffstat (limited to 'examples/elementary/test_naviframe.py')
-rw-r--r--examples/elementary/test_naviframe.py143
1 files changed, 143 insertions, 0 deletions
diff --git a/examples/elementary/test_naviframe.py b/examples/elementary/test_naviframe.py
new file mode 100644
index 0000000..44839db
--- /dev/null
+++ b/examples/elementary/test_naviframe.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def content_new(parent, img):
+ photo = elementary.Photo(parent)
+ photo.file_set(img)
+ photo.fill_inside_set(True)
+ photo.style_set("shadow")
+ return photo
+
+def navi_pop(bt, nf):
+ nf.item_pop()
+
+def navi_promote(bt, nf, item):
+ item.item_promote()
+
+def title_visible(obj, item):
+ item.title_visible = not item.title_visible
+
+def page2(bt, nf):
+ ic = elementary.Icon(nf)
+ ic.file_set("images/icon_right_arrow.png")
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(page3, nf)
+ bt.content_set(ic)
+
+ content = content_new(nf, "images/plant_01.jpg");
+ item = nf.item_push("Page 2", None, bt, content, "basic")
+ item.part_text_set("subtitle", "Here is sub-title part!")
+
+def page3(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Prev")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(page4, nf)
+ bt2.text_set("Next")
+
+ content = content_new(nf, "images/rock_01.jpg");
+ item = nf.item_push("Page 3", bt, bt2, content, "basic")
+ ic = elementary.Icon(nf)
+ ic.file_set("images/logo_small.png")
+ item.part_content_set("icon", ic)
+
+def page4(bt, nf):
+ ic = elementary.Icon(nf)
+ ic.file_set("images/icon_right_arrow.png")
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(page5, nf)
+ bt.content_set(ic)
+
+ content = content_new(nf, "images/rock_02.jpg");
+ item = nf.item_push("Page 4", None, bt, content, "basic")
+ ic = elementary.Icon(nf)
+ ic.file_set("images/logo_small.png")
+ item.part_content_set("icon", ic)
+ item.part_text_set("subtitle", "Title area visibility test")
+ item.title_visible_set(False)
+ content.callback_clicked_add(title_visible, item)
+
+def page5(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Page 4")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(page6, nf)
+ bt2.text_set("Page 6")
+
+ content = content_new(nf, "images/sky_01.jpg");
+ item = nf.item_insert_after(nf.top_item_get(), "Page 5", bt, bt2, content, "basic")
+ item.part_text_set("subtitle", "This page is inserted without transition (TODO)")
+
+def page6(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Page 5")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(page7, nf)
+ bt2.text_set("Page 7")
+
+ content = content_new(nf, "images/sky_03.jpg");
+ item = nf.item_push("Page 6", bt, bt2, content, "overlap")
+ item.part_text_set("subtitle", "Overlap style!")
+
+def page7(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Page 6")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(navi_promote, nf, nf.data["page1"])
+ bt2.text_set("Page 1")
+
+ content = content_new(nf, "images/sky_02.jpg");
+ item = nf.item_push("Page 7", bt, bt2, content, "overlap")
+ item.part_text_set("subtitle", "Overlap style!")
+
+
+def naviframe_clicked(obj):
+ win = elementary.Window("naviframe", elementary.ELM_WIN_BASIC)
+ win.title_set("Naviframe test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(bg)
+ bg.show()
+
+ nf = elementary.Naviframe(win)
+ nf.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ nf.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(nf)
+ nf.show()
+
+ bt = elementary.Button(win)
+ bt.callback_clicked_add(page2, nf)
+ bt.text_set("Next")
+
+ content = content_new(nf, "images/logo.png")
+ item = nf.item_push("Page 1", None, bt, content, "basic")
+ nf.data["page1"] = item
+
+ win.resize(400, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ naviframe_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()