summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-11-02 02:10:56 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2013-11-02 02:10:56 +0200
commita2364dba2c6cb275b3d3e592d128bfbc4a650dc0 (patch)
tree0e1fcddc0414c39075fa453116beed3efed708a1
parentfc69997a7525b60c3ae1501be0e23d1371bf7472 (diff)
Elementary: Examples, part N.
"We're doing it, we're doing it! Stop being so testy." - Vincent Price as The Sinister Man, addressing Satan.
-rw-r--r--examples/elementary/test_button.py4
-rw-r--r--examples/elementary/test_conform.py3
-rw-r--r--examples/elementary/test_external.py25
-rw-r--r--examples/elementary/test_fileselector.py194
-rw-r--r--examples/elementary/test_flip.py239
-rw-r--r--examples/elementary/test_flipselector.py46
-rw-r--r--examples/elementary/test_floating.py18
-rw-r--r--examples/elementary/test_frame.py68
-rw-r--r--examples/elementary/test_gengrid.py197
-rw-r--r--examples/elementary/test_genlist.py370
-rw-r--r--examples/elementary/test_gesture_layer.py54
-rw-r--r--examples/elementary/test_grid.py62
-rw-r--r--examples/elementary/test_hover.py159
-rw-r--r--examples/elementary/test_hoversel.py109
-rw-r--r--examples/elementary/test_icon.py131
-rw-r--r--examples/elementary/test_image.py69
-rw-r--r--examples/elementary/test_index.py67
-rw-r--r--examples/elementary/test_inwin.py16
-rw-r--r--examples/elementary/test_label.py101
-rw-r--r--examples/elementary/test_layout.py33
-rw-r--r--examples/elementary/test_list.py264
21 files changed, 812 insertions, 1417 deletions
diff --git a/examples/elementary/test_button.py b/examples/elementary/test_button.py
index b5e6377..7e719fc 100644
--- a/examples/elementary/test_button.py
+++ b/examples/elementary/test_button.py
@@ -33,7 +33,7 @@ def buttons_clicked(obj):
33 bx.pack_end(bt) 33 bx.pack_end(bt)
34 bt.show() 34 bt.show()
35 35
36 ic = Icon(win, file=ic_file, resizable=(0, 0)) 36 ic = Icon(win, file=ic_file, resizable=(False, False))
37 ic.show() 37 ic.show()
38 bt = Button(win, text="Icon no scale", content=ic) 38 bt = Button(win, text="Icon no scale", content=ic)
39 bx.pack_end(bt) 39 bx.pack_end(bt)
@@ -43,7 +43,7 @@ def buttons_clicked(obj):
43 bx.pack_end(bt) 43 bx.pack_end(bt)
44 bt.show() 44 bt.show()
45 45
46 ic = Icon(win, file=ic_file, resizable=(0, 0)) 46 ic = Icon(win, file=ic_file, resizable=(False, False))
47 bt = Button(win, content=ic) 47 bt = Button(win, content=ic)
48 bx.pack_end(bt) 48 bx.pack_end(bt)
49 bt.show() 49 bt.show()
diff --git a/examples/elementary/test_conform.py b/examples/elementary/test_conform.py
index 7af54f6..cef9a12 100644
--- a/examples/elementary/test_conform.py
+++ b/examples/elementary/test_conform.py
@@ -1,3 +1,6 @@
1#!/usr/bin/env python
2# encoding: utf-8
3
1from efl import elementary 4from efl import elementary
2from efl.elementary.window import StandardWindow 5from efl.elementary.window import StandardWindow
3from efl.elementary.conformant import Conformant 6from efl.elementary.conformant import Conformant
diff --git a/examples/elementary/test_external.py b/examples/elementary/test_external.py
index dc7788d..d3f8855 100644
--- a/examples/elementary/test_external.py
+++ b/examples/elementary/test_external.py
@@ -1,6 +1,8 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4import os
5
4from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
5from efl.ecore import Timer 7from efl.ecore import Timer
6from efl import edje 8from efl import edje
@@ -17,13 +19,18 @@ from efl.elementary.list import List
17EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 19EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
18FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 20FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
19 21
22script_path = os.path.dirname(os.path.abspath(__file__))
23img_path = os.path.join(script_path, "images")
24
20def edje_external_button_clicked(obj, item=None): 25def edje_external_button_clicked(obj, item=None):
21 win = StandardWindow("edje-external-button", "Edje External Button", 26 win = StandardWindow("edje-external-button", "Edje External Button",
22 autodel=True, size=(320, 400)) 27 autodel=True, size=(320, 400))
23 if obj is None: 28 if obj is None:
24 win.callback_delete_request_add(lambda o: elementary.exit()) 29 win.callback_delete_request_add(lambda o: elementary.exit())
25 30
26 ly = Layout(win, file=("test_external.edj", "external/button"), 31 ly = Layout(win,file=(
32 os.path.join(script_path, "test_external.edj"),
33 "external/button"),
27 size_hint_weight=EXPAND_BOTH) 34 size_hint_weight=EXPAND_BOTH)
28 win.resize_object_add(ly) 35 win.resize_object_add(ly)
29 ly.show() 36 ly.show()
@@ -63,7 +70,9 @@ def edje_external_pbar_clicked(obj, item=None):
63 if obj is None: 70 if obj is None:
64 win.callback_delete_request_add(lambda o: elementary.exit()) 71 win.callback_delete_request_add(lambda o: elementary.exit())
65 72
66 ly = Layout(win, file=("test_external.edj", "external/pbar"), 73 ly = Layout(win, file=(
74 os.path.join(script_path, "test_external.edj"),
75 "external/pbar"),
67 size_hint_weight=EXPAND_BOTH) 76 size_hint_weight=EXPAND_BOTH)
68 win.resize_object_add(ly) 77 win.resize_object_add(ly)
69 ly.show() 78 ly.show()
@@ -80,7 +89,9 @@ def edje_external_scroller_clicked(obj, item=None):
80 if obj is None: 89 if obj is None:
81 win.callback_delete_request_add(lambda o: elementary.exit()) 90 win.callback_delete_request_add(lambda o: elementary.exit())
82 91
83 ly = Layout(win, file=("test_external.edj", "external/scroller"), 92 ly = Layout(win, file=(
93 os.path.join(script_path, "test_external.edj"),
94 "external/scroller"),
84 size_hint_weight=EXPAND_BOTH) 95 size_hint_weight=EXPAND_BOTH)
85 win.resize_object_add(ly) 96 win.resize_object_add(ly)
86 ly.show() 97 ly.show()
@@ -93,7 +104,9 @@ def edje_external_slider_clicked(obj, item=None):
93 if obj is None: 104 if obj is None:
94 win.callback_delete_request_add(lambda o: elementary.exit()) 105 win.callback_delete_request_add(lambda o: elementary.exit())
95 106
96 ly = Layout(win, file=("test_external.edj", "external/slider"), 107 ly = Layout(win, file=(
108 os.path.join(script_path, "test_external.edj"),
109 "external/slider"),
97 size_hint_weight=EXPAND_BOTH) 110 size_hint_weight=EXPAND_BOTH)
98 win.resize_object_add(ly) 111 win.resize_object_add(ly)
99 ly.show() 112 ly.show()
@@ -106,7 +119,9 @@ def edje_external_video_clicked(obj, item=None):
106 if obj is None: 119 if obj is None:
107 win.callback_delete_request_add(lambda o: elementary.exit()) 120 win.callback_delete_request_add(lambda o: elementary.exit())
108 121
109 ly = Layout(win, file=("test_external.edj", "external/video"), 122 ly = Layout(win, file=(
123 os.path.join(script_path, "test_external.edj"),
124 "external/video"),
110 size_hint_weight=EXPAND_BOTH) 125 size_hint_weight=EXPAND_BOTH)
111 win.resize_object_add(ly) 126 win.resize_object_add(ly)
112 ly.show() 127 ly.show()
diff --git a/examples/elementary/test_fileselector.py b/examples/elementary/test_fileselector.py
index c4f51d0..e7bf408 100644
--- a/examples/elementary/test_fileselector.py
+++ b/examples/elementary/test_fileselector.py
@@ -2,10 +2,10 @@
2# encoding: utf-8 2# encoding: utf-8
3 3
4import os 4import os
5from efl import evas 5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
6from efl import elementary 7from efl import elementary
7from efl.elementary.window import Window 8from efl.elementary.window import StandardWindow
8from efl.elementary.background import Background
9from efl.elementary.box import Box 9from efl.elementary.box import Box
10from efl.elementary.frame import Frame 10from efl.elementary.frame import Frame
11from efl.elementary.label import Label 11from efl.elementary.label import Label
@@ -17,6 +17,8 @@ from efl.elementary.fileselector_button import FileselectorButton
17from efl.elementary.fileselector_entry import FileselectorEntry 17from efl.elementary.fileselector_entry import FileselectorEntry
18from efl.elementary.separator import Separator 18from efl.elementary.separator import Separator
19 19
20EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
21FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
20 22
21def fs_cb_done(fs, selected, win): 23def fs_cb_done(fs, selected, win):
22 win.delete() 24 win.delete()
@@ -56,90 +58,65 @@ def bt_cb_mode_cycle(bt, fs):
56 58
57 59
58def fileselector_clicked(obj, item=None): 60def fileselector_clicked(obj, item=None):
59 win = Window("fileselector", elementary.ELM_WIN_BASIC) 61 win = StandardWindow("fileselector", "File selector test", autodel=True,
60 win.title_set("File selector test") 62 size=(240,350))
61 win.autodel_set(True)
62
63 bg = Background(win)
64 win.resize_object_add(bg)
65 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
66 bg.show()
67 63
68 vbox = Box(win) 64 vbox = Box(win, size_hint_weight=EXPAND_BOTH)
69 win.resize_object_add(vbox) 65 win.resize_object_add(vbox)
70 vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
71 vbox.show() 66 vbox.show()
72 67
73 fs = Fileselector(win) 68 fs = Fileselector(win, is_save=True, expandable=True, folder_only=True,
74 fs.is_save_set(True) 69 path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH,
75 fs.expandable_set(False) 70 size_hint_align=FILL_BOTH)
76 fs.folder_only_set(False)
77 fs.path_set(os.getenv("HOME"))
78 fs.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
79 fs.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
80 fs.callback_done_add(fs_cb_done, win) 71 fs.callback_done_add(fs_cb_done, win)
81 fs.callback_selected_add(fs_cb_selected, win) 72 fs.callback_selected_add(fs_cb_selected, win)
82 fs.callback_directory_open_add(fs_cb_directory_open, win) 73 fs.callback_directory_open_add(fs_cb_directory_open, win)
83 vbox.pack_end(fs) 74 vbox.pack_end(fs)
84 fs.show() 75 fs.show()
85 76
86 sep = Separator(win) 77 sep = Separator(win, horizontal=True)
87 sep.horizontal_set(True)
88 vbox.pack_end(sep) 78 vbox.pack_end(sep)
89 sep.show() 79 sep.show()
90 80
91 hbox = Box(win) 81 hbox = Box(win, horizontal=True)
92 hbox.horizontal_set(True)
93 vbox.pack_end(hbox) 82 vbox.pack_end(hbox)
94 hbox.show() 83 hbox.show()
95 84
96 ck = Check(win) 85 ck = Check(win, text="is_save", state=fs.is_save)
97 ck.text_set("is_save")
98 ck.state_set(fs.is_save)
99 ck.callback_changed_add(ck_cb_is_save, fs) 86 ck.callback_changed_add(ck_cb_is_save, fs)
100 hbox.pack_end(ck) 87 hbox.pack_end(ck)
101 ck.show() 88 ck.show()
102 89
103 ck = Check(win) 90 ck = Check(win, text="folder_only", state=fs.folder_only)
104 ck.text_set("folder_only")
105 ck.state_set(fs.folder_only)
106 ck.callback_changed_add(ck_cb_folder_only, fs) 91 ck.callback_changed_add(ck_cb_folder_only, fs)
107 hbox.pack_end(ck) 92 hbox.pack_end(ck)
108 ck.show() 93 ck.show()
109 94
110 ck = Check(win) 95 ck = Check(win, text="expandable", state=fs.expandable)
111 ck.text_set("expandable")
112 ck.state_set(fs.expandable)
113 ck.callback_changed_add(ck_cb_expandable, fs) 96 ck.callback_changed_add(ck_cb_expandable, fs)
114 hbox.pack_end(ck) 97 hbox.pack_end(ck)
115 ck.show() 98 ck.show()
116 99
117 ck = Check(win) 100 ck = Check(win, text="buttons", state=fs.buttons_ok_cancel)
118 ck.text_set("buttons")
119 ck.state_set(fs.buttons_ok_cancel)
120 ck.callback_changed_add(ck_cb_buttons, fs) 101 ck.callback_changed_add(ck_cb_buttons, fs)
121 hbox.pack_end(ck) 102 hbox.pack_end(ck)
122 ck.show() 103 ck.show()
123 104
124 hbox = Box(win) 105 hbox = Box(win, horizontal=True)
125 hbox.horizontal_set(True)
126 vbox.pack_end(hbox) 106 vbox.pack_end(hbox)
127 hbox.show() 107 hbox.show()
128 108
129 bt = Button(win) 109 bt = Button(win, text="selected_get")
130 bt.text_set("selected_get")
131 bt.callback_clicked_add(bt_cb_sel_get, fs) 110 bt.callback_clicked_add(bt_cb_sel_get, fs)
132 hbox.pack_end(bt) 111 hbox.pack_end(bt)
133 bt.show() 112 bt.show()
134 113
135 bt = Button(win) 114 bt = Button(win, text="path_get")
136 bt.text_set("path_get")
137 bt.callback_clicked_add(bt_cb_path_get, fs) 115 bt.callback_clicked_add(bt_cb_path_get, fs)
138 hbox.pack_end(bt) 116 hbox.pack_end(bt)
139 bt.show() 117 bt.show()
140 118
141 bt = Button(win) 119 bt = Button(win, text="mode cycle")
142 bt.text_set("mode cycle")
143 bt.callback_clicked_add(bt_cb_mode_cycle, fs) 120 bt.callback_clicked_add(bt_cb_mode_cycle, fs)
144 hbox.pack_end(bt) 121 hbox.pack_end(bt)
145 bt.show() 122 bt.show()
@@ -149,75 +126,53 @@ def fileselector_clicked(obj, item=None):
149 126
150 127
151def fileselector_button_clicked(obj, item=None): 128def fileselector_button_clicked(obj, item=None):
152 win = Window("fileselector", elementary.ELM_WIN_BASIC) 129 win = StandardWindow("fileselector", "File selector test", autodel=True,
153 win.title_set("File selector test") 130 size=(240, 350))
154 win.autodel_set(True)
155 131
156 bg = Background(win) 132 vbox = Box(win, size_hint_weight=EXPAND_BOTH)
157 win.resize_object_add(bg)
158 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
159 bg.show()
160
161 vbox = Box(win)
162 win.resize_object_add(vbox) 133 win.resize_object_add(vbox)
163 vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
164 vbox.show() 134 vbox.show()
165 135
166 fse = FileselectorButton(win) 136 fse = FileselectorButton(win, text="Select a file", inwin_mode=False,
167 fse.text_set("Select a file") 137 size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
168 fse.inwin_mode_set(False)
169 fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
170 fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
171 vbox.pack_end(fse) 138 vbox.pack_end(fse)
172 fse.show() 139 fse.show()
173 140
174 sep = Separator(win) 141 sep = Separator(win, horizontal=True)
175 sep.horizontal_set(True)
176 vbox.pack_end(sep) 142 vbox.pack_end(sep)
177 sep.show() 143 sep.show()
178 144
179 hbox = Box(win) 145 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
180 hbox.horizontal_set(True)
181 hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
182 vbox.pack_end(hbox) 146 vbox.pack_end(hbox)
183 hbox.show() 147 hbox.show()
184 148
185 ck = Check(win) 149 ck = Check(win, text="inwin", state=fse.inwin_mode)
186 ck.text_set("inwin")
187 ck.state_set(fse.inwin_mode)
188 ck.callback_changed_add(ck_entry_cb_inwin, fse) 150 ck.callback_changed_add(ck_entry_cb_inwin, fse)
189 hbox.pack_end(ck) 151 hbox.pack_end(ck)
190 ck.show() 152 ck.show()
191 153
192 ck = Check(win) 154 ck = Check(win, text="folder_only", state=fse.folder_only)
193 ck.text_set("folder_only")
194 ck.state_set(fse.folder_only)
195 ck.callback_changed_add(ck_entry_cb_folder_only, fse) 155 ck.callback_changed_add(ck_entry_cb_folder_only, fse)
196 hbox.pack_end(ck) 156 hbox.pack_end(ck)
197 ck.show() 157 ck.show()
198 158
199 ck = Check(win) 159 ck = Check(win, text="is_save", state=fse.is_save)
200 ck.text_set("is_save")
201 ck.state_set(fse.is_save)
202 ck.callback_changed_add(ck_entry_cb_is_save, fse) 160 ck.callback_changed_add(ck_entry_cb_is_save, fse)
203 hbox.pack_end(ck) 161 hbox.pack_end(ck)
204 ck.show() 162 ck.show()
205 163
206 ck = Check(win) 164 ck = Check(win, text="expandable", state=fse.expandable)
207 ck.text_set("expandable")
208 ck.state_set(fse.expandable)
209 ck.callback_changed_add(ck_entry_cb_expandable, fse) 165 ck.callback_changed_add(ck_entry_cb_expandable, fse)
210 hbox.pack_end(ck) 166 hbox.pack_end(ck)
211 ck.show() 167 ck.show()
212 168
213 win.resize(240, 350)
214 win.show() 169 win.show()
215 170
216 171
217def ck_entry_cb_is_save(bt, fse): 172def ck_entry_cb_is_save(bt, fse):
218 print("Toggle is save") 173 print("Toggle is save")
219 fse.is_save = not fse.is_save 174 fse.is_save = not fse.is_save
220 175
221def ck_entry_cb_inwin(bt, fse): 176def ck_entry_cb_inwin(bt, fse):
222 print("Toggle inwin mode") 177 print("Toggle inwin mode")
223 fse.inwin_mode = not fse.inwin_mode 178 fse.inwin_mode = not fse.inwin_mode
@@ -232,110 +187,75 @@ def ck_entry_cb_expandable(bt, fse):
232 187
233 188
234def fileselector_entry_clicked(obj, item=None): 189def fileselector_entry_clicked(obj, item=None):
235 win = Window("fileselector", elementary.ELM_WIN_BASIC) 190 win = StandardWindow("fileselector", "File selector test", autodel=True,
236 win.title_set("File selector test") 191 size=(240, 150))
237 win.autodel_set(True)
238
239 bg = Background(win)
240 win.resize_object_add(bg)
241 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
242 bg.show()
243 192
244 vbox = Box(win) 193 vbox = Box(win, size_hint_weight=EXPAND_BOTH)
245 win.resize_object_add(vbox) 194 win.resize_object_add(vbox)
246 vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
247 vbox.show() 195 vbox.show()
248 196
249 fse = FileselectorEntry(win) 197 fse = FileselectorEntry(win, text="Select a file", inwin_mode=False,
250 fse.text_set("Select a file") 198 size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
251 fse.inwin_mode_set(False)
252 fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
253 fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
254 vbox.pack_end(fse) 199 vbox.pack_end(fse)
255 fse.show() 200 fse.show()
256 201
257 sep = Separator(win) 202 sep = Separator(win, horizontal=True)
258 sep.horizontal_set(True)
259 vbox.pack_end(sep) 203 vbox.pack_end(sep)
260 sep.show() 204 sep.show()
261 205
262 hbox = Box(win) 206 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
263 hbox.horizontal_set(True)
264 hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
265 vbox.pack_end(hbox) 207 vbox.pack_end(hbox)
266 hbox.show() 208 hbox.show()
267 209
268 ck = Check(win) 210 ck = Check(win, text="inwin", state=fse.inwin_mode)
269 ck.text_set("inwin")
270 ck.state_set(fse.inwin_mode)
271 ck.callback_changed_add(ck_entry_cb_inwin, fse) 211 ck.callback_changed_add(ck_entry_cb_inwin, fse)
272 hbox.pack_end(ck) 212 hbox.pack_end(ck)
273 ck.show() 213 ck.show()
274 214
275 ck = Check(win) 215 ck = Check(win, text="folder_only", state=fse.folder_only)
276 ck.text_set("folder_only")
277 ck.state_set(fse.folder_only)
278 ck.callback_changed_add(ck_entry_cb_folder_only, fse) 216 ck.callback_changed_add(ck_entry_cb_folder_only, fse)
279 hbox.pack_end(ck) 217 hbox.pack_end(ck)
280 ck.show() 218 ck.show()
281 219
282 ck = Check(win) 220 ck = Check(win, text="is_save", state=fse.is_save)
283 ck.text_set("is_save")
284 ck.state_set(fse.is_save)
285 ck.callback_changed_add(ck_entry_cb_is_save, fse) 221 ck.callback_changed_add(ck_entry_cb_is_save, fse)
286 hbox.pack_end(ck) 222 hbox.pack_end(ck)
287 ck.show() 223 ck.show()
288 224
289 ck = Check(win) 225 ck = Check(win, text="expandable", state=fse.expandable)
290 ck.text_set("expandable")
291 ck.state_set(fse.expandable)
292 ck.callback_changed_add(ck_entry_cb_expandable, fse) 226 ck.callback_changed_add(ck_entry_cb_expandable, fse)
293 hbox.pack_end(ck) 227 hbox.pack_end(ck)
294 ck.show() 228 ck.show()
295 229
296 win.resize(240, 150)
297 win.show() 230 win.show()
298 231
299 232
300if __name__ == "__main__": 233if __name__ == "__main__":
301 def destroy(obj):
302 elementary.exit()
303
304 elementary.init() 234 elementary.init()
305 win = Window("test", elementary.ELM_WIN_BASIC) 235 win = StandardWindow("test", "python-elementary test application",
306 win.title_set("python-elementary test application") 236 size=(320,520))
307 win.callback_delete_request_add(destroy) 237 win.callback_delete_request_add(lambda o: elementary.exit())
308
309 bg = Background(win)
310 win.resize_object_add(bg)
311 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
312 bg.show()
313 238
314 box0 = Box(win) 239 box0 = Box(win, size_hint_weight=EXPAND_BOTH)
315 box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
316 win.resize_object_add(box0) 240 win.resize_object_add(box0)
317 box0.show() 241 box0.show()
318 242
319 fr = Frame(win)
320 fr.text_set("Information")
321 box0.pack_end(fr)
322 fr.show()
323
324 lb = Label(win) 243 lb = Label(win)
325 lb.text_set("Please select a test from the list below<br>" 244 lb.text_set("Please select a test from the list below<br>"
326 "by clicking the test button to show the<br>" 245 "by clicking the test button to show the<br>"
327 "test window.") 246 "test window.")
328 fr.content_set(lb)
329 lb.show() 247 lb.show()
330 248
249 fr = Frame(win, text="Information", content=lb)
250 box0.pack_end(fr)
251 fr.show()
252
331 items = [("Fileselector", fileselector_clicked), 253 items = [("Fileselector", fileselector_clicked),
332 ("Fileselector Button", fileselector_button_clicked), 254 ("Fileselector Button", fileselector_button_clicked),
333 ("Fileselector Entry", fileselector_entry_clicked), 255 ("Fileselector Entry", fileselector_entry_clicked),
334 ] 256 ]
335 257
336 li = List(win) 258 li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
337 li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
338 li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
339 box0.pack_end(li) 259 box0.pack_end(li)
340 li.show() 260 li.show()
341 261
@@ -344,8 +264,6 @@ if __name__ == "__main__":
344 264
345 li.go() 265 li.go()
346 266
347 win.resize(320,520)
348 win.show() 267 win.show()
349 elementary.run() 268 elementary.run()
350 elementary.shutdown() 269 elementary.shutdown()
351
diff --git a/examples/elementary/test_flip.py b/examples/elementary/test_flip.py
index 1be125c..63cd52e 100644
--- a/examples/elementary/test_flip.py
+++ b/examples/elementary/test_flip.py
@@ -1,9 +1,11 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4import os
5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
5from efl import elementary 7from efl import elementary
6from efl.elementary.window import Window 8from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background 9from efl.elementary.background import Background
8from efl.elementary.box import Box 10from efl.elementary.box import Box
9from efl.elementary.frame import Frame 11from efl.elementary.frame import Frame
@@ -12,8 +14,22 @@ from efl.elementary.button import Button
12from efl.elementary.layout import Layout 14from efl.elementary.layout import Layout
13from efl.elementary.list import List 15from efl.elementary.list import List
14from efl.elementary.radio import Radio 16from efl.elementary.radio import Radio
15from efl.elementary.flip import Flip 17from efl.elementary.flip import Flip, ELM_FLIP_ROTATE_X_CENTER_AXIS, \
16 18 ELM_FLIP_ROTATE_Y_CENTER_AXIS, ELM_FLIP_ROTATE_XZ_CENTER_AXIS, \
19 ELM_FLIP_ROTATE_YZ_CENTER_AXIS, ELM_FLIP_CUBE_LEFT, ELM_FLIP_CUBE_RIGHT, \
20 ELM_FLIP_CUBE_UP, ELM_FLIP_CUBE_DOWN, ELM_FLIP_PAGE_LEFT, \
21 ELM_FLIP_PAGE_RIGHT, ELM_FLIP_PAGE_UP, ELM_FLIP_PAGE_DOWN, \
22 ELM_FLIP_DIRECTION_UP, ELM_FLIP_DIRECTION_DOWN, \
23 ELM_FLIP_DIRECTION_LEFT, ELM_FLIP_DIRECTION_RIGHT, \
24 ELM_FLIP_INTERACTION_NONE, ELM_FLIP_INTERACTION_ROTATE, \
25 ELM_FLIP_INTERACTION_CUBE, ELM_FLIP_INTERACTION_PAGE
26
27EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
28EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
29FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
30
31script_path = os.path.dirname(os.path.abspath(__file__))
32img_path = os.path.join(script_path, "images")
17 33
18def my_flip_go(bt, fl, mode): 34def my_flip_go(bt, fl, mode):
19 fl.go(mode) 35 fl.go(mode)
@@ -25,128 +41,94 @@ def my_flip_animate_done(fl):
25 print("Animation Done") 41 print("Animation Done")
26 42
27def flip_clicked(obj, item=None): 43def flip_clicked(obj, item=None):
28 # window 44 win = StandardWindow("flip", "Flip", autodel=True, size=(320, 320))
29 win = Window("flip", elementary.ELM_WIN_BASIC) 45
30 win.autodel_set(True) 46 box = Box(win, size_hint_weight=EXPAND_BOTH)
31 win.title_set("Flip")
32
33 # background
34 bg = Background(win)
35 win.resize_object_add(bg)
36 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
37 bg.show()
38
39 # main vertical box
40 box = Box(win)
41 box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
42 win.resize_object_add(box) 47 win.resize_object_add(box)
43 box.show() 48 box.show()
44 49
45 # flip object 50 fl = Flip(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
46 fl = Flip(win)
47 fl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
48 fl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
49 fl.callback_animate_begin_add(my_flip_animate_begin) 51 fl.callback_animate_begin_add(my_flip_animate_begin)
50 fl.callback_animate_done_add(my_flip_animate_done) 52 fl.callback_animate_done_add(my_flip_animate_done)
51 box.pack_end(fl) 53 box.pack_end(fl)
52 fl.show() 54 fl.show()
53 55
54 56 # flip front content
55 # front content (image) 57 o = Background(win, size_hint_weight=EXPAND_BOTH,
56 o = Background(win) 58 file=os.path.join(img_path, "sky_01.jpg"))
57 o.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
58 o.file_set("images/sky_01.jpg")
59 fl.part_content_set("front", o) 59 fl.part_content_set("front", o)
60 o.show() 60 o.show()
61 61
62 # back content (layout) 62 # flip back content
63 ly = Layout(win) 63 ly = Layout(win, file=(os.path.join(script_path, "test.edj"), "layout"),
64 ly.file_set("test.edj", "layout") 64 size_hint_weight=EXPAND_BOTH)
65 ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
66 fl.part_content_set("back", ly) 65 fl.part_content_set("back", ly)
67 ly.show() 66 ly.show()
68 67
69 bt = Button(win) 68 bt = Button(win, text="Button 1")
70 bt.text_set("Button 1")
71 ly.part_content_set("element1", bt) 69 ly.part_content_set("element1", bt)
72 bt.show() 70 bt.show()
73 71
74 bt = Button(win) 72 bt = Button(win, text="Button 2")
75 bt.text_set("Button 2")
76 ly.part_content_set("element2", bt) 73 ly.part_content_set("element2", bt)
77 bt.show() 74 bt.show()
78 75
79 bt = Button(win) 76 bt = Button(win, text="Button 3")
80 bt.text_set("Button 3")
81 ly.part_content_set("element3", bt) 77 ly.part_content_set("element3", bt)
82 bt.show() 78 bt.show()
83 79
84 # flip buttons (first row) 80 # flip buttons (first row)
85 hbox = Box(win) 81 hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
86 hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) 82 size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
87 hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
88 hbox.horizontal_set(True)
89 hbox.show() 83 hbox.show()
90 box.pack_end(hbox) 84 box.pack_end(hbox)
91 count = 1 85 count = 1
92 86
93 for mode in [elementary.ELM_FLIP_ROTATE_X_CENTER_AXIS, 87 for mode in [ELM_FLIP_ROTATE_X_CENTER_AXIS,
94 elementary.ELM_FLIP_ROTATE_Y_CENTER_AXIS, 88 ELM_FLIP_ROTATE_Y_CENTER_AXIS,
95 elementary.ELM_FLIP_ROTATE_XZ_CENTER_AXIS, 89 ELM_FLIP_ROTATE_XZ_CENTER_AXIS,
96 elementary.ELM_FLIP_ROTATE_YZ_CENTER_AXIS]: 90 ELM_FLIP_ROTATE_YZ_CENTER_AXIS]:
97 bt = Button(win) 91 bt = Button(win, size_hint_weight=EXPAND_BOTH,
98 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 92 size_hint_align=FILL_BOTH, text=str(count))
99 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
100 bt.text_set(str(count))
101 bt.callback_clicked_add(my_flip_go, fl, mode) 93 bt.callback_clicked_add(my_flip_go, fl, mode)
102 hbox.pack_end(bt) 94 hbox.pack_end(bt)
103 bt.show() 95 bt.show()
104 count += 1 96 count += 1
105 97
106 # flip buttons (second row) 98 # flip buttons (second row)
107 hbox = Box(win) 99 hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
108 hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) 100 size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
109 hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
110 hbox.horizontal_set(True)
111 hbox.show() 101 hbox.show()
112 box.pack_end(hbox) 102 box.pack_end(hbox)
113 103
114 for mode in [elementary.ELM_FLIP_CUBE_LEFT, 104 for mode in [ELM_FLIP_CUBE_LEFT,
115 elementary.ELM_FLIP_CUBE_RIGHT, 105 ELM_FLIP_CUBE_RIGHT,
116 elementary.ELM_FLIP_CUBE_UP, 106 ELM_FLIP_CUBE_UP,
117 elementary.ELM_FLIP_CUBE_DOWN]: 107 ELM_FLIP_CUBE_DOWN]:
118 bt = Button(win) 108 bt = Button(win, size_hint_weight=EXPAND_BOTH,
119 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 109 size_hint_align=FILL_BOTH, text=str(count))
120 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
121 bt.text_set(str(count))
122 bt.callback_clicked_add(my_flip_go, fl, mode) 110 bt.callback_clicked_add(my_flip_go, fl, mode)
123 hbox.pack_end(bt) 111 hbox.pack_end(bt)
124 bt.show() 112 bt.show()
125 count += 1 113 count += 1
126 114
127 # flip buttons (third row) 115 # flip buttons (third row)
128 hbox = Box(win) 116 hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
129 hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) 117 size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
130 hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
131 hbox.horizontal_set(True)
132 hbox.show() 118 hbox.show()
133 box.pack_end(hbox) 119 box.pack_end(hbox)
134 120
135 for mode in [elementary.ELM_FLIP_PAGE_LEFT, 121 for mode in [ELM_FLIP_PAGE_LEFT,
136 elementary.ELM_FLIP_PAGE_RIGHT, 122 ELM_FLIP_PAGE_RIGHT,
137 elementary.ELM_FLIP_PAGE_UP, 123 ELM_FLIP_PAGE_UP,
138 elementary.ELM_FLIP_PAGE_DOWN]: 124 ELM_FLIP_PAGE_DOWN]:
139 bt = Button(win) 125 bt = Button(win, size_hint_weight=EXPAND_BOTH,
140 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 126 size_hint_align=FILL_BOTH, text=str(count))
141 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
142 bt.text_set(str(count))
143 bt.callback_clicked_add(my_flip_go, fl, mode) 127 bt.callback_clicked_add(my_flip_go, fl, mode)
144 hbox.pack_end(bt) 128 hbox.pack_end(bt)
145 bt.show() 129 bt.show()
146 count += 1 130 count += 1
147 131
148 # window show
149 win.resize(320, 320)
150 win.show() 132 win.show()
151 133
152 134
@@ -155,147 +137,107 @@ def my_cb_radios (rd, fl):
155 fl.interaction_set(rd.value_get()) 137 fl.interaction_set(rd.value_get())
156 138
157def flip_interactive_clicked(obj, item=None): 139def flip_interactive_clicked(obj, item=None):
158 # window 140 win = StandardWindow("flip", "Flip", autodel=True, size=(320, 320))
159 win = Window("flip", elementary.ELM_WIN_BASIC) 141
160 win.autodel_set(True) 142 box = Box(win, size_hint_weight=EXPAND_BOTH)
161 win.title_set("Flip")
162
163 # background
164 bg = Background(win)
165 win.resize_object_add(bg)
166 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
167 bg.show()
168
169 # main vertical box
170 box = Box(win)
171 box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
172 win.resize_object_add(box) 143 win.resize_object_add(box)
173 box.show() 144 box.show()
174 145
175 # flip object 146 # flip object
176 fl = Flip(win) 147 fl = Flip(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
177 fl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 148 interaction=ELM_FLIP_INTERACTION_NONE)
178 fl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 149 fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_UP, True)
179 fl.interaction_set(elementary.ELM_FLIP_INTERACTION_NONE); 150 fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_DOWN, True)
180 fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_UP, True); 151 fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_LEFT, True)
181 fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_DOWN, True); 152 fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_RIGHT, True)
182 fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_LEFT, True); 153 fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_UP, 0.25)
183 fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_RIGHT, True); 154 fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_DOWN, 0.25)
184 fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_UP, 0.25); 155 fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_LEFT, 0.25)
185 fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_DOWN, 0.25); 156 fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_RIGHT, 0.25)
186 fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_LEFT, 0.25);
187 fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_RIGHT, 0.25);
188 fl.callback_animate_begin_add(my_flip_animate_begin) 157 fl.callback_animate_begin_add(my_flip_animate_begin)
189 fl.callback_animate_done_add(my_flip_animate_done) 158 fl.callback_animate_done_add(my_flip_animate_done)
190 box.pack_end(fl) 159 box.pack_end(fl)
191 fl.show() 160 fl.show()
192 161
193 # front content (image) 162 # front content (image)
194 o = Background(win) 163 o = Background(win, size_hint_weight=EXPAND_BOTH,
195 o.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 164 file=os.path.join(img_path, "sky_01.jpg"))
196 o.file_set("images/sky_01.jpg")
197 fl.part_content_set("front", o) 165 fl.part_content_set("front", o)
198 o.show() 166 o.show()
199 167
200 # back content (layout) 168 # back content (layout)
201 ly = Layout(win) 169 ly = Layout(win, size_hint_weight=EXPAND_BOTH,
202 ly.file_set("test.edj", "layout") 170 file=(os.path.join(script_path, "test.edj"), "layout"))
203 ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
204 fl.part_content_set("back", ly) 171 fl.part_content_set("back", ly)
205 ly.show() 172 ly.show()
206 173
207 bt = Button(win) 174 bt = Button(win, text="Button 1")
208 bt.text_set("Button 1")
209 ly.part_content_set("element1", bt) 175 ly.part_content_set("element1", bt)
210 bt.show() 176 bt.show()
211 177
212 bt = Button(win) 178 bt = Button(win, text="Button 2")
213 bt.text_set("Button 2")
214 ly.part_content_set("element2", bt) 179 ly.part_content_set("element2", bt)
215 bt.show() 180 bt.show()
216 181
217 bt = Button(win) 182 bt = Button(win, text="Button 3")
218 bt.text_set("Button 3")
219 ly.part_content_set("element3", bt) 183 ly.part_content_set("element3", bt)
220 bt.show() 184 bt.show()
221 185
222 186
223 # radio buttons 187 # radio buttons
224 rd = Radio(win) 188 rd = Radio(win, state_value=ELM_FLIP_INTERACTION_NONE, text="None")
225 rd.state_value_set(elementary.ELM_FLIP_INTERACTION_NONE)
226 rd.text_set("None")
227 rd.callback_changed_add(my_cb_radios, fl) 189 rd.callback_changed_add(my_cb_radios, fl)
228 box.pack_end(rd) 190 box.pack_end(rd)
229 rd.show() 191 rd.show()
230 rdg = rd 192 rdg = rd
231 193
232 rd = Radio(win) 194 rd = Radio(win, state_value=ELM_FLIP_INTERACTION_ROTATE, text="Rotate")
233 rd.state_value_set(elementary.ELM_FLIP_INTERACTION_ROTATE)
234 rd.text_set("Rotate")
235 rd.callback_changed_add(my_cb_radios, fl) 195 rd.callback_changed_add(my_cb_radios, fl)
236 rd.group_add(rdg) 196 rd.group_add(rdg)
237 box.pack_end(rd) 197 box.pack_end(rd)
238 rd.show() 198 rd.show()
239 199
240 rd = Radio(win) 200 rd = Radio(win, state_value=ELM_FLIP_INTERACTION_CUBE, text="Cube")
241 rd.state_value_set(elementary.ELM_FLIP_INTERACTION_CUBE)
242 rd.text_set("Cube")
243 rd.callback_changed_add(my_cb_radios, fl) 201 rd.callback_changed_add(my_cb_radios, fl)
244 rd.group_add(rdg) 202 rd.group_add(rdg)
245 box.pack_end(rd) 203 box.pack_end(rd)
246 rd.show() 204 rd.show()
247 205
248 rd = Radio(win) 206 rd = Radio(win, state_value=ELM_FLIP_INTERACTION_PAGE, text="Page")
249 rd.state_value_set(elementary.ELM_FLIP_INTERACTION_PAGE)
250 rd.text_set("Page")
251 rd.callback_changed_add(my_cb_radios, fl) 207 rd.callback_changed_add(my_cb_radios, fl)
252 rd.group_add(rdg) 208 rd.group_add(rdg)
253 box.pack_end(rd) 209 box.pack_end(rd)
254 rd.show() 210 rd.show()
255 211
256 # window show 212 # window show
257 win.resize(320, 320)
258 win.show() 213 win.show()
259 214
260 215
261if __name__ == "__main__": 216if __name__ == "__main__":
262 def destroy(obj):
263 elementary.exit()
264
265 elementary.init() 217 elementary.init()
266 win = Window("test", elementary.ELM_WIN_BASIC) 218 win = StandardWindow("test", "python-elementary test application",
267 win.title_set("python-elementary test application") 219 size=(320,520))
268 win.callback_delete_request_add(destroy) 220 win.callback_delete_request_add(lambda o: elementary.exit())
269
270 bg = Background(win)
271 win.resize_object_add(bg)
272 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
273 bg.show()
274 221
275 box0 = Box(win) 222 box0 = Box(win, size_hint_weight=EXPAND_BOTH)
276 box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
277 win.resize_object_add(box0) 223 win.resize_object_add(box0)
278 box0.show() 224 box0.show()
279 225
280 fr = Frame(win)
281 fr.text_set("Information")
282 box0.pack_end(fr)
283 fr.show()
284
285 lb = Label(win) 226 lb = Label(win)
286 lb.text_set("Please select a test from the list below<br>" 227 lb.text_set("Please select a test from the list below<br>"
287 "by clicking the test button to show the<br>" 228 "by clicking the test button to show the<br>"
288 "test window.") 229 "test window.")
289 fr.content_set(lb)
290 lb.show() 230 lb.show()
291 231
232 fr = Frame(win, text="Information", content=lb)
233 box0.pack_end(fr)
234 fr.show()
235
292 items = [("Flip", flip_clicked), 236 items = [("Flip", flip_clicked),
293 ("Flip Interactive", flip_interactive_clicked), 237 ("Flip Interactive", flip_interactive_clicked),
294 ] 238 ]
295 239
296 li = List(win) 240 li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
297 li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
298 li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
299 box0.pack_end(li) 241 box0.pack_end(li)
300 li.show() 242 li.show()
301 243
@@ -304,7 +246,6 @@ if __name__ == "__main__":
304 246
305 li.go() 247 li.go()
306 248
307 win.resize(320,520)
308 win.show() 249 win.show()
309 elementary.run() 250 elementary.run()
310 elementary.shutdown() 251 elementary.shutdown()
diff --git a/examples/elementary/test_flipselector.py b/examples/elementary/test_flipselector.py
index f2fcaeb..132571b 100644
--- a/examples/elementary/test_flipselector.py
+++ b/examples/elementary/test_flipselector.py
@@ -1,15 +1,16 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
5from efl import elementary 5from efl import elementary
6from efl.elementary.window import StandardWindow 6from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background
8from efl.elementary.box import Box 7from efl.elementary.box import Box
9from efl.elementary.button import Button 8from efl.elementary.button import Button
10from efl.elementary.slider import Slider 9from efl.elementary.slider import Slider
11from efl.elementary.flipselector import FlipSelector 10from efl.elementary.flipselector import FlipSelector
12 11
12EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
13FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
13 14
14def sel_cb(fp, *args): 15def sel_cb(fp, *args):
15 if args: 16 if args:
@@ -51,16 +52,13 @@ def flipselector_clicked(obj):
51 "Edbus" 52 "Edbus"
52 ) 53 )
53 54
54 win = StandardWindow("flipselector", "Flip Selector") 55 win = StandardWindow("flipselector", "Flip Selector", autodel=True)
55 win.autodel = True
56 56
57 bx = Box(win) 57 bx = Box(win, size_hint_weight=EXPAND_BOTH)
58 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
59 win.resize_object_add(bx) 58 win.resize_object_add(bx)
60 bx.show() 59 bx.show()
61 60
62 fp = FlipSelector(win) 61 fp = FlipSelector(win, size_hint_weight=EXPAND_BOTH)
63 fp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
64 fp.callback_selected_add(sel_cb) 62 fp.callback_selected_add(sel_cb)
65 fp.callback_underflowed_add(overflow_cb) 63 fp.callback_underflowed_add(overflow_cb)
66 fp.callback_overflowed_add(underflow_cb) 64 fp.callback_overflowed_add(underflow_cb)
@@ -72,21 +70,17 @@ def flipselector_clicked(obj):
72 bx.pack_end(fp) 70 bx.pack_end(fp)
73 fp.show() 71 fp.show()
74 72
75 bx2 = Box(win) 73 bx2 = Box(win, size_hint_weight=EXPAND_BOTH, horizontal=True)
76 bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
77 bx2.horizontal = True
78 bx.pack_end(bx2) 74 bx.pack_end(bx2)
79 bx2.show() 75 bx2.show()
80 76
81 fp = FlipSelector(win) 77 fp = FlipSelector(win, size_hint_weight=EXPAND_BOTH)
82 fp.callback_underflowed_add(overflow_cb) 78 fp.callback_underflowed_add(overflow_cb)
83 fp.callback_overflowed_add(underflow_cb) 79 fp.callback_overflowed_add(underflow_cb)
84 fp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
85 for i in range(1990, 2100): 80 for i in range(1990, 2100):
86 fp.item_append(str(i), sel_cb) 81 fp.item_append(str(i), sel_cb)
87 82
88 bt = Button(win) 83 bt = Button(win, text="Flip Prev")
89 bt.text = "Flip Prev"
90 bt.callback_clicked_add(flip_prev_cb, fp) 84 bt.callback_clicked_add(flip_prev_cb, fp)
91 85
92 bx2.pack_end(bt) 86 bx2.pack_end(bt)
@@ -95,37 +89,29 @@ def flipselector_clicked(obj):
95 bx2.pack_end(fp) 89 bx2.pack_end(fp)
96 fp.show() 90 fp.show()
97 91
98 bt = Button(win) 92 bt = Button(win, text="Flip Next")
99 bt.text = "Flip Next"
100 bt.callback_clicked_add(flip_next_cb, fp) 93 bt.callback_clicked_add(flip_next_cb, fp)
101 bx2.pack_end(bt) 94 bx2.pack_end(bt)
102 bt.show() 95 bt.show()
103 96
104 sl = Slider(win) 97 sl = Slider(win, text="Flip Iterval:", unit_format="%1.2f",
105 sl.text = "Flip Iterval:" 98 min_max=(0.0, 3.0), value=0.85, size_hint_align=FILL_BOTH,
106 sl.unit_format = "%1.2f" 99 size_hint_weight=EXPAND_BOTH)
107 sl.min_max = (0.0, 3.0)
108 sl.value = (0.85)
109 sl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
110 sl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
111 bx.pack_end(sl) 100 bx.pack_end(sl)
112 sl.show() 101 sl.show()
113 sl.callback_changed_add(slider_change_cb, fp) 102 sl.callback_changed_add(slider_change_cb, fp)
114 103
115 bt = Button(win) 104 bt = Button(win, text="Select Last")
116 bt.text = "Select Last"
117 bt.callback_clicked_add(last_cb, fp) 105 bt.callback_clicked_add(last_cb, fp)
118 bx.pack_end(bt) 106 bx.pack_end(bt)
119 bt.show() 107 bt.show()
120 108
121 bt = Button(win) 109 bt = Button(win, text="Select 2097")
122 bt.text = "Select 2097"
123 bt.callback_clicked_add(third_from_end_cb, fp) 110 bt.callback_clicked_add(third_from_end_cb, fp)
124 bx.pack_end(bt) 111 bx.pack_end(bt)
125 bt.show() 112 bt.show()
126 113
127 bt = Button(win) 114 bt = Button(win, text="Unselect year")
128 bt.text = "Unselect year"
129 bt.callback_clicked_add(unsel_cb, fp) 115 bt.callback_clicked_add(unsel_cb, fp)
130 bx.pack_end(bt) 116 bx.pack_end(bt)
131 bt.show() 117 bt.show()
diff --git a/examples/elementary/test_floating.py b/examples/elementary/test_floating.py
index 363be8c..61182d5 100644
--- a/examples/elementary/test_floating.py
+++ b/examples/elementary/test_floating.py
@@ -9,6 +9,9 @@ from efl.ecore import Animator, loop_time_get
9from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_EXPAND, \ 9from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_EXPAND, \
10 EVAS_HINT_FILL 10 EVAS_HINT_FILL
11 11
12EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
13FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
14
12class ItemClass(GenlistItemClass): 15class ItemClass(GenlistItemClass):
13 def text_get(self, obj, part, *args, **kwargs): 16 def text_get(self, obj, part, *args, **kwargs):
14 return "Item #{0}".format(args[0]) 17 return "Item #{0}".format(args[0])
@@ -19,7 +22,7 @@ class ItemClass(GenlistItemClass):
19 ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1 22 ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
20 return ic 23 return ic
21 24
22def gl_sel_cb(obj, event_info, *args): 25def gl_sel_cb(obj, event_info, data):
23 print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data, obj, event_info)) 26 print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data, obj, event_info))
24 27
25def anim(*args, **kwargs): 28def anim(*args, **kwargs):
@@ -35,20 +38,15 @@ def del_cb(obj, *args, **kwargs):
35 ani.delete() 38 ani.delete()
36 39
37def floating_clicked(obj): 40def floating_clicked(obj):
38 win = StandardWindow("floating", "Floating") 41 win = StandardWindow("floating", "Floating", autodel=True, size=(480, 800))
39 win.autodel = True 42
40 43 gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
41 gl = Genlist(win) 44 pos=(800, 0), size=(480, 800))
42 gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
43 gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
44 gl.move(800, 0)
45 gl.size = 480, 800
46 gl.show() 45 gl.show()
47 46
48 for i in range(20): 47 for i in range(20):
49 GenlistItem(ItemClass(), i, None, ELM_GENLIST_ITEM_NONE, gl_sel_cb, i).append_to(gl) 48 GenlistItem(ItemClass(), i, None, ELM_GENLIST_ITEM_NONE, gl_sel_cb, i).append_to(gl)
50 49
51 win.size = 480, 800
52 win.show() 50 win.show()
53 51
54 ani = Animator(anim, gl) 52 ani = Animator(anim, gl)
diff --git a/examples/elementary/test_frame.py b/examples/elementary/test_frame.py
index 6c5cccf..9b1a779 100644
--- a/examples/elementary/test_frame.py
+++ b/examples/elementary/test_frame.py
@@ -1,60 +1,64 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4import os
5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
5from efl import elementary 7from efl import elementary
6from efl.elementary.window import Window 8from efl.elementary.window import StandardWindow
9from efl.elementary.scroller import Scroller
7from efl.elementary.background import Background 10from efl.elementary.background import Background
8from efl.elementary.box import Box 11from efl.elementary.box import Box
9from efl.elementary.frame import Frame 12from efl.elementary.frame import Frame
10from efl.elementary.icon import Icon 13from efl.elementary.icon import Icon
14from efl.elementary.label import Label
15
16EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
17FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
11 18
19script_path = os.path.dirname(os.path.abspath(__file__))
20img_path = os.path.join(script_path, "images")
12 21
13def frame_clicked(obj): 22def frame_clicked(obj):
14 win = Window("frame", elementary.ELM_WIN_BASIC) 23 win = StandardWindow("frame", "Frame test", autodel=True, size=(320, 320))
15 win.title_set("Frame test")
16 win.autodel_set(True)
17 if obj is None: 24 if obj is None:
18 win.callback_delete_request_add(lambda o: elementary.exit()) 25 win.callback_delete_request_add(lambda o: elementary.exit())
19 26
20 bg = Background(win) 27 vbox = Box(win, size_hint_weight=EXPAND_BOTH)
21 win.resize_object_add(bg)
22 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
23 bg.show()
24
25 vbox = Box(win)
26 vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
27 win.resize_object_add(vbox) 28 win.resize_object_add(vbox)
28 vbox.show() 29 vbox.show()
29 30
30 # frame 1 31 # frame 1 (label)
31 ic = Icon(win) 32 lbl = Label(win, text="content")
32 ic.file_set("images/logo_small.png") 33 fr = Frame(win, size_hint_align=FILL_BOTH,
33 34 text="Frame (label)", content=lbl)
34 fr = Frame(win)
35 fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
36 fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
37 fr.text_set("Frame title")
38 fr.content_set(ic)
39 vbox.pack_end(fr) 35 vbox.pack_end(fr)
40 fr.show() 36 fr.show()
41 37
42 # frame 2 (collapsable) 38 # frame 1 (icon)
43 ic = Icon(win) 39 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
44 ic.file_set("images/logo_small.png") 40 resizable=(False, False))
41 fr = Frame(win, size_hint_align=FILL_BOTH,
42 text="Frame (icon)", content=ic)
43 vbox.pack_end(fr)
44 fr.show()
45 45
46 fr = Frame(win) 46 # frame 2 (collapsable label)
47 fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 47 lbl = Label(win, text="content")
48 fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 48 fr = Frame(win, size_hint_align=FILL_BOTH,
49 fr.autocollapse_set(True) 49 autocollapse=True, text="Frame (collapsable label)", content=lbl)
50 fr.text_set("Frame collapsable (BROKEN)")
51 fr.content_set(ic)
52 vbox.pack_end(fr) 50 vbox.pack_end(fr)
53 fr.show() 51 fr.show()
54 52
55 win.resize(320, 320) 53 # frame 3(collapsable icon)
56 win.show() 54 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
55 resizable=(False, False))
56 fr = Frame(win, size_hint_align=FILL_BOTH,
57 autocollapse=True, text="Frame (collapsable icon)", content=ic)
58 vbox.pack_end(fr)
59 fr.show()
57 60
61 win.show()
58 62
59if __name__ == "__main__": 63if __name__ == "__main__":
60 elementary.init() 64 elementary.init()
diff --git a/examples/elementary/test_gengrid.py b/examples/elementary/test_gengrid.py
index ac272f2..a18d1d6 100644
--- a/examples/elementary/test_gengrid.py
+++ b/examples/elementary/test_gengrid.py
@@ -2,10 +2,11 @@
2# encoding: utf-8 2# encoding: utf-8
3 3
4import random 4import random
5import os
5 6
6from efl import evas 7from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EVAS_ASPECT_CONTROL_BOTH
7from efl import elementary 8from efl import elementary
8from efl.elementary.window import Window 9from efl.elementary.window import StandardWindow
9from efl.elementary.background import Background 10from efl.elementary.background import Background
10from efl.elementary.button import Button 11from efl.elementary.button import Button
11from efl.elementary.check import Check 12from efl.elementary.check import Check
@@ -15,9 +16,17 @@ from efl.elementary.slider import Slider
15from efl.elementary.table import Table 16from efl.elementary.table import Table
16from efl.elementary.scroller import Scrollable 17from efl.elementary.scroller import Scrollable
17 18
19EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
20EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
21FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
22FILL_HORIZ = EVAS_HINT_FILL, 0.5
23
24script_path = os.path.dirname(os.path.abspath(__file__))
25img_path = os.path.join(script_path, "images")
26
18class ScrollableGengrid(Scrollable, Gengrid): 27class ScrollableGengrid(Scrollable, Gengrid):
19 def __init__(self, canvas, *args, **kwargs): 28 def __init__(self, canvas, *args, **kwargs):
20 Gengrid.__init__(self, canvas) 29 Gengrid.__init__(self, canvas, *args, **kwargs)
21 30
22 31
23images = ["panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg", 32images = ["panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg",
@@ -29,9 +38,8 @@ def gg_text_get(obj, part, item_data):
29 38
30def gg_content_get(obj, part, data): 39def gg_content_get(obj, part, data):
31 if part == "elm.swallow.icon": 40 if part == "elm.swallow.icon":
32 im = Image(obj) 41 im = Image(obj, file=os.path.join(img_path, random.choice(images)),
33 im.file_set("images/" + random.choice(images)) 42 size_hint_aspect=(EVAS_ASPECT_CONTROL_BOTH, 1, 1))
34 im.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_BOTH, 1, 1)
35 return im 43 return im
36 return None 44 return None
37 45
@@ -59,24 +67,12 @@ def gengrid_clicked(obj):
59 global item_count 67 global item_count
60 item_count = 25 68 item_count = 25
61 69
62 # window 70 win = StandardWindow("gengrid", "Gengrid", autodel=True, size=(480, 800))
63 win = Window("gengrid", elementary.ELM_WIN_BASIC)
64 win.title_set("Gengrid")
65 win.autodel_set(True)
66 if obj is None: 71 if obj is None:
67 win.callback_delete_request_add(lambda o: elementary.exit()) 72 win.callback_delete_request_add(lambda o: elementary.exit())
68 73
69 # background 74 tb = Table(win, homogeneous=False, size_hint_weight=EXPAND_BOTH)
70 bg = Background(win)
71 win.resize_object_add(bg)
72 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
73 bg.show()
74
75 # main table
76 tb = Table(win)
77 win.resize_object_add(tb) 75 win.resize_object_add(tb)
78 tb.homogeneous_set(0)
79 tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
80 tb.show() 76 tb.show()
81 77
82 # gengrid 78 # gengrid
@@ -85,13 +81,9 @@ def gengrid_clicked(obj):
85 content_get_func=gg_content_get, 81 content_get_func=gg_content_get,
86 state_get_func=gg_state_get, 82 state_get_func=gg_state_get,
87 del_func=gg_del) 83 del_func=gg_del)
88 gg = ScrollableGengrid(win) 84 gg = ScrollableGengrid(win, size_hint_weight=EXPAND_BOTH,
89 gg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 85 size_hint_align=FILL_BOTH, horizontal=False, bounce=(False, True),
90 gg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 86 item_size=(80, 80), align=(0.5, 0.0))
91 gg.horizontal_set(False)
92 gg.bounce_set(False, True)
93 gg.item_size_set(80, 80)
94 gg.align_set(0.5, 0.0)
95 tb.pack(gg, 0, 0, 6, 1) 87 tb.pack(gg, 0, 0, 6, 1)
96 gg.callback_selected_add(gg_sel) 88 gg.callback_selected_add(gg_sel)
97 gg.callback_unselected_add(gg_unsel) 89 gg.callback_unselected_add(gg_unsel)
@@ -102,15 +94,12 @@ def gengrid_clicked(obj):
102 for i in range(item_count): 94 for i in range(item_count):
103 gg.item_append(itc, i, None) 95 gg.item_append(itc, i, None)
104 96
105
106 # multi select 97 # multi select
107 def multi_select_changed(bt, gg): 98 def multi_select_changed(bt, gg):
108 gg.multi_select_set(bt.state) 99 gg.multi_select_set(bt.state)
109 print((gg.multi_select_get())) 100 print((gg.multi_select))
110 101
111 bt = Check(win) 102 bt = Check(win, text="MultiSelect", state=gg.multi_select)
112 bt.text = "MultiSelect"
113 bt.state = gg.multi_select_get()
114 bt.callback_changed_add(multi_select_changed, gg) 103 bt.callback_changed_add(multi_select_changed, gg)
115 tb.pack(bt, 0, 1, 1, 1) 104 tb.pack(bt, 0, 1, 1, 1)
116 bt.show() 105 bt.show()
@@ -119,8 +108,7 @@ def gengrid_clicked(obj):
119 def horizontal_changed(bt, gg): 108 def horizontal_changed(bt, gg):
120 gg.horizontal_set(bt.state) 109 gg.horizontal_set(bt.state)
121 110
122 bt = Check(win) 111 bt = Check(win, text="Horizontal")
123 bt.text_set("Horizontal")
124 bt.callback_changed_add(horizontal_changed, gg) 112 bt.callback_changed_add(horizontal_changed, gg)
125 tb.pack(bt, 1, 1, 1, 1) 113 tb.pack(bt, 1, 1, 1, 1)
126 bt.show() 114 bt.show()
@@ -131,9 +119,8 @@ def gengrid_clicked(obj):
131 gg.bounce_set(bt.state, v_bounce) 119 gg.bounce_set(bt.state, v_bounce)
132 print((gg.bounce_get())) 120 print((gg.bounce_get()))
133 121
134 bt = Check(win) 122 bt = Check(win, text="BounceH")
135 bt.text_set("BounceH") 123 h_bounce = gg.bounce[0]
136 (h_bounce, v_bounce) = gg.bounce_get()
137 bt.state = h_bounce 124 bt.state = h_bounce
138 bt.callback_changed_add(bounce_h_changed, gg) 125 bt.callback_changed_add(bounce_h_changed, gg)
139 tb.pack(bt, 4, 1, 1, 1) 126 tb.pack(bt, 4, 1, 1, 1)
@@ -145,9 +132,8 @@ def gengrid_clicked(obj):
145 gg.bounce_set(h_bounce, bt.state) 132 gg.bounce_set(h_bounce, bt.state)
146 print((gg.bounce_get())) 133 print((gg.bounce_get()))
147 134
148 bt = Check(win) 135 bt = Check(win, text="BounceV")
149 bt.text_set("BounceV") 136 v_bounce = gg.bounce[1]
150 (h_bounce, v_bounce) = gg.bounce_get()
151 bt.state = v_bounce 137 bt.state = v_bounce
152 bt.callback_changed_add(bounce_v_changed, gg) 138 bt.callback_changed_add(bounce_v_changed, gg)
153 tb.pack(bt, 5, 1, 1, 1) 139 tb.pack(bt, 5, 1, 1, 1)
@@ -164,61 +150,40 @@ def gengrid_clicked(obj):
164 gg.item_size_set(w, sl.value) 150 gg.item_size_set(w, sl.value)
165 print((gg.item_size_get())) 151 print((gg.item_size_get()))
166 152
167 sl = Slider(win) 153 (w, h) = gg.item_size
168 sl.text_set("ItemSizeW") 154 sl = Slider(win, text="ItemSizeW", min_max=(0, 500),
169 sl.min_max_set(0, 500) 155 indicator_format="%.0f", unit_format="%.0f", span_size=100, value=w)
170 sl.indicator_format_set("%.0f")
171 sl.unit_format_set("%.0f")
172 sl.span_size_set(100)
173 (w, h) = gg.item_size_get()
174 sl.value = w
175 sl.callback_changed_add(item_size_w_changed, gg) 156 sl.callback_changed_add(item_size_w_changed, gg)
176 tb.pack(sl, 0, 2, 2, 1) 157 tb.pack(sl, 0, 2, 2, 1)
177 sl.show() 158 sl.show()
178 159
179 sl = Slider(win) 160 sl = Slider(win, text="ItemSizeH", min_max=(0, 500),
180 sl.text_set("ItemSizeH") 161 indicator_format="%.0f", unit_format="%.0f", span_size=100, value=h)
181 sl.min_max_set(0, 500)
182 sl.indicator_format_set("%.0f")
183 sl.unit_format_set("%.0f")
184 sl.span_size_set(100)
185 (w, h) = gg.item_size_get()
186 sl.value = h
187 sl.callback_changed_add(item_size_h_changed, gg) 162 sl.callback_changed_add(item_size_h_changed, gg)
188 tb.pack(sl, 0, 3, 2, 1) 163 tb.pack(sl, 0, 3, 2, 1)
189 sl.show() 164 sl.show()
190 165
191 # align 166 # align
192 def alignx_changed(sl, gg): 167 def alignx_changed(sl, gg):
193 (ax, ay) = gg.align_get() 168 (ax, ay) = gg.align
194 gg.align_set(sl.value, ay) 169 gg.align = sl.value, ay
195 print((gg.align_get())) 170 print(gg.align)
196 171
197 def aligny_changed(sl, gg): 172 def aligny_changed(sl, gg):
198 (ax, ay) = gg.align_get() 173 (ax, ay) = gg.align
199 gg.align_set(ax, sl.value) 174 gg.align = ax, sl.value
200 print((gg.align_get())) 175 print(gg.align)
201 176
202 sl = Slider(win) 177 (ax, ay) = gg.align
203 sl.text_set("AlignX") 178
204 sl.min_max_set(0.0, 1.0) 179 sl = Slider(win, text="AlignX", min_max=(0.0, 1.0),
205 sl.indicator_format_set("%.2f") 180 indicator_format="%.2f", unit_format="%.2f", span_size=100, value=ax)
206 sl.unit_format_set("%.2f")
207 sl.span_size_set(100)
208 (ax, ay) = gg.align_get()
209 sl.value = ax
210 sl.callback_changed_add(alignx_changed, gg) 181 sl.callback_changed_add(alignx_changed, gg)
211 tb.pack(sl, 0, 4, 2, 1) 182 tb.pack(sl, 0, 4, 2, 1)
212 sl.show() 183 sl.show()
213 184
214 sl = Slider(win) 185 sl = Slider(win, text="AlignY", min_max=(0.0, 1.0),
215 sl.text_set("AlignY") 186 indicator_format="%.2f", unit_format="%.2f", span_size=100, value=ay)
216 sl.min_max_set(0.0, 1.0)
217 sl.indicator_format_set("%.2f")
218 sl.unit_format_set("%.2f")
219 sl.span_size_set(100)
220 (ax, ay) = gg.align_get()
221 sl.value = ax
222 sl.callback_changed_add(aligny_changed, gg) 187 sl.callback_changed_add(aligny_changed, gg)
223 tb.pack(sl, 0, 5, 2, 1) 188 tb.pack(sl, 0, 5, 2, 1)
224 sl.show() 189 sl.show()
@@ -226,11 +191,10 @@ def gengrid_clicked(obj):
226 # select first 191 # select first
227 def select_first_clicked(bt, gg): 192 def select_first_clicked(bt, gg):
228 ggi = gg.first_item 193 ggi = gg.first_item
229 ggi.selected = not ggi.selected 194 if ggi:
195 ggi.selected = not ggi.selected
230 196
231 bt = Button(win) 197 bt = Button(win, size_hint_align=FILL_HORIZ, text="Select first")
232 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
233 bt.text_set("Select first")
234 bt.callback_clicked_add(select_first_clicked, gg) 198 bt.callback_clicked_add(select_first_clicked, gg)
235 tb.pack(bt, 2, 2, 1, 1) 199 tb.pack(bt, 2, 2, 1, 1)
236 bt.show() 200 bt.show()
@@ -238,11 +202,10 @@ def gengrid_clicked(obj):
238 # select last 202 # select last
239 def select_last_clicked(bt, gg): 203 def select_last_clicked(bt, gg):
240 ggi = gg.last_item 204 ggi = gg.last_item
241 ggi.selected = not ggi.selected 205 if ggi:
206 ggi.selected = not ggi.selected
242 207
243 bt = Button(win) 208 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Select last")
244 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
245 bt.text_set("Select last")
246 bt.callback_clicked_add(select_last_clicked, gg) 209 bt.callback_clicked_add(select_last_clicked, gg)
247 tb.pack(bt, 3, 2, 1, 1) 210 tb.pack(bt, 3, 2, 1, 1)
248 bt.show() 211 bt.show()
@@ -252,9 +215,7 @@ def gengrid_clicked(obj):
252 for ggi in gg.selected_items_get(): 215 for ggi in gg.selected_items_get():
253 ggi.delete() 216 ggi.delete()
254 217
255 bt = Button(win) 218 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Sel del")
256 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
257 bt.text_set("Sel del")
258 bt.callback_clicked_add(seldel_clicked, gg) 219 bt.callback_clicked_add(seldel_clicked, gg)
259 tb.pack(bt, 4, 2, 1, 1) 220 tb.pack(bt, 4, 2, 1, 1)
260 bt.show() 221 bt.show()
@@ -265,9 +226,7 @@ def gengrid_clicked(obj):
265 item_count = 0 226 item_count = 0
266 gg.clear() 227 gg.clear()
267 228
268 bt = Button(win) 229 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Clear")
269 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
270 bt.text_set("Clear")
271 bt.callback_clicked_add(clear_clicked, gg) 230 bt.callback_clicked_add(clear_clicked, gg)
272 tb.pack(bt, 5, 2, 1, 1) 231 tb.pack(bt, 5, 2, 1, 1)
273 bt.show() 232 bt.show()
@@ -275,18 +234,15 @@ def gengrid_clicked(obj):
275 # show first/last 234 # show first/last
276 def show_clicked(bt, gg, first): 235 def show_clicked(bt, gg, first):
277 ggi = gg.first_item if first else gg.last_item 236 ggi = gg.first_item if first else gg.last_item
278 ggi.show() 237 if ggi:
238 ggi.show()
279 239
280 bt = Button(win) 240 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show first")
281 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
282 bt.text_set("Show first")
283 bt.callback_clicked_add(show_clicked, gg, True) 241 bt.callback_clicked_add(show_clicked, gg, True)
284 tb.pack(bt, 2, 3, 1, 1) 242 tb.pack(bt, 2, 3, 1, 1)
285 bt.show() 243 bt.show()
286 244
287 bt = Button(win) 245 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show last")
288 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
289 bt.text_set("Show last")
290 bt.callback_clicked_add(show_clicked, gg, False) 246 bt.callback_clicked_add(show_clicked, gg, False)
291 tb.pack(bt, 3, 3, 1, 1) 247 tb.pack(bt, 3, 3, 1, 1)
292 bt.show() 248 bt.show()
@@ -294,18 +250,15 @@ def gengrid_clicked(obj):
294 # bring-in first/last 250 # bring-in first/last
295 def bring_in_clicked(bt, gg, first): 251 def bring_in_clicked(bt, gg, first):
296 ggi = gg.first_item if first else gg.last_item 252 ggi = gg.first_item if first else gg.last_item
297 ggi.bring_in() 253 if ggi:
254 ggi.bring_in()
298 255
299 bt = Button(win) 256 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn first")
300 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
301 bt.text_set("BringIn first")
302 bt.callback_clicked_add(bring_in_clicked, gg, True) 257 bt.callback_clicked_add(bring_in_clicked, gg, True)
303 tb.pack(bt, 4, 3, 1, 1) 258 tb.pack(bt, 4, 3, 1, 1)
304 bt.show() 259 bt.show()
305 260
306 bt = Button(win) 261 bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn last")
307 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
308 bt.text_set("BringIn last")
309 bt.callback_clicked_add(bring_in_clicked, gg, False) 262 bt.callback_clicked_add(bring_in_clicked, gg, False)
310 tb.pack(bt, 5, 3, 1, 1) 263 tb.pack(bt, 5, 3, 1, 1)
311 bt.show() 264 bt.show()
@@ -318,30 +271,22 @@ def gengrid_clicked(obj):
318 gg.item_append(itc, item_count, None) 271 gg.item_append(itc, item_count, None)
319 n -= 1 272 n -= 1
320 273
321 bt = Button(win) 274 bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1")
322 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
323 bt.text_set("Append 1")
324 bt.callback_clicked_add(append_clicked, gg, 1) 275 bt.callback_clicked_add(append_clicked, gg, 1)
325 tb.pack(bt, 2, 4, 1, 1) 276 tb.pack(bt, 2, 4, 1, 1)
326 bt.show() 277 bt.show()
327 278
328 bt = Button(win) 279 bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 100")
329 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
330 bt.text_set("Append 100")
331 bt.callback_clicked_add(append_clicked, gg, 100) 280 bt.callback_clicked_add(append_clicked, gg, 100)
332 tb.pack(bt, 3, 4, 1, 1) 281 tb.pack(bt, 3, 4, 1, 1)
333 bt.show() 282 bt.show()
334 283
335 bt = Button(win) 284 bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1000")
336 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
337 bt.text_set("Append 1000")
338 bt.callback_clicked_add(append_clicked, gg, 1000) 285 bt.callback_clicked_add(append_clicked, gg, 1000)
339 tb.pack(bt, 4, 4, 1, 1) 286 tb.pack(bt, 4, 4, 1, 1)
340 bt.show() 287 bt.show()
341 288
342 bt = Button(win) 289 bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 10000 :)")
343 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
344 bt.text_set("Append 10000 :)")
345 bt.callback_clicked_add(append_clicked, gg, 10000) 290 bt.callback_clicked_add(append_clicked, gg, 10000)
346 tb.pack(bt, 5, 4, 1, 1) 291 tb.pack(bt, 5, 4, 1, 1)
347 bt.show() 292 bt.show()
@@ -352,9 +297,7 @@ def gengrid_clicked(obj):
352 item_count += 1 297 item_count += 1
353 gg.item_prepend(itc, item_count) 298 gg.item_prepend(itc, item_count)
354 299
355 bt = Button(win) 300 bt = Button(win, size_hint_align=FILL_HORIZ, text="Prepend")
356 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
357 bt.text_set("Prepend")
358 bt.callback_clicked_add(prepend_clicked, gg) 301 bt.callback_clicked_add(prepend_clicked, gg)
359 tb.pack(bt, 2, 5, 1, 1) 302 tb.pack(bt, 2, 5, 1, 1)
360 bt.show() 303 bt.show()
@@ -369,9 +312,7 @@ def gengrid_clicked(obj):
369 else: 312 else:
370 print("nothing selected") 313 print("nothing selected")
371 314
372 bt = Button(win) 315 bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins before")
373 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
374 bt.text_set("Ins before")
375 bt.callback_clicked_add(ins_before_clicked, gg) 316 bt.callback_clicked_add(ins_before_clicked, gg)
376 tb.pack(bt, 3, 5, 1, 1) 317 tb.pack(bt, 3, 5, 1, 1)
377 bt.show() 318 bt.show()
@@ -386,15 +327,13 @@ def gengrid_clicked(obj):
386 else: 327 else:
387 print("nothing selected") 328 print("nothing selected")
388 329
389 bt = Button(win) 330 bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins after")
390 bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
391 bt.text_set("Ins after")
392 bt.callback_clicked_add(ins_after_clicked, gg) 331 bt.callback_clicked_add(ins_after_clicked, gg)
393 tb.pack(bt, 4, 5, 1, 1) 332 tb.pack(bt, 4, 5, 1, 1)
394 bt.show() 333 bt.show()
395 334
396 print(gg) 335 print(gg)
397 win.resize(480, 800) 336
398 win.show() 337 win.show()
399 338
400 339
diff --git a/examples/elementary/test_genlist.py b/examples/elementary/test_genlist.py
index 3b11824..8fa17fb 100644
--- a/examples/elementary/test_genlist.py
+++ b/examples/elementary/test_genlist.py
@@ -3,12 +3,15 @@
3 3
4import time 4import time
5import sys 5import sys
6import os
6if sys.version_info < (3,): range = xrange 7if sys.version_info < (3,): range = xrange
7 8
8from efl import evas 9from efl import evas
9from efl import ecore 10from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
11 EVAS_ASPECT_CONTROL_VERTICAL, Rectangle
12from efl.ecore import Timer
10from efl import elementary 13from efl import elementary
11from efl.elementary.window import Window, StandardWindow 14from efl.elementary.window import StandardWindow, Window, ELM_WIN_BASIC
12from efl.elementary.background import Background 15from efl.elementary.background import Background
13from efl.elementary.box import Box 16from efl.elementary.box import Box
14from efl.elementary.frame import Frame 17from efl.elementary.frame import Frame
@@ -23,16 +26,20 @@ from efl.elementary.general import cache_all_flush
23from efl.elementary.radio import Radio 26from efl.elementary.radio import Radio
24from efl.elementary.check import Check 27from efl.elementary.check import Check
25 28
26from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EVAS_ASPECT_CONTROL_VERTICAL 29EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
30EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
31FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
32FILL_HORIZ = EVAS_HINT_FILL, 0.5
27 33
34script_path = os.path.dirname(os.path.abspath(__file__))
35img_path = os.path.join(script_path, "images")
28 36
29def gl_text_get(obj, part, item_data): 37def gl_text_get(obj, part, item_data):
30 return "Item # %i" % (item_data,) 38 return "Item # %i" % (item_data,)
31 39
32def gl_content_get(obj, part, data): 40def gl_content_get(obj, part, data):
33 ic = Icon(obj) 41 ic = Icon(obj, file=os.path.join(img_path, "logo_small.png"),
34 ic.file_set("images/logo_small.png") 42 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
35 ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
36 return ic 43 return ic
37 44
38def gl_state_get(obj, part, item_data): 45def gl_state_get(obj, part, item_data):
@@ -41,7 +48,8 @@ def gl_state_get(obj, part, item_data):
41def gl_comp_func(item1, item2): 48def gl_comp_func(item1, item2):
42 #print(item1.data) 49 #print(item1.data)
43 #print(item2.data) 50 #print(item2.data)
44 # If data1 is 'less' than data2, -1 must be returned, if it is 'greater', 1 must be returned, and if they are equal, 0 must be returned. 51 # If data1 is 'less' than data2, -1 must be returned, if it is 'greater',
52 # 1 must be returned, and if they are equal, 0 must be returned.
45 if item1.data < item2.data: 53 if item1.data < item2.data:
46 return -1 54 return -1
47 elif item1.data == item2.data: 55 elif item1.data == item2.data:
@@ -64,9 +72,8 @@ def glg_text_get(obj, part, item_data):
64 return "Group # %i" % (item_data,) 72 return "Group # %i" % (item_data,)
65 73
66def glg_content_get(obj, part, data): 74def glg_content_get(obj, part, data):
67 ic = Icon(obj) 75 ic = Icon(obj, file=os.path.join(img_path, "logo.png"),
68 ic.file_set("images/logo.png") 76 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
69 ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
70 return ic 77 return ic
71 78
72def _gl_selected(gl, gli, *args, **kwargs): 79def _gl_selected(gl, gli, *args, **kwargs):
@@ -100,30 +107,23 @@ def _gl_over_click(evas, evt, gl):
100 107
101 108
102def genlist_clicked(obj, item=None): 109def genlist_clicked(obj, item=None):
103 win = Window("Genlist", elementary.ELM_WIN_BASIC) 110 win = StandardWindow("Genlist", "Genlist test", autodel=True)
104 win.title_set("Genlist test")
105 win.autodel_set(True)
106 111
107 bg = Background(win) 112 bx = Box(win, size_hint_weight=EXPAND_BOTH)
108 win.resize_object_add(bg)
109 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
110 bg.show()
111
112 bx = Box(win)
113 win.resize_object_add(bx) 113 win.resize_object_add(bx)
114 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
115 bx.show() 114 bx.show()
116 115
117 gl = Genlist(win) 116 gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
118 gl.callback_selected_add(_gl_selected, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") 117 gl.callback_selected_add(_gl_selected, "arg1", "arg2",
119 gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") 118 kwarg1="kwarg1", kwarg2="kwarg2")
120 gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") 119 gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2",
121 gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 120 kwarg1="kwarg1", kwarg2="kwarg2")
122 gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 121 gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2",
122 kwarg1="kwarg1", kwarg2="kwarg2")
123 bx.pack_end(gl) 123 bx.pack_end(gl)
124 gl.show() 124 gl.show()
125 125
126 over = evas.Rectangle(win.evas_get()) 126 over = Rectangle(win.evas_get())
127 over.color_set(0, 0, 0, 0) 127 over.color_set(0, 0, 0, 0)
128 over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl) 128 over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl)
129 over.repeat_events_set(True) 129 over.repeat_events_set(True)
@@ -131,8 +131,7 @@ def genlist_clicked(obj, item=None):
131 over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 131 over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
132 win.resize_object_add(over) 132 win.resize_object_add(over)
133 133
134 vbx = Box(win) 134 vbx = Box(win, horizontal=True)
135 vbx.horizontal_set(True)
136 bx.pack_end(vbx) 135 bx.pack_end(vbx)
137 vbx.show() 136 vbx.show()
138 137
@@ -141,13 +140,11 @@ def genlist_clicked(obj, item=None):
141 content_get_func=gl_content_get, 140 content_get_func=gl_content_get,
142 state_get_func=gl_state_get) 141 state_get_func=gl_state_get)
143 142
144 bt_50 = Button(win) 143 bt_50 = Button(win, text="Go to 50")
145 bt_50.text_set("Go to 50")
146 vbx.pack_end(bt_50) 144 vbx.pack_end(bt_50)
147 bt_50.show() 145 bt_50.show()
148 146
149 bt_1500 = Button(win) 147 bt_1500 = Button(win, text="Go to 1500")
150 bt_1500.text_set("Go to 1500")
151 vbx.pack_end(bt_1500) 148 vbx.pack_end(bt_1500)
152 bt_1500.show() 149 bt_1500.show()
153 150
@@ -163,24 +160,19 @@ def genlist_clicked(obj, item=None):
163 160
164 161
165def genlist2_clicked(obj, item=None): 162def genlist2_clicked(obj, item=None):
166 win = Window("Genlist", elementary.ELM_WIN_BASIC) 163 win = Window("Genlist", ELM_WIN_BASIC, title="Genlist test 2",
167 win.title_set("Genlist test 2") 164 autodel=True, size=(320, 320))
168 win.autodel_set(True)
169 165
170 bg = Background(win) 166 bg = Background(win, file=os.path.join(img_path, "plant_01.jpg"),
167 size_hint_weight=EXPAND_BOTH)
171 win.resize_object_add(bg) 168 win.resize_object_add(bg)
172 bg.file_set("images/plant_01.jpg")
173 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
174 bg.show() 169 bg.show()
175 170
176 bx = Box(win) 171 bx = Box(win, size_hint_weight=EXPAND_BOTH)
177 win.resize_object_add(bx) 172 win.resize_object_add(bx)
178 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
179 bx.show() 173 bx.show()
180 174
181 gl = Genlist(win) 175 gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
182 gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
183 gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
184 gl.show() 176 gl.show()
185 177
186 itc1 = GenlistItemClass(item_style="default", 178 itc1 = GenlistItemClass(item_style="default",
@@ -198,24 +190,18 @@ def genlist2_clicked(obj, item=None):
198 190
199 bx.pack_end(gl) 191 bx.pack_end(gl)
200 192
201 bx2 = Box(win) 193 bx2 = Box(win, horizontal=True, homogeneous=True,
202 bx2.horizontal_set(True) 194 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
203 bx2.homogeneous_set(True)
204 bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
205 bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
206
207 195
208 def my_gl_first(bt, gl): 196 def my_gl_first(bt, gl):
209 gli = gl.first_item_get() 197 gli = gl.first_item
210 if gli: 198 if gli:
211 gli.show() 199 gli.show()
212 gli.selected = True 200 gli.selected = True
213 201
214 bt = Button(win) 202 bt = Button(win, text="/\\", size_hint_align=FILL_BOTH,
215 bt.text_set("/\\") 203 size_hint_weight=EXPAND_HORIZ)
216 bt.callback_clicked_add(my_gl_first, gl) 204 bt.callback_clicked_add(my_gl_first, gl)
217 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
218 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
219 bx2.pack_end(bt) 205 bx2.pack_end(bt)
220 bt.show() 206 bt.show()
221 207
@@ -226,17 +212,15 @@ def genlist2_clicked(obj, item=None):
226 gli.show() 212 gli.show()
227 gli.selected = True 213 gli.selected = True
228 214
229 bt = Button(win) 215 bt = Button(win, text="\\/", size_hint_align=FILL_BOTH,
230 bt.text_set("\\/") 216 size_hint_weight=EXPAND_HORIZ)
231 bt.callback_clicked_add(my_gl_last, gl) 217 bt.callback_clicked_add(my_gl_last, gl)
232 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
233 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
234 bx2.pack_end(bt) 218 bx2.pack_end(bt)
235 bt.show() 219 bt.show()
236 220
237 221
238 def my_gl_disable(bt, gl): 222 def my_gl_disable(bt, gl):
239 gli = gl.selected_item_get() 223 gli = gl.selected_item
240 if gli: 224 if gli:
241 gli.disabled = True 225 gli.disabled = True
242 gli.selected = False 226 gli.selected = False
@@ -244,11 +228,9 @@ def genlist2_clicked(obj, item=None):
244 else: 228 else:
245 print("no item selected") 229 print("no item selected")
246 230
247 bt = Button(win) 231 bt = Button(win, text="#", size_hint_align=FILL_BOTH,
248 bt.text_set("#") 232 size_hint_weight=EXPAND_HORIZ)
249 bt.callback_clicked_add(my_gl_disable, gl) 233 bt.callback_clicked_add(my_gl_disable, gl)
250 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
251 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
252 bx2.pack_end(bt) 234 bx2.pack_end(bt)
253 bt.show() 235 bt.show()
254 236
@@ -262,11 +244,9 @@ def genlist2_clicked(obj, item=None):
262 i = i + 1 244 i = i + 1
263 gli = gli.next_get() 245 gli = gli.next_get()
264 246
265 bt = Button(win) 247 bt = Button(win, text="U", size_hint_align=FILL_BOTH,
266 bt.text_set("U") 248 size_hint_weight=EXPAND_HORIZ)
267 bt.callback_clicked_add(my_gl_update_all, gl) 249 bt.callback_clicked_add(my_gl_update_all, gl)
268 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
269 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
270 bx2.pack_end(bt) 250 bx2.pack_end(bt)
271 bt.show() 251 bt.show()
272 252
@@ -274,21 +254,16 @@ def genlist2_clicked(obj, item=None):
274 bx2.show() 254 bx2.show()
275 255
276 256
277 bx2 = Box(win) 257 bx2 = Box(win, horizontal=True, homogeneous=True,
278 bx2.horizontal_set(True) 258 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
279 bx2.homogeneous_set(True)
280 bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
281 bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
282 259
283 260
284 def my_gl_clear(bt, gl): 261 def my_gl_clear(bt, gl):
285 gl.clear() 262 gl.clear()
286 263
287 bt = Button(win) 264 bt = Button(win, text="X", size_hint_align=FILL_BOTH,
288 bt.text_set("X") 265 size_hint_weight=EXPAND_HORIZ)
289 bt.callback_clicked_add(my_gl_clear, gl) 266 bt.callback_clicked_add(my_gl_clear, gl)
290 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
291 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
292 bx2.pack_end(bt) 267 bx2.pack_end(bt)
293 bt.show() 268 bt.show()
294 269
@@ -299,11 +274,9 @@ def genlist2_clicked(obj, item=None):
299 gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel) 274 gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel)
300 MyGlAdd.i = MyGlAdd.i + 1 275 MyGlAdd.i = MyGlAdd.i + 1
301 276
302 bt = Button(win) 277 bt = Button(win, text="+", size_hint_align=FILL_BOTH,
303 bt.text_set("+") 278 size_hint_weight=EXPAND_HORIZ)
304 bt.callback_clicked_add(my_gl_add, gl, itc1) 279 bt.callback_clicked_add(my_gl_add, gl, itc1)
305 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
306 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
307 bx2.pack_end(bt) 280 bx2.pack_end(bt)
308 bt.show() 281 bt.show()
309 282
@@ -315,22 +288,17 @@ def genlist2_clicked(obj, item=None):
315 else: 288 else:
316 print("no item selected") 289 print("no item selected")
317 290
318 bt = Button(win) 291 bt = Button(win, text="-", size_hint_align=FILL_BOTH,
319 bt.text_set("-") 292 size_hint_weight=EXPAND_HORIZ)
320 bt.callback_clicked_add(my_gl_del, gl) 293 bt.callback_clicked_add(my_gl_del, gl)
321 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
322 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
323 bx2.pack_end(bt) 294 bx2.pack_end(bt)
324 bt.show() 295 bt.show()
325 296
326 bx.pack_end(bx2) 297 bx.pack_end(bx2)
327 bx2.show() 298 bx2.show()
328 299
329 bx2 = Box(win) 300 bx2 = Box(win, horizontal=True, homogeneous=True,
330 bx2.horizontal_set(True) 301 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
331 bx2.homogeneous_set(True)
332 bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
333 bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
334 302
335 303
336 class MyGlInsertBefore: 304 class MyGlInsertBefore:
@@ -338,16 +306,15 @@ def genlist2_clicked(obj, item=None):
338 def my_gl_insert_before(bt, gl, itc1): 306 def my_gl_insert_before(bt, gl, itc1):
339 gli = gl.selected_item_get() 307 gli = gl.selected_item_get()
340 if gli: 308 if gli:
341 gl.item_insert_before(itc1, MyGlInsertBefore.i, gli, func=gl_item_sel) 309 gl.item_insert_before(itc1, MyGlInsertBefore.i, gli,
310 func=gl_item_sel)
342 MyGlInsertBefore.i = MyGlInsertBefore.i + 1 311 MyGlInsertBefore.i = MyGlInsertBefore.i + 1
343 else: 312 else:
344 print("no item selected") 313 print("no item selected")
345 314
346 bt = Button(win) 315 bt = Button(win, text="+ before", size_hint_align=FILL_BOTH,
347 bt.text_set("+ before") 316 size_hint_weight=EXPAND_HORIZ)
348 bt.callback_clicked_add(my_gl_insert_before, gl, itc1) 317 bt.callback_clicked_add(my_gl_insert_before, gl, itc1)
349 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
350 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
351 bx2.pack_end(bt) 318 bx2.pack_end(bt)
352 bt.show() 319 bt.show()
353 320
@@ -362,11 +329,9 @@ def genlist2_clicked(obj, item=None):
362 else: 329 else:
363 print("no item selected") 330 print("no item selected")
364 331
365 bt = Button(win) 332 bt = Button(win, text="+ after", size_hint_align=FILL_BOTH,
366 bt.text_set("+ after") 333 size_hint_weight=EXPAND_HORIZ)
367 bt.callback_clicked_add(my_gl_insert_after, gl, itc1) 334 bt.callback_clicked_add(my_gl_insert_after, gl, itc1)
368 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
369 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
370 bx2.pack_end(bt) 335 bx2.pack_end(bt)
371 bt.show() 336 bt.show()
372 337
@@ -374,36 +339,25 @@ def genlist2_clicked(obj, item=None):
374 def my_gl_flush(bt, gl): 339 def my_gl_flush(bt, gl):
375 def my_gl_flush_delay(): 340 def my_gl_flush_delay():
376 cache_all_flush() 341 cache_all_flush()
377 ecore.timer_add(1.2, my_gl_flush_delay) 342 Timer(1.2, my_gl_flush_delay)
378 bt = Button(win) 343 bt = Button(win, text="Flush", size_hint_align=FILL_BOTH,
379 bt.text_set("Flush") 344 size_hint_weight=EXPAND_HORIZ)
380 bt.callback_clicked_add(my_gl_flush, gl) 345 bt.callback_clicked_add(my_gl_flush, gl)
381 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
382 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
383 bx2.pack_end(bt) 346 bx2.pack_end(bt)
384 bt.show() 347 bt.show()
385 348
386 bx.pack_end(bx2) 349 bx.pack_end(bx2)
387 bx2.show() 350 bx2.show()
388 351
389 win.resize(320, 320)
390 win.show() 352 win.show()
391 353
392 354
393def genlist3_clicked(obj, item=None): 355def genlist3_clicked(obj, item=None):
394 win = Window("Genlist", elementary.ELM_WIN_BASIC) 356 win = StandardWindow("Genlist", "Genlist Group test", autodel=True,
395 win.title_set("Genlist Group test") 357 size=(320, 320))
396 win.autodel_set(True)
397 358
398 bg = Background(win) 359 gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
399 win.resize_object_add(bg)
400 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
401 bg.show()
402
403 gl = Genlist(win)
404 win.resize_object_add(gl) 360 win.resize_object_add(gl)
405 gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
406 gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
407 gl.show() 361 gl.show()
408 362
409 itc_i = GenlistItemClass(item_style="default", 363 itc_i = GenlistItemClass(item_style="default",
@@ -422,23 +376,14 @@ def genlist3_clicked(obj, item=None):
422 git.select_mode_set(elementary.ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) 376 git.select_mode_set(elementary.ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
423 gl.item_append(itc_i, i, git) 377 gl.item_append(itc_i, i, git)
424 378
425 win.resize(320, 320)
426 win.show() 379 win.show()
427 380
428def genlist4_clicked(obj, item=None): 381def genlist4_clicked(obj, item=None):
429 win = Window("Genlist", elementary.ELM_WIN_BASIC) 382 win = StandardWindow("Genlist", "Genlist sorted insert test", autodel=True,
430 win.title_set("Genlist sorted insert test") 383 size=(320, 320))
431 win.autodel_set(True)
432
433 bg = Background(win)
434 win.resize_object_add(bg)
435 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
436 bg.show()
437 384
438 gl = Genlist(win) 385 gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
439 win.resize_object_add(gl) 386 win.resize_object_add(gl)
440 gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
441 gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
442 gl.show() 387 gl.show()
443 388
444 itc_i = GenlistItemClass(item_style="default", 389 itc_i = GenlistItemClass(item_style="default",
@@ -449,24 +394,15 @@ def genlist4_clicked(obj, item=None):
449 for i in range(100,-1,-1): 394 for i in range(100,-1,-1):
450 GenlistItem(itc_i, i).sorted_insert(gl, gl_comp_func) 395 GenlistItem(itc_i, i).sorted_insert(gl, gl_comp_func)
451 396
452 win.resize(320, 320)
453 win.show() 397 win.show()
454 398
455def genlist5_clicked(obj, item=None): 399def genlist5_clicked(obj, item=None):
456 win = Window("Genlist", elementary.ELM_WIN_BASIC) 400 win = StandardWindow("Genlist", "Genlist iteration test", autodel=True,
457 win.title_set("Genlist iteration test") 401 size=(320, 320))
458 win.autodel_set(True)
459 402
460 bg = Background(win) 403 gl = Genlist(win, homogeneous=True, size_hint_align=FILL_BOTH,
461 win.resize_object_add(bg) 404 size_hint_weight=EXPAND_BOTH)
462 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
463 bg.show()
464
465 gl = Genlist(win)
466 gl.homogeneous = True
467 win.resize_object_add(gl) 405 win.resize_object_add(gl)
468 gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
469 gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
470 gl.show() 406 gl.show()
471 407
472 itc_i = GenlistItemClass(item_style="default", 408 itc_i = GenlistItemClass(item_style="default",
@@ -483,8 +419,8 @@ def genlist5_clicked(obj, item=None):
483 419
484 assert(len(gl) == gl.items_count) 420 assert(len(gl) == gl.items_count)
485 421
486 it = gl.first_item
487 t3 = time.time() 422 t3 = time.time()
423 it = gl.first_item
488 while it: 424 while it:
489 d = it.data 425 d = it.data
490 it = it.next 426 it = it.next
@@ -502,12 +438,13 @@ def genlist5_clicked(obj, item=None):
502 438
503 print("Time to add {0} items:".format(item_count)) 439 print("Time to add {0} items:".format(item_count))
504 print(t2-t1) 440 print(t2-t1)
505 print("Time to iterate item data over {0} items using it.next:".format(item_count)) 441 print("Time to iterate item data over {0} items using "
442 "it.next:".format(item_count))
506 print(t4-t3) 443 print(t4-t3)
507 print("Time to iterate item data over {0} items using a python iterator:".format(item_count)) 444 print("Time to iterate item data over {0} items using "
445 "a python iterator:".format(item_count))
508 print(t6-t5) 446 print(t6-t5)
509 447
510 win.resize(320, 320)
511 win.show() 448 win.show()
512 449
513mode_type = ["slide", "rotate"] 450mode_type = ["slide", "rotate"]
@@ -523,9 +460,9 @@ class ItemClass10(GenlistItemClass):
523 def content_get(self, obj, part, data): 460 def content_get(self, obj, part, data):
524 ic = Icon(obj) 461 ic = Icon(obj)
525 if part == "elm.swallow.end": 462 if part == "elm.swallow.end":
526 f = "images/bubble.png" 463 f = os.path.join(img_path, "bubble.png")
527 else: 464 else:
528 f = "images/logo_small.png" 465 f = os.path.join(img_path, "logo_small.png")
529 ic.file = f 466 ic.file = f
530 ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1 467 ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
531 return ic 468 return ic
@@ -554,42 +491,33 @@ def my_gl_mode_cancel(obj, it, rd):
554 glit.decorate_mode_set(mode_type[v], False) 491 glit.decorate_mode_set(mode_type[v], False)
555 492
556def genlist10_clicked(obj, item=None): 493def genlist10_clicked(obj, item=None):
557 win = StandardWindow("genlist-decorate-item-mode", "Genlist Decorate Item Mode"); 494 win = StandardWindow("genlist-decorate-item-mode",
558 win.autodel = True 495 "Genlist Decorate Item Mode", autodel=True, size=(520, 520))
559 496
560 bx = Box(win) 497 bx = Box(win, size_hint_weight=EXPAND_BOTH)
561 bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
562 win.resize_object_add(bx) 498 win.resize_object_add(bx)
563 bx.show() 499 bx.show()
564 500
565 fr = Frame(win)
566 fr.text = "Decorate Item Mode Type"
567 bx.pack_end(fr)
568 fr.show()
569
570 bx2 = Box(win) 501 bx2 = Box(win)
571 fr.content = bx2
572 bx2.show() 502 bx2.show()
573 503
574 rd = Radio(win) 504 fr = Frame(win, text="Decorate Item Mode Type", content=bx2)
575 rd.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 505 bx.pack_end(fr)
576 rd.state_value = 0 506 fr.show()
577 rd.text = "Slide : Sweep genlist items to the right." 507
508 rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=0,
509 text="Slide : Sweep genlist items to the right.")
578 rd.show() 510 rd.show()
579 bx2.pack_end(rd) 511 bx2.pack_end(rd)
580 rdg = rd 512 rdg = rd
581 513
582 rd = Radio(win) 514 rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=1,
583 rd.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 515 text = "Rotate : Click each item.")
584 rd.state_value = 1
585 rd.text = "Rotate : Click each item."
586 rd.group_add(rdg) 516 rd.group_add(rdg)
587 rd.show() 517 rd.show()
588 bx2.pack_end(rd) 518 bx2.pack_end(rd)
589 519
590 gl = Genlist(win) 520 gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
591 gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
592 gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
593 gl.callback_drag_start_right_add(my_gl_mode_right, rdg) 521 gl.callback_drag_start_right_add(my_gl_mode_right, rdg)
594 gl.callback_drag_start_left_add(my_gl_mode_left, rdg) 522 gl.callback_drag_start_left_add(my_gl_mode_left, rdg)
595 gl.callback_drag_start_up_add(my_gl_mode_cancel, rdg) 523 gl.callback_drag_start_up_add(my_gl_mode_cancel, rdg)
@@ -600,12 +528,13 @@ def genlist10_clicked(obj, item=None):
600 itc10.state_get = gl_state_get 528 itc10.state_get = gl_state_get
601 529
602 for i in range(1000, 1050): 530 for i in range(1000, 1050):
603 GenlistItem(itc10, 531 GenlistItem(item_class=itc10,
604 i, 532 item_data=i,
605 None, 533 parent_item=None,
606 ELM_GENLIST_ITEM_NONE, 534 flags=ELM_GENLIST_ITEM_NONE,
607 gl_sel10, 535 func=gl_sel10,
608 (i, rdg)).append_to(gl) 536 func_data=(i, rdg)
537 ).append_to(gl)
609 538
610 bx.pack_end(gl) 539 bx.pack_end(gl)
611 540
@@ -613,11 +542,9 @@ def genlist10_clicked(obj, item=None):
613 win.show() 542 win.show()
614 543
615 544
616 545def edit_icon_clicked_cb(ic, data):
617def edit_icon_clicked_cb(ic, item): 546 item = data[2]
618 # TODO: get the item here 547 item.delete()
619 #item.delete()
620 pass
621 548
622class ItemClass15(GenlistItemClass): 549class ItemClass15(GenlistItemClass):
623 def text_get(self, obj, part, data): 550 def text_get(self, obj, part, data):
@@ -633,22 +560,18 @@ class ItemClass15(GenlistItemClass):
633 # -------------------------------------------------------------------- 560 # --------------------------------------------------------------------
634 561
635 if part == "elm.swallow.end": 562 if part == "elm.swallow.end":
636 ic = Icon(obj) 563 ic = Icon(obj, file=os.path.join(img_path, "bubble.png"),
637 ic.file = "images/bubble.png" 564 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
638 ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
639 return ic 565 return ic
640 elif part == "elm.edit.icon.1": 566 elif part == "elm.edit.icon.1":
641 ck = Check(obj) 567 ck = Check(obj, state=checked, propagate_events=False)
642 ck.state = checked
643 ck.propagate_events = False
644 ck.show() 568 ck.show()
645 return ck 569 return ck
646 elif part == "elm.edit.icon.2": 570 elif part == "elm.edit.icon.2":
647 icn = Icon(obj) 571 icn = Icon(obj, file=os.path.join(img_path, "icon_06.png"),
648 icn.file = "images/icon_06.png" 572 propagate_events=False,
649 icn.propagate_events = False 573 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
650 icn.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1 574 icn.callback_clicked_add(edit_icon_clicked_cb, data)
651 icn.callback_clicked_add(edit_icon_clicked_cb, obj)
652 return icn 575 return icn
653 else: 576 else:
654 return 577 return
@@ -674,17 +597,14 @@ def gl15_normal_mode(obj, gl):
674 gl.select_mode = ELM_OBJECT_SELECT_MODE_DEFAULT 597 gl.select_mode = ELM_OBJECT_SELECT_MODE_DEFAULT
675 598
676def genlist15_clicked(obj, item=None): 599def genlist15_clicked(obj, item=None):
677 win = StandardWindow("genlist-decorate-all-mode", "Genlist Decorate All Mode") 600 win = StandardWindow("genlist-decorate-all-mode",
678 win.autodel = True 601 "Genlist Decorate All Mode", autodel=True, size=(520, 520))
679 602
680 bx = Box(win) 603 bx = Box(win, size_hint_weight=EXPAND_BOTH)
681 bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
682 win.resize_object_add(bx) 604 win.resize_object_add(bx)
683 bx.show() 605 bx.show()
684 606
685 gl = Genlist(win) 607 gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
686 gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
687 gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
688 gl.show() 608 gl.show()
689 609
690 itc15 = ItemClass15(item_style="default", decorate_all_item_style="edit") 610 itc15 = ItemClass15(item_style="default", decorate_all_item_style="edit")
@@ -692,68 +612,61 @@ def genlist15_clicked(obj, item=None):
692 612
693 for i in range(100): 613 for i in range(100):
694 ck = Check(gl) 614 ck = Check(gl)
695 GenlistItem(itc15, 615 data = [i, False]
696 [i, False], # item data 616 it = GenlistItem(item_class=itc15,
697 None, # parent 617 item_data=data,
698 ELM_GENLIST_ITEM_NONE, # flags 618 parent_item=None,
699 gl15_sel, # func 619 flags=ELM_GENLIST_ITEM_NONE,
700 [i, False], # func data 620 func=gl15_sel,
621 func_data=data,
701 ).append_to(gl) 622 ).append_to(gl)
702 623
624 data.append(it)
625
703 bx.pack_end(gl) 626 bx.pack_end(gl)
704 bx.show() 627 bx.show()
705 628
706 bx2 = Box(win) 629 bx2 = Box(win, horizontal=True, homogeneous=True,
707 bx2.horizontal = True 630 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
708 bx2.homogeneous = True
709 bx2.size_hint_weight = EVAS_HINT_EXPAND, 0.0
710 bx2.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
711 631
712 bt = Button(win) 632 bt = Button(win, text="Decorate All mode", size_hint_align=FILL_BOTH,
713 bt.text = "Decorate All mode" 633 size_hint_weight=EXPAND_HORIZ)
714 bt.callback_clicked_add(gl15_deco_all_mode, gl) 634 bt.callback_clicked_add(gl15_deco_all_mode, gl)
715 bt.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
716 bt.size_hint_weight = EVAS_HINT_EXPAND, 0.0
717 bx2.pack_end(bt) 635 bx2.pack_end(bt)
718 bt.show() 636 bt.show()
719 637
720 bt = Button(win) 638 bt = Button(win, text="Normal mode", size_hint_align=FILL_BOTH,
721 bt.text = "Normal mode" 639 size_hint_weight=EXPAND_HORIZ)
722 bt.callback_clicked_add(gl15_normal_mode, gl) 640 bt.callback_clicked_add(gl15_normal_mode, gl)
723 bt.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
724 bt.size_hint_weight = EVAS_HINT_EXPAND, 0.0
725 bx2.pack_end(bt) 641 bx2.pack_end(bt)
726 bt.show() 642 bt.show()
727 643
728 bx.pack_end(bx2) 644 bx.pack_end(bx2)
729 bx2.show() 645 bx2.show()
730 646
731 win.size = 520, 520
732 win.show() 647 win.show()
733 648
734 649
735if __name__ == "__main__": 650if __name__ == "__main__":
736 elementary.init() 651 elementary.init()
737 win = StandardWindow("test", "python-elementary test application") 652 win = StandardWindow("test", "python-elementary test application",
653 size=(320,520))
738 win.callback_delete_request_add(lambda o: elementary.exit()) 654 win.callback_delete_request_add(lambda o: elementary.exit())
739 655
740 box0 = Box(win) 656 box0 = Box(win, size_hint_weight=EXPAND_BOTH)
741 box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
742 win.resize_object_add(box0) 657 win.resize_object_add(box0)
743 box0.show() 658 box0.show()
744 659
745 fr = Frame(win)
746 fr.text_set("Information")
747 box0.pack_end(fr)
748 fr.show()
749
750 lb = Label(win) 660 lb = Label(win)
751 lb.text_set("Please select a test from the list below<br>" 661 lb.text_set("Please select a test from the list below<br>"
752 "by clicking the test button to show the<br>" 662 "by clicking the test button to show the<br>"
753 "test window.") 663 "test window.")
754 fr.content_set(lb)
755 lb.show() 664 lb.show()
756 665
666 fr = Frame(win, text="Information", content=lb)
667 box0.pack_end(fr)
668 fr.show()
669
757 items = [ 670 items = [
758 ("Genlist", genlist_clicked), 671 ("Genlist", genlist_clicked),
759 ("Genlist 2", genlist2_clicked), 672 ("Genlist 2", genlist2_clicked),
@@ -764,9 +677,7 @@ if __name__ == "__main__":
764 ("Genlist Decorate All Mode", genlist15_clicked), 677 ("Genlist Decorate All Mode", genlist15_clicked),
765 ] 678 ]
766 679
767 li = List(win) 680 li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
768 li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
769 li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
770 box0.pack_end(li) 681 box0.pack_end(li)
771 li.show() 682 li.show()
772 683
@@ -775,7 +686,6 @@ if __name__ == "__main__":
775 686
776 li.go() 687 li.go()
777 688
778 win.resize(320,520)
779 win.show() 689 win.show()
780 elementary.run() 690 elementary.run()
781 elementary.shutdown() 691 elementary.shutdown()
diff --git a/examples/elementary/test_gesture_layer.py b/examples/elementary/test_gesture_layer.py
index af81434..ae16f45 100644
--- a/examples/elementary/test_gesture_layer.py
+++ b/examples/elementary/test_gesture_layer.py
@@ -1,5 +1,9 @@
1#!/usr/bin/env python
2# encoding: utf-8
3
4import os
5
1from efl import elementary 6from efl import elementary
2from efl import evas
3 7
4from efl.elementary.window import Window, ELM_WIN_BASIC 8from efl.elementary.window import Window, ELM_WIN_BASIC
5from efl.elementary.transit import Transit 9from efl.elementary.transit import Transit
@@ -11,7 +15,13 @@ from efl.elementary.layout import Layout
11from efl.elementary.entry import Entry, ELM_WRAP_MIXED 15from efl.elementary.entry import Entry, ELM_WRAP_MIXED
12from efl.elementary.icon import Icon 16from efl.elementary.icon import Icon
13 17
14from efl.evas import Map, EVAS_HINT_EXPAND, EVAS_EVENT_FLAG_NONE 18from efl.evas import EVAS_HINT_EXPAND, EVAS_EVENT_FLAG_NONE, Map, Polygon
19
20EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
21EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
22
23script_path = os.path.dirname(os.path.abspath(__file__))
24img_path = os.path.join(script_path, "images")
15 25
16#We zoom out to this value so we'll be able to use map and have a nice 26#We zoom out to this value so we'll be able to use map and have a nice
17#resolution when zooming in. 27#resolution when zooming in.
@@ -33,9 +43,9 @@ class Photo_Object(object):
33 # bx, by - current wanted coordinates of the photo object. 43 # bx, by - current wanted coordinates of the photo object.
34 # bw, bh - original size of the "ic" object. 44 # bw, bh - original size of the "ic" object.
35 # dx, dy - Used to indicate the distance between the center point 45 # dx, dy - Used to indicate the distance between the center point
36 # where we put down our fingers (when started moving the item) to 46 # where we put down our fingers (when started moving the item) to
37 # the coords of the object, so we'll be able to calculate movement 47 # the coords of the object, so we'll be able to calculate movement
38 # correctly. 48 # correctly.
39 bx, by, bw, bh, dx, dy = None, None, None, None, None, None 49 bx, by, bw, bh, dx, dy = None, None, None, None, None, None
40 # Because gesture layer only knows the amount of rotation/zoom we do 50 # Because gesture layer only knows the amount of rotation/zoom we do
41 # per gesture, we have to keep the current rotate/zoom factor and the 51 # per gesture, we have to keep the current rotate/zoom factor and the
@@ -50,7 +60,7 @@ def apply_changes(po):
50 evas objects. Zoom/rotate factors and etc. 60 evas objects. Zoom/rotate factors and etc.
51 """ 61 """
52 62
53 map = evas.Map(4) 63 map = Map(4)
54 map.point_coord_set(0, po.bx, po.by, 0) 64 map.point_coord_set(0, po.bx, po.by, 0)
55 map.point_coord_set(1, po.bx + po.bw, po.by, 0) 65 map.point_coord_set(1, po.bx + po.bw, po.by, 0)
56 map.point_coord_set(2, po.bx + po.bw, po.by + po.bh, 0) 66 map.point_coord_set(2, po.bx + po.bw, po.by + po.bh, 0)
@@ -250,12 +260,11 @@ def photo_object_add(parent, ic, icon, x, y, w, h, angle):
250 po.bh = h 260 po.bh = h
251 261
252 # Add shadow 262 # Add shadow
253 po.shadow = Icon(po.ic) 263 po.shadow = Icon(po.ic, file=os.path.join(img_path, "pol_shadow.png"))
254 po.shadow.file = "images/pol_shadow.png"
255 po.shadow.size = SHADOW_W, SHADOW_H 264 po.shadow.size = SHADOW_W, SHADOW_H
256 po.shadow.show() 265 po.shadow.show()
257 266
258 po.hit = evas.Polygon(parent.evas) 267 po.hit = Polygon(parent.evas)
259 po.hit.precise_is_inside = True 268 po.hit.precise_is_inside = True
260 po.hit.repeat_events = True 269 po.hit.repeat_events = True
261 po.hit.color = 0, 0, 0, 0 270 po.hit.color = 0, 0, 0, 0
@@ -266,8 +275,7 @@ def photo_object_add(parent, ic, icon, x, y, w, h, angle):
266 275
267 po.hit.show() 276 po.hit.show()
268 277
269 po.gl = GestureLayer(po.ic) 278 po.gl = GestureLayer(po.ic, hold_events=True)
270 po.gl.hold_events = True
271 po.gl.attach(po.hit) 279 po.gl.attach(po.hit)
272 280
273 # FIXME: Add a po.rotate start so we take the first angle!!!! 281 # FIXME: Add a po.rotate start so we take the first angle!!!!
@@ -293,30 +301,28 @@ def gesture_layer_clicked(obj):
293 w = 480 301 w = 480
294 h = 800 302 h = 800
295 303
296 win = Window("gesture-layer", ELM_WIN_BASIC) 304 win = Window("gesture-layer", ELM_WIN_BASIC, title="Gesture Layer",
297 win.title = "Gesture Layer" 305 autodel=True, size=(w, h))
298 win.autodel = True
299 win.size = w, h
300 if obj is None: 306 if obj is None:
301 win.callback_delete_request_add(lambda o: elementary.exit()) 307 win.callback_delete_request_add(lambda o: elementary.exit())
302 308
303 bg = Background(win) 309 bg = Background(win, file=os.path.join(img_path, "wood_01.jpg"),
304 bg.file = "images/wood_01.jpg" 310 size_hint_weight=EXPAND_BOTH)
305 bg.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
306 win.resize_object_add(bg) 311 win.resize_object_add(bg)
307 bg.show() 312 bg.show()
308 313
309 photos = [] 314 photos = []
310 315
311 photos.append(photo_object_add(win, None, "images/pol_sky.png", 200, 200, 365, 400, 0)) 316 photos.append(photo_object_add(win, None,
312 photos.append(photo_object_add(win, None, "images/pol_twofish.png", 40, 300, 365, 400, 45)) 317 os.path.join(img_path, "pol_sky.png"), 200, 200, 365, 400, 0))
318 photos.append(photo_object_add(win, None,
319 os.path.join(img_path, "pol_twofish.png"), 40, 300, 365, 400, 45))
313 320
314 en = Entry(win) 321 en = Entry(win, line_wrap=ELM_WRAP_MIXED)
315 en.text = "You can use whatever object you want, even entries like this." 322 en.text = "You can use whatever object you want, even entries like this."
316 en.line_wrap = ELM_WRAP_MIXED
317 323
318 postit = Layout(win) 324 postit = Layout(win,
319 postit.file = "postit_ent.edj", "main" 325 file=(os.path.join(script_path, "postit_ent.edj"), "main"))
320 postit.part_content_set("ent", en) 326 postit.part_content_set("ent", en)
321 327
322 photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355)) 328 photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))
diff --git a/examples/elementary/test_grid.py b/examples/elementary/test_grid.py
index caa1ea0..af80e7a 100644
--- a/examples/elementary/test_grid.py
+++ b/examples/elementary/test_grid.py
@@ -1,103 +1,79 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4from efl.evas import EVAS_HINT_EXPAND, Rectangle
5from efl import elementary 5from efl import elementary
6from efl.elementary.window import Window 6from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background
8from efl.elementary.box import Box 7from efl.elementary.box import Box
9from efl.elementary.button import Button 8from efl.elementary.button import Button
10from efl.elementary.entry import Entry 9from efl.elementary.entry import Entry
11from efl.elementary.grid import Grid 10from efl.elementary.grid import Grid, grid_pack_get, grid_pack_set
12 11
12EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
13 13
14def cb_change(bt): 14def cb_change(bt):
15 (x, y, w, h) = grid_pack_get(bt) 15 (x, y, w, h) = grid_pack_get(bt)
16 grid_pack_set(bt, x - 2, y - 2, w + 4, h + 4) 16 grid_pack_set(bt, x - 2, y - 2, w + 4, h + 4)
17 17
18def grid_clicked(obj): 18def grid_clicked(obj):
19 win = Window("grid", elementary.ELM_WIN_BASIC) 19 win = StandardWindow("grid", "Grid test", autodel=True, size=(480, 480))
20 win.title = "Grid test"
21 win.autodel = True
22 if obj is None: 20 if obj is None:
23 win.callback_delete_request_add(lambda o: elementary.exit()) 21 win.callback_delete_request_add(lambda o: elementary.exit())
24 22
25 bg = Background(win) 23 gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH)
26 win.resize_object_add(bg)
27 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
28 bg.show()
29
30 gd = Grid(win)
31 gd.size = (100, 100)
32 win.resize_object_add(gd) 24 win.resize_object_add(gd)
33 gd.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
34 gd.show() 25 gd.show()
35 26
36 en = Entry(win) 27 en = Entry(win, scrollable=True, text="Entry text 2", single_line=True)
37 en.scrollable = True
38 en.text = "Entry text 2"
39 en.single_line = True
40 gd.pack(en, 60, 20, 30, 10) 28 gd.pack(en, 60, 20, 30, 10)
41 en.show() 29 en.show()
42 30
43 bt = Button(win) 31 bt = Button(win, text="Next API function", disabled=True)
44 bt.text = "Next API function"
45 gd.pack(bt, 30, 0, 40, 10) 32 gd.pack(bt, 30, 0, 40, 10)
46 bt.disabled = True 33 bt.disabled = True
47 bt.show() 34 bt.show()
48 35
49 bt = Button(win) 36 bt = Button(win, text="Button")
50 bt.text = "Button"
51 gd.pack(bt, 0, 0, 20, 20) 37 gd.pack(bt, 0, 0, 20, 20)
52 bt.show() 38 bt.show()
53 39
54 bt = Button(win); 40 bt = Button(win, text="Button")
55 bt.text = "Button"
56 gd.pack(bt, 10, 10, 40, 20) 41 gd.pack(bt, 10, 10, 40, 20)
57 bt.show() 42 bt.show()
58 43
59 bt = Button(win); 44 bt = Button(win, text="Button")
60 bt.text = "Button"
61 gd.pack(bt, 10, 30, 20, 50) 45 gd.pack(bt, 10, 30, 20, 50)
62 bt.show() 46 bt.show()
63 47
64 bt = Button(win); 48 bt = Button(win, text="Button")
65 bt.text = "Button"
66 gd.pack(bt, 80, 80, 20, 20) 49 gd.pack(bt, 80, 80, 20, 20)
67 bt.show() 50 bt.show()
68 51
69 bt = Button(win); 52 bt = Button(win, text="Change")
70 bt.text = "Change"
71 bt.callback_clicked_add(cb_change) 53 bt.callback_clicked_add(cb_change)
72 gd.pack(bt, 40, 40, 20, 20) 54 gd.pack(bt, 40, 40, 20, 20)
73 bt.show() 55 bt.show()
74 56
75 re = evas.Rectangle(win.evas) 57 re = Rectangle(win.evas, color=(128, 0, 0, 128))
76 re.color = (128, 0, 0, 128)
77 gd.pack(re, 40, 70, 20, 10) 58 gd.pack(re, 40, 70, 20, 10)
78 re.show() 59 re.show()
79 60
80 re = evas.Rectangle(win.evas) 61 re = Rectangle(win.evas, color=(0, 128, 0, 128))
81 re.color = (0, 128, 0, 128)
82 gd.pack(re, 60, 70, 10, 10) 62 gd.pack(re, 60, 70, 10, 10)
83 re.show() 63 re.show()
84 64
85 re = evas.Rectangle(win.evas) 65 re = Rectangle(win.evas, color=(0, 0, 128, 128))
86 re.color = (0, 0, 128, 128)
87 gd.pack(re, 40, 80, 10, 10) 66 gd.pack(re, 40, 80, 10, 10)
88 re.show() 67 re.show()
89 68
90 re = evas.Rectangle(win.evas) 69 re = Rectangle(win.evas, color=(128, 0, 128, 128))
91 re.color = (128, 0, 128, 128)
92 gd.pack(re, 50, 80, 10, 10) 70 gd.pack(re, 50, 80, 10, 10)
93 re.show() 71 re.show()
94 72
95 re = evas.Rectangle(win.evas) 73 re = Rectangle(win.evas, color=(128, 64, 0, 128))
96 re.color = (128, 64, 0, 128)
97 gd.pack(re, 60, 80, 10, 10) 74 gd.pack(re, 60, 80, 10, 10)
98 re.show() 75 re.show()
99 76
100 win.resize(480, 480)
101 win.show() 77 win.show()
102 78
103 79
diff --git a/examples/elementary/test_hover.py b/examples/elementary/test_hover.py
index 3c58fbc..7020d6e 100644
--- a/examples/elementary/test_hover.py
+++ b/examples/elementary/test_hover.py
@@ -1,10 +1,11 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4import os
5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
5from efl import elementary 7from efl import elementary
6from efl.elementary.window import Window 8from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background
8from efl.elementary.box import Box 9from efl.elementary.box import Box
9from efl.elementary.button import Button 10from efl.elementary.button import Button
10from efl.elementary.frame import Frame 11from efl.elementary.frame import Frame
@@ -13,204 +14,138 @@ from efl.elementary.label import Label
13from efl.elementary.list import List 14from efl.elementary.list import List
14from efl.elementary.icon import Icon 15from efl.elementary.icon import Icon
15 16
17EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
18FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
19
20script_path = os.path.dirname(os.path.abspath(__file__))
21img_path = os.path.join(script_path, "images")
16 22
17def hover_bt1_clicked(bt, hv): 23def hover_bt1_clicked(bt, hv):
18 hv.show() 24 hv.show()
19 25
20def hover_clicked(obj, item=None): 26def hover_clicked(obj, item=None):
21 win = Window("hover", elementary.ELM_WIN_BASIC) 27 win = StandardWindow("hover", "Hover", autodel=True, size=(320, 320))
22 win.title_set("Hover")
23 win.autodel_set(True)
24
25 bg = Background(win)
26 win.resize_object_add(bg)
27 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
28 bg.show()
29 28
30 bx = Box(win) 29 bx = Box(win, size_hint_weight=EXPAND_BOTH)
31 win.resize_object_add(bx) 30 win.resize_object_add(bx)
32 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
33 bx.show() 31 bx.show()
34 32
35 hv = Hover(win) 33 hv = Hover(win)
36 34
37 bt = Button(win) 35 bt = Button(win, text="Button")
38 bt.text_set("Button")
39 bt.callback_clicked_add(hover_bt1_clicked, hv) 36 bt.callback_clicked_add(hover_bt1_clicked, hv)
40 bx.pack_end(bt) 37 bx.pack_end(bt)
41 bt.show() 38 bt.show()
42 hv.parent_set(win) 39 hv.target = bt
43 hv.target_set(bt)
44 40
45 bt = Button(win) 41 bt = Button(win, text="Popup")
46 bt.text_set("Popup")
47 hv.part_content_set("middle", bt) 42 hv.part_content_set("middle", bt)
48 bt.show() 43 bt.show()
49 44
50 bx = Box(win) 45 bx = Box(win)
51 46
52 ic = Icon(win) 47 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
53 ic.file_set("images/logo_small.png") 48 resizable=(False, False))
54 ic.resizable_set(0, 0)
55 bx.pack_end(ic) 49 bx.pack_end(ic)
56 ic.show() 50 ic.show()
57 51
58 bt = Button(win) 52 for t in "Top 1", "Top 2", "Top 3":
59 bt.text_set("Top 1") 53 bt = Button(win, text=t)
60 bx.pack_end(bt) 54 bx.pack_end(bt)
61 bt.show() 55 bt.show()
62
63 bt = Button(win)
64 bt.text_set("Top 2")
65 bx.pack_end(bt)
66 bt.show()
67
68 bt = Button(win)
69 bt.text_set("Top 3")
70 bx.pack_end(bt)
71 bt.show()
72 56
73 bx.show() 57 bx.show()
74 58
75 hv.part_content_set("top", bx) 59 hv.part_content_set("top", bx)
76 60
77 bt = Button(win) 61 bt = Button(win, text="Bottom")
78 bt.text_set("Bottom")
79 hv.part_content_set("bottom", bt) 62 hv.part_content_set("bottom", bt)
80 bt.show() 63 bt.show()
81 64
82 bt = Button(win) 65 bt = Button(win, text="Left")
83 bt.text_set("Left")
84 hv.part_content_set("left", bt) 66 hv.part_content_set("left", bt)
85 bt.show() 67 bt.show()
86 68
87 bt = Button(win) 69 bt = Button(win, text="Right")
88 bt.text_set("Right")
89 hv.part_content_set("right", bt) 70 hv.part_content_set("right", bt)
90 bt.show() 71 bt.show()
91 72
92 bg.size_hint_min_set(160, 160)
93 bg.size_hint_max_set(640, 640)
94
95 win.resize(320, 320)
96 win.show() 73 win.show()
97 74
98 75
99def hover2_clicked(obj, item=None): 76def hover2_clicked(obj, item=None):
100 win = Window("hover2", elementary.ELM_WIN_BASIC) 77 win = StandardWindow("hover2", "Hover 2", autodel=True, size=(320, 320))
101 win.title_set("Hover 2")
102 win.autodel_set(True)
103
104 bg = Background(win)
105 win.resize_object_add(bg)
106 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
107 bg.show()
108 78
109 bx = Box(win) 79 bx = Box(win, size_hint_weight=EXPAND_BOTH)
110 win.resize_object_add(bx) 80 win.resize_object_add(bx)
111 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
112 bx.show() 81 bx.show()
113 82
114 hv = Hover(win) 83 hv = Hover(win, style="popout")
115 hv.style_set("popout")
116 84
117 bt = Button(win) 85 bt = Button(win, text="Button")
118 bt.text_set("Button")
119 bt.callback_clicked_add(hover_bt1_clicked, hv) 86 bt.callback_clicked_add(hover_bt1_clicked, hv)
120 bx.pack_end(bt) 87 bx.pack_end(bt)
121 bt.show() 88 bt.show()
122 hv.parent_set(win)
123 hv.target_set(bt) 89 hv.target_set(bt)
124 90
125 bt = Button(win) 91 bt = Button(win, text="Popup")
126 bt.text_set("Popup")
127 hv.part_content_set("middle", bt) 92 hv.part_content_set("middle", bt)
128 bt.show() 93 bt.show()
129 94
130 bx = Box(win) 95 bx = Box(win)
131 96
132 ic = Icon(win) 97 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
133 ic.file_set("images/logo_small.png") 98 resizable=(False, False))
134 ic.resizable_set(0, 0)
135 bx.pack_end(ic) 99 bx.pack_end(ic)
136 ic.show() 100 ic.show()
137 101
138 bt = Button(win) 102 for t in "Top 1", "Top 2", "Top 3":
139 bt.text_set("Top 1") 103 bt = Button(win, text=t)
140 bx.pack_end(bt) 104 bx.pack_end(bt)
141 bt.show() 105 bt.show()
142
143 bt = Button(win)
144 bt.text_set("Top 2")
145 bx.pack_end(bt)
146 bt.show()
147
148 bt = Button(win)
149 bt.text_set("Top 3")
150 bx.pack_end(bt)
151 bt.show()
152 106
153 bx.show() 107 bx.show()
154 hv.part_content_set("top", bx) 108 hv.part_content_set("top", bx)
155 109
156 bt = Button(win) 110 bt = Button(win, text="Bot")
157 bt.text_set("Bot")
158 hv.part_content_set("bottom", bt) 111 hv.part_content_set("bottom", bt)
159 bt.show() 112 bt.show()
160 113
161 bt = Button(win) 114 bt = Button(win, text="Left")
162 bt.text_set("Left")
163 hv.part_content_set("left", bt) 115 hv.part_content_set("left", bt)
164 bt.show() 116 bt.show()
165 117
166 bt = Button(win) 118 bt = Button(win, text="Right")
167 bt.text_set("Right")
168 hv.part_content_set("right", bt) 119 hv.part_content_set("right", bt)
169 bt.show() 120 bt.show()
170 121
171 bg.size_hint_min_set(160, 160)
172 bg.size_hint_max_set(640, 640)
173 win.resize(320, 320)
174 win.show() 122 win.show()
175 123
176 124
177if __name__ == "__main__": 125if __name__ == "__main__":
178 def destroy(obj):
179 elementary.exit()
180
181 elementary.init() 126 elementary.init()
182 win = Window("test", elementary.ELM_WIN_BASIC) 127 win = StandardWindow("test", "python-elementary test application",
183 win.title_set("python-elementary test application") 128 size=(320,520))
184 win.callback_delete_request_add(destroy) 129 win.callback_delete_request_add(lambda o: elementary.exit())
185 130
186 bg = Background(win) 131 box0 = Box(win, size_hint_weight=EXPAND_BOTH)
187 win.resize_object_add(bg)
188 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
189 bg.show()
190
191 box0 = Box(win)
192 box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
193 win.resize_object_add(box0) 132 win.resize_object_add(box0)
194 box0.show() 133 box0.show()
195 134
196 fr = Frame(win)
197 fr.text_set("Information")
198 box0.pack_end(fr)
199 fr.show()
200
201 lb = Label(win) 135 lb = Label(win)
202 lb.text_set("Please select a test from the list below<br>" 136 lb.text_set("Please select a test from the list below<br>"
203 "by clicking the test button to show the<br>" 137 "by clicking the test button to show the<br>"
204 "test window.") 138 "test window.")
205 fr.content_set(lb)
206 lb.show() 139 lb.show()
207 140
141 fr = Frame(win, text="Information", content=lb)
142 box0.pack_end(fr)
143 fr.show()
144
208 items = [("Hover", hover_clicked), 145 items = [("Hover", hover_clicked),
209 ("Hover 2", hover2_clicked)] 146 ("Hover 2", hover2_clicked)]
210 147
211 li = List(win) 148 li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
212 li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
213 li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
214 box0.pack_end(li) 149 box0.pack_end(li)
215 li.show() 150 li.show()
216 151
@@ -219,8 +154,6 @@ if __name__ == "__main__":
219 154
220 li.go() 155 li.go()
221 156
222 win.resize(320,520)
223 win.show() 157 win.show()
224 elementary.run() 158 elementary.run()
225 elementary.shutdown() 159 elementary.shutdown()
226
diff --git a/examples/elementary/test_hoversel.py b/examples/elementary/test_hoversel.py
index a99e105..d761c5c 100644
--- a/examples/elementary/test_hoversel.py
+++ b/examples/elementary/test_hoversel.py
@@ -1,110 +1,89 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4import os
5
6from efl.evas import EVAS_HINT_EXPAND
5from efl import elementary 7from efl import elementary
6from efl.elementary.window import Window 8from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background
8from efl.elementary.box import Box 9from efl.elementary.box import Box
9from efl.elementary.hoversel import Hoversel 10from efl.elementary.hoversel import Hoversel, ELM_ICON_STANDARD, ELM_ICON_FILE
10from efl.elementary.icon import Icon 11from efl.elementary.icon import Icon
11 12
13EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
14WEIGHT_ZERO = 0.0, 0.0
15ALIGN_CENTER = 0.5, 0.5
16
17script_path = os.path.dirname(os.path.abspath(__file__))
18img_path = os.path.join(script_path, "images")
12 19
13def hoversel_clicked(obj): 20def hoversel_clicked(obj):
14 win = Window("hoversel", elementary.ELM_WIN_BASIC) 21 win = StandardWindow("hoversel", "Hoversel", autodel=True, size=(320, 320))
15 win.title_set("Hoversel")
16 win.autodel_set(True)
17 if obj is None: 22 if obj is None:
18 win.callback_delete_request_add(lambda o: elementary.exit()) 23 win.callback_delete_request_add(lambda o: elementary.exit())
19 24
20 bg = Background(win) 25 bx = Box(win, size_hint_weight=EXPAND_BOTH)
21 win.resize_object_add(bg)
22 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
23 bg.show()
24
25 bx = Box(win)
26 win.resize_object_add(bx) 26 win.resize_object_add(bx)
27 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
28 bx.show() 27 bx.show()
29 28
30 bt = Hoversel(win) 29 bt = Hoversel(win, hover_parent=win, text="Labels",
31 bt.hover_parent_set(win) 30 size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
32 bt.text_set("Labels")
33 bt.item_add("Item 1") 31 bt.item_add("Item 1")
34 bt.item_add("Item 2") 32 bt.item_add("Item 2")
35 bt.item_add("Item 3") 33 bt.item_add("Item 3")
36 bt.item_add("Item 4 - Long Label Here") 34 bt.item_add("Item 4 - Long Label Here")
37 bt.size_hint_weight_set(0.0, 0.0)
38 bt.size_hint_align_set(0.5, 0.5)
39 bx.pack_end(bt) 35 bx.pack_end(bt)
40 bt.show() 36 bt.show()
41 37
42 bt = Hoversel(win) 38 bt = Hoversel(win, hover_parent=win, text="Some Icons",
43 bt.hover_parent_set(win) 39 size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
44 bt.text_set("Some Icons")
45 bt.item_add("Item 1") 40 bt.item_add("Item 1")
46 bt.item_add("Item 2") 41 bt.item_add("Item 2")
47 bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD) 42 bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
48 bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD) 43 bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
49 bt.size_hint_weight_set(0.0, 0.0)
50 bt.size_hint_align_set(0.5, 0.5)
51 bx.pack_end(bt) 44 bx.pack_end(bt)
52 bt.show() 45 bt.show()
53 46
54 bt = Hoversel(win) 47 bt = Hoversel(win, hover_parent=win, text="All Icons",
55 bt.hover_parent_set(win) 48 size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
56 bt.text_set("All Icons") 49 bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
57 bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD) 50 bt.item_add("Item 2", "arrow_down", ELM_ICON_STANDARD)
58 bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD) 51 bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
59 bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD) 52 bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
60 bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
61 bt.size_hint_weight_set(0.0, 0.0)
62 bt.size_hint_align_set(0.5, 0.5)
63 bx.pack_end(bt) 53 bx.pack_end(bt)
64 bt.show() 54 bt.show()
65 55
66 bt = Hoversel(win) 56 bt = Hoversel(win, hover_parent=win, text="All Icons",
67 bt.hover_parent_set(win) 57 size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
68 bt.text_set("All Icons") 58 bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
69 bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD) 59 bt.item_add("Item 2", os.path.join(img_path, "logo_small.png"),
70 bt.item_add("Item 2", "images/logo_small.png", elementary.ELM_ICON_FILE) 60 ELM_ICON_FILE)
71 bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD) 61 bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
72 bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD) 62 bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
73 bt.size_hint_weight_set(0.0, 0.0)
74 bt.size_hint_align_set(0.5, 0.5)
75 bx.pack_end(bt) 63 bx.pack_end(bt)
76 bt.show() 64 bt.show()
77 65
78 bt = Hoversel(win) 66 bt = Hoversel(win, hover_parent=win, text="Disabled Hoversel",
79 bt.hover_parent_set(win) 67 disabled=True, size_hint_weight=WEIGHT_ZERO,
80 bt.text_set("Disabled Hoversel") 68 size_hint_align=ALIGN_CENTER)
81 bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD) 69 bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
82 bt.item_add("Item 2", "close", elementary.ELM_ICON_STANDARD) 70 bt.item_add("Item 2", "close", ELM_ICON_STANDARD)
83 bt.disabled_set(True)
84 bt.size_hint_weight_set(0.0, 0.0)
85 bt.size_hint_align_set(0.5, 0.5)
86 bx.pack_end(bt) 71 bx.pack_end(bt)
87 bt.show() 72 bt.show()
88 73
89 bt = Hoversel(win)
90 bt.hover_parent_set(win)
91 bt.text_set("Icon + Label")
92 74
93 ic = Icon(win) 75 ic = Icon(win, file=os.path.join(img_path, "sky_03.jpg"))
94 ic.file_set("images/sky_03.jpg") 76 bt = Hoversel(win, hover_parent=win, text="Icon + Label", content=ic,
95 bt.content_set(ic) 77 size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
96 ic.show() 78 ic.show()
97 79
98 bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD) 80 bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
99 bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD) 81 bt.item_add("Item 2", "arrow_down", ELM_ICON_STANDARD)
100 bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD) 82 bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
101 bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD) 83 bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
102 bt.size_hint_weight_set(0.0, 0.0)
103 bt.size_hint_align_set(0.5, 0.5)
104 bx.pack_end(bt) 84 bx.pack_end(bt)
105 bt.show() 85 bt.show()
106 86
107 win.resize(320, 320)
108 win.show() 87 win.show()
109 88
110 89
diff --git a/examples/elementary/test_icon.py b/examples/elementary/test_icon.py
index 620671f..896efa1 100644
--- a/examples/elementary/test_icon.py
+++ b/examples/elementary/test_icon.py
@@ -1,9 +1,11 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import evas 4import os
5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
5from efl import elementary 7from efl import elementary
6from efl.elementary.window import Window 8from efl.elementary.window import StandardWindow, Window, ELM_WIN_BASIC
7from efl.elementary.background import Background 9from efl.elementary.background import Background
8from efl.elementary.box import Box 10from efl.elementary.box import Box
9from efl.elementary.button import Button 11from efl.elementary.button import Button
@@ -13,124 +15,95 @@ from efl.elementary.check import Check
13from efl.elementary.list import List 15from efl.elementary.list import List
14from efl.elementary.icon import Icon 16from efl.elementary.icon import Icon
15 17
18EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
19EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
20FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
21
22script_path = os.path.dirname(os.path.abspath(__file__))
23img_path = os.path.join(script_path, "images")
16 24
17def aspect_fixed_cb(obj, ic): 25def aspect_fixed_cb(obj, ic):
18 ic.aspect_fixed_set(obj.state_get()) 26 ic.aspect_fixed = obj.state
19 27
20def fill_outside_cb(obj, ic): 28def fill_outside_cb(obj, ic):
21 ic.fill_outside_set(obj.state_get()) 29 ic.fill_outside = obj.state
22 30
23def smooth_cb(obj, ic): 31def smooth_cb(obj, ic):
24 ic.smooth_set(obj.state_get()) 32 ic.smooth = obj.state
25 33
26def bt_clicked(obj): 34def bt_clicked(obj):
27 win = Window("preload-prescale", elementary.ELM_WIN_BASIC) 35 win = StandardWindow("preload-prescale", "Preload & Prescale", autodel=True,
28 win.title_set("Preload & Prescale") 36 size=(350, 350))
29 win.autodel_set(True)
30 37
31 bg = Background(win) 38 ic = Icon(win, file=os.path.join(img_path, "insanely_huge_test_image.jpg"),
32 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 39 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
33 win.resize_object_add(bg) 40 resizable=(True, True), aspect_fixed=True, preload_disabled=True,
34 bg.show() 41 prescale=True)
35
36 ic = Icon(win)
37 win.resize_object_add(ic) 42 win.resize_object_add(ic)
38 ic.file_set("images/insanely_huge_test_image.jpg")
39
40 ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
41 ic.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
42 ic.resizable_set(True, True)
43 ic.aspect_fixed_set(True)
44 ic.preload_disabled_set(True)
45 ic.prescale_set(True)
46 ic.show() 43 ic.show()
47 44
48 win.resize(350, 350)
49 win.show() 45 win.show()
50 46
51 47
52def icon_clicked(obj, item=None): 48def icon_clicked(obj, item=None):
53 win = Window("icon test", elementary.ELM_WIN_BASIC) 49 win = StandardWindow("icon test", "Icon Test", autodel=True,
54 win.title_set("Icon Test") 50 size=(400, 400))
55 win.autodel_set(True)
56
57 bg = Background(win)
58 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
59 win.resize_object_add(bg)
60 bg.show()
61 51
62 box = Box(win) 52 box = Box(win, size_hint_weight=EXPAND_BOTH)
63 win.resize_object_add(box) 53 win.resize_object_add(box)
64 box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
65 box.show() 54 box.show()
66 55
67 content_box = Box(win) 56 content_box = Box(win, size_hint_weight=EXPAND_BOTH,
57 size_hint_align=FILL_BOTH)
68 win.resize_object_add(content_box) 58 win.resize_object_add(content_box)
69 content_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
70 content_box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
71 box.pack_end(content_box) 59 box.pack_end(content_box)
72 content_box.show() 60 content_box.show()
73 61
74 ic = Icon(win) 62 ic = Icon(win, file=os.path.join(img_path, "logo.png"),
75 ic.file_set("images/logo.png") 63 resizable=(True, True), size_hint_weight=EXPAND_BOTH,
76 ic.resizable_set(True, True) 64 size_hint_align=FILL_BOTH)
77 ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
78 ic.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
79
80 content_box.pack_end(ic) 65 content_box.pack_end(ic)
81 ic.show() 66 ic.show()
82 67
83 hbox = Box(win) 68 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
84 hbox.horizontal_set(True)
85 content_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
86 box.pack_end(hbox) 69 box.pack_end(hbox)
87 hbox.show() 70 hbox.show()
88 71
89 # Test Aspect Fixed 72 # Test Aspect Fixed
90 tg = Check(win) 73 tg = Check(win, text="Aspect Fixed", state=True)
91 tg.text_set("Aspect Fixed")
92 tg.state_set(True)
93 tg.callback_changed_add(aspect_fixed_cb, ic) 74 tg.callback_changed_add(aspect_fixed_cb, ic)
94 hbox.pack_end(tg) 75 hbox.pack_end(tg)
95 tg.show() 76 tg.show()
96 77
97 # Test Fill Outside 78 # Test Fill Outside
98 tg = Check(win) 79 tg = Check(win, text="Fill Outside")
99 tg.text_set("Fill Outside")
100 tg.callback_changed_add(fill_outside_cb, ic) 80 tg.callback_changed_add(fill_outside_cb, ic)
101 hbox.pack_end(tg) 81 hbox.pack_end(tg)
102 tg.show() 82 tg.show()
103 83
104 # Test Smooth 84 # Test Smooth
105 tg = Check(win) 85 tg = Check(win, text="Smooth", state=True)
106 tg.text_set("Smooth")
107 tg.state_set(True)
108 tg.callback_changed_add(smooth_cb, ic) 86 tg.callback_changed_add(smooth_cb, ic)
109 hbox.pack_end(tg)