summaryrefslogtreecommitdiff
path: root/tests/elementary/test_diskselector.py
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-02-11 22:32:50 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-02-11 22:32:50 +0000
commit8b8639886059814a36f57164d5572e97bcb00a47 (patch)
tree1c5a170de002793c1402d6afcc16c63115d81caa /tests/elementary/test_diskselector.py
Put in a first, still wip, version of the python bindings in a merged tree.
This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
Diffstat (limited to 'tests/elementary/test_diskselector.py')
-rw-r--r--tests/elementary/test_diskselector.py130
1 files changed, 130 insertions, 0 deletions
diff --git a/tests/elementary/test_diskselector.py b/tests/elementary/test_diskselector.py
new file mode 100644
index 0000000..e898d70
--- /dev/null
+++ b/tests/elementary/test_diskselector.py
@@ -0,0 +1,130 @@
1#!/usr/bin/env python
2# encoding: utf-8
3
4from efl import elementary
5from efl import evas
6
7
8months=["January", "February", "March", "April", "May", "June", "August", "September", "October", "November", "December"]
9weekdays=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
10months_short=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
11
12def disk_create(win, rnd):
13 di = elementary.Diskselector(win)
14 for m in months:
15 if m == "August":
16 it = di.item_append(m)
17 else:
18 di.item_append(m)
19
20 it.selected = True
21 di.round_enabled = rnd
22
23 return di
24
25def cb_sel(ds, item):
26 print(("Selected item: %s" % (item.text)))
27
28
29def diskselector_clicked(obj):
30 win = elementary.Window("diskselector", elementary.ELM_WIN_BASIC)
31 win.title = "Diskselector test"
32 win.autodel = True
33 if obj is None:
34 win.callback_delete_request_add(lambda o: elementary.exit())
35
36 bg = elementary.Background(win)
37 win.resize_object_add(bg)
38 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
39 bg.show()
40
41 vbox = elementary.Box(win)
42 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
43 win.resize_object_add(vbox)
44 vbox.show()
45
46 di = disk_create(win, True)
47 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
48 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
49 di.callback_selected_add(cb_sel)
50 vbox.pack_end(di)
51 di.show()
52 di.first_item.selected = True
53
54 di = disk_create(win, False)
55 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
56 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
57 di.callback_selected_add(cb_sel)
58 vbox.pack_end(di)
59 di.show()
60 di.first_item.next.selected = True
61
62 di = disk_create(win, False)
63 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
64 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
65 di.callback_selected_add(cb_sel)
66 vbox.pack_end(di)
67 di.show()
68 di.side_text_max_length = 4
69
70 ic = elementary.Icon(win)
71 ic.file = "images/logo_small.png"
72 di = elementary.Diskselector(win)
73 di.item_append("Sunday", ic)
74 for day in weekdays:
75 di.item_append(day)
76 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
77 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
78 di.callback_selected_add(cb_sel)
79 vbox.pack_end(di)
80 di.show()
81
82 ic = elementary.Icon(win)
83 ic.file = "images/logo_small.png"
84 di = elementary.Diskselector(win)
85 di.item_append("머리스타일", ic)
86 for lan in ["プロが伝授する", "生上访要求政府", "English", "والشريعة", "עִבְרִית", "Grüßen"]:
87 di.item_append(lan)
88 di.round_enabled = True
89 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
90 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
91 di.callback_selected_add(cb_sel)
92 vbox.pack_end(di)
93 di.show()
94
95 di = elementary.Diskselector(win)
96 di.display_item_num = 5
97 for m in months_short:
98 di.item_append(m)
99 di.round_enabled = True
100 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
101 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
102 di.callback_selected_add(cb_sel)
103 vbox.pack_end(di)
104 di.show()
105 di.last_item.selected = True
106
107 di = elementary.Diskselector(win)
108 di.display_item_num = 7
109 for i in range(31):
110 di.item_append(str(i))
111 di.round_enabled = True
112 di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
113 di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
114 di.callback_selected_add(cb_sel)
115 vbox.pack_end(di)
116 di.show()
117 di.last_item.selected = True
118
119
120 win.resize(320, 480)
121 win.show()
122
123
124if __name__ == "__main__":
125 elementary.init()
126
127 diskselector_clicked(None)
128
129 elementary.run()
130 elementary.shutdown()