aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary/test_diskselector.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_diskselector.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_diskselector.py')
-rw-r--r--examples/elementary/test_diskselector.py130
1 files changed, 130 insertions, 0 deletions
diff --git a/examples/elementary/test_diskselector.py b/examples/elementary/test_diskselector.py
new file mode 100644
index 0000000..e898d70
--- /dev/null
+++ b/examples/elementary/test_diskselector.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+months=["January", "February", "March", "April", "May", "June", "August", "September", "October", "November", "December"]
+weekdays=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+months_short=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+
+def disk_create(win, rnd):
+ di = elementary.Diskselector(win)
+ for m in months:
+ if m == "August":
+ it = di.item_append(m)
+ else:
+ di.item_append(m)
+
+ it.selected = True
+ di.round_enabled = rnd
+
+ return di
+
+def cb_sel(ds, item):
+ print(("Selected item: %s" % (item.text)))
+
+
+def diskselector_clicked(obj):
+ win = elementary.Window("diskselector", elementary.ELM_WIN_BASIC)
+ win.title = "Diskselector test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ di = disk_create(win, True)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.first_item.selected = True
+
+ di = disk_create(win, False)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.first_item.next.selected = True
+
+ di = disk_create(win, False)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.side_text_max_length = 4
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ di = elementary.Diskselector(win)
+ di.item_append("Sunday", ic)
+ for day in weekdays:
+ di.item_append(day)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ di = elementary.Diskselector(win)
+ di.item_append("머리스타일", ic)
+ for lan in ["プロが伝授する", "生上访要求政府", "English", "والشريعة", "עִבְרִית", "Grüßen"]:
+ di.item_append(lan)
+ di.round_enabled = True
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+
+ di = elementary.Diskselector(win)
+ di.display_item_num = 5
+ for m in months_short:
+ di.item_append(m)
+ di.round_enabled = True
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.last_item.selected = True
+
+ di = elementary.Diskselector(win)
+ di.display_item_num = 7
+ for i in range(31):
+ di.item_append(str(i))
+ di.round_enabled = True
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.last_item.selected = True
+
+
+ win.resize(320, 480)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ diskselector_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()