summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-11-03 10:42:50 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2013-11-03 10:42:50 +0200
commitcf1f98bbf611ad14662254988a48529cfedcf49c (patch)
tree870be59a45571058abf7d380dbf6ecc359ad5748
parent23e9d4920875906c7f90fb4a8dd91c68e9522c07 (diff)
Elementary: Improve the rest of the examples.
Summary of changes: - Make use of constructor keyword args - Most scripts are now working directory agnostic - Enabled evas textgrid example - Printed messages are slightly better formatted
-rw-r--r--examples/elementary/test_bg.py1
-rw-r--r--examples/elementary/test_config.py11
-rw-r--r--examples/elementary/test_cursor.py2
-rw-r--r--examples/elementary/test_floating.py10
-rw-r--r--examples/elementary/test_map.py106
-rw-r--r--examples/elementary/test_map2.py198
-rw-r--r--examples/elementary/test_map3.py188
-rw-r--r--examples/elementary/test_mapbuf.py123
-rw-r--r--examples/elementary/test_menu.py24
-rw-r--r--examples/elementary/test_multibuttonentry.py110
-rw-r--r--examples/elementary/test_naviframe.py109
-rw-r--r--examples/elementary/test_notify.py91
-rw-r--r--examples/elementary/test_panel.py38
-rw-r--r--examples/elementary/test_panes.py36
-rw-r--r--examples/elementary/test_photo.py49
-rw-r--r--examples/elementary/test_photocam.py64
-rw-r--r--examples/elementary/test_popup.py125
-rw-r--r--examples/elementary/test_progressbar.py128
-rw-r--r--examples/elementary/test_radio.py79
-rw-r--r--examples/elementary/test_scroller.py91
-rw-r--r--examples/elementary/test_segment_control.py78
-rw-r--r--examples/elementary/test_separator.py82
-rw-r--r--examples/elementary/test_slideshow.py133
-rw-r--r--examples/elementary/test_spinner.py87
-rw-r--r--examples/elementary/test_table.py54
-rw-r--r--examples/elementary/test_thumb.py29
-rw-r--r--examples/elementary/test_toolbar.py195
-rw-r--r--examples/elementary/test_tooltip.py92
-rw-r--r--examples/elementary/test_transit.py192
-rw-r--r--examples/elementary/test_video.py54
-rw-r--r--examples/elementary/test_win.py75
31 files changed, 1043 insertions, 1611 deletions
diff --git a/examples/elementary/test_bg.py b/examples/elementary/test_bg.py
index 8e1d66a..3167726 100644
--- a/examples/elementary/test_bg.py
+++ b/examples/elementary/test_bg.py
@@ -1,6 +1,7 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4import os
4 5
5from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL 6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
6from efl import elementary 7from efl import elementary
diff --git a/examples/elementary/test_config.py b/examples/elementary/test_config.py
index 19f8265..d6030e2 100644
--- a/examples/elementary/test_config.py
+++ b/examples/elementary/test_config.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 import elementary 6from efl import elementary
5from efl.elementary.window import StandardWindow, Window, ELM_WIN_INLINED_IMAGE, \ 7from efl.elementary.window import StandardWindow, Window, ELM_WIN_INLINED_IMAGE, \
6 ELM_WIN_SOCKET_IMAGE 8 ELM_WIN_SOCKET_IMAGE
@@ -25,6 +27,9 @@ EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
25FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 27FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
26FILL_HORIZ = EVAS_HINT_FILL, 0.5 28FILL_HORIZ = EVAS_HINT_FILL, 0.5
27 29
30script_path = os.path.dirname(os.path.abspath(__file__))
31img_path = os.path.join(script_path, "images")
32
28class Prof_Data(object): 33class Prof_Data(object):
29 rdg = None 34 rdg = None
30 cks = [] 35 cks = []
@@ -229,7 +234,8 @@ def plug_add(win, bx, name):
229 plug = Plug(win, size_hint_weight=EXPAND_BOTH) 234 plug = Plug(win, size_hint_weight=EXPAND_BOTH)
230 235
231 if plug.connect(name, 0, False): 236 if plug.connect(name, 0, False):
232 ly = Layout(win, file=("test.edj", "win_config"), 237 ly = Layout(win,
238 file=(os.path.join(script_path, "test.edj"), "win_config"),
233 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) 239 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
234 ly.show() 240 ly.show()
235 241
@@ -338,7 +344,7 @@ def config_clicked(obj, data=None):
338 344
339 if data: 345 if data:
340 if data.available_profiles: 346 if data.available_profiles:
341 win.available_profiles = data.available_profiles, 347 win.available_profiles = data.available_profiles
342 if data.profile: 348 if data.profile:
343 win.profile = data.profile 349 win.profile = data.profile
344 350
@@ -349,7 +355,6 @@ def config_clicked(obj, data=None):
349 355
350 win.show() 356 win.show()
351 357
352
353if __name__ == "__main__": 358if __name__ == "__main__":
354 elementary.init() 359 elementary.init()
355 360
diff --git a/examples/elementary/test_cursor.py b/examples/elementary/test_cursor.py
index c3c51e6..b6d8058 100644
--- a/examples/elementary/test_cursor.py
+++ b/examples/elementary/test_cursor.py
@@ -48,7 +48,7 @@ def cursor_clicked(obj, item=None):
48 lst.go() 48 lst.go()
49 lst.show() 49 lst.show()
50 50
51 en = Entry(win, scrollable=True, single_line=True, entry="Xterm cursor" 51 en = Entry(win, scrollable=True, single_line=True, entry="Xterm cursor",
52 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ, 52 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ,
53 cursor="xterm") 53 cursor="xterm")
54 bx.pack_end(en) 54 bx.pack_end(en)
diff --git a/examples/elementary/test_floating.py b/examples/elementary/test_floating.py
index 61182d5..5072bdb 100644
--- a/examples/elementary/test_floating.py
+++ b/examples/elementary/test_floating.py
@@ -12,15 +12,17 @@ from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_EXPAND, \
12EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND 12EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
13FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL 13FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
14 14
15script_path = os.path.dirname(os.path.abspath(__file__))
16img_path = os.path.join(script_path, "images")
17
15class ItemClass(GenlistItemClass): 18class ItemClass(GenlistItemClass):
16 def text_get(self, obj, part, *args, **kwargs): 19 def text_get(self, obj, part, *args, **kwargs):
17 return "Item #{0}".format(args[0]) 20 return "Item #{0}".format(args[0])
18 21
19 def content_get(self, obj, part, *args, **kwargs): 22 def content_get(self, obj, part, *args, **kwargs):
20 ic = Icon(obj) 23 ic = Icon(obj, file=os.path.join(img_path, "logo_small.png"),
21 ic.file = "images/logo_small.png" 24 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
22 ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1 25 return ic
23 return ic
24 26
25def gl_sel_cb(obj, event_info, data): 27def gl_sel_cb(obj, event_info, data):
26 print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data, obj, event_info)) 28 print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data, obj, event_info))
diff --git a/examples/elementary/test_map.py b/examples/elementary/test_map.py
index 1ed3684..653a074 100644
--- a/examples/elementary/test_map.py
+++ b/examples/elementary/test_map.py
@@ -1,17 +1,20 @@
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 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.check import Check 9from efl.elementary.check import Check
11from efl.elementary.hoversel import Hoversel 10from efl.elementary.hoversel import Hoversel
12from efl.elementary.map import Map 11from efl.elementary.map import Map, ELM_MAP_SOURCE_TYPE_TILE
13from efl.elementary.slider import Slider 12from efl.elementary.slider import Slider
14 13
14EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
15EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
16FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
17FILL_HORIZ = EVAS_HINT_FILL, 0.5
15 18
16def print_map_info(Map): 19def print_map_info(Map):
17 print("---Map info---") 20 print("---Map info---")
@@ -44,130 +47,101 @@ def cb_slider_rot(sl, Map):
44 Map.rotate_set(sl.value, cx, cy) 47 Map.rotate_set(sl.value, cx, cy)
45 print("New rotate: %f %d %d" % Map.rotate) 48 print("New rotate: %f %d %d" % Map.rotate)
46 49
47def cb_hovsel_selected(hov, item, Map, type): 50def cb_hovsel_selected(hov, item, Map, src_type):
48 Map.source_set(type, item.text) 51 Map.source_set(src_type, item.text)
49 hov.text = "Tiles: %s" % (item.text) 52 hov.text = "Tiles: %s" % (item.text)
50 53
51def map_clicked(obj): 54def map_clicked(obj):
52 win = Window("map", elementary.ELM_WIN_BASIC) 55 win = StandardWindow("map", "Map test", autodel=True, size=(600, 600))
53 win.title = "Map test"
54 win.autodel = True
55 if obj is None: 56 if obj is None:
56 win.callback_delete_request_add(lambda o: elementary.exit()) 57 win.callback_delete_request_add(lambda o: elementary.exit())
57 58
58 bg = Background(win) 59 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
59 win.resize_object_add(bg)
60 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
61 bg.show()
62
63 vbox = Box(win)
64 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
65 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
66 win.resize_object_add(vbox) 60 win.resize_object_add(vbox)
67 vbox.show() 61 vbox.show()
68 62
69 map_obj = Map(win) 63 map_obj = Map(win, zoom=2, size_hint_weight=EXPAND_BOTH,
70 map_obj.zoom = 2 64 size_hint_align=FILL_BOTH)
71 map_obj.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
72 map_obj.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
73 # map_obj.callback_clicked_add(cb_map_clicked) 65 # map_obj.callback_clicked_add(cb_map_clicked)
74 vbox.pack_end(map_obj) 66 vbox.pack_end(map_obj)
75 map_obj.show() 67 map_obj.show()
76 68
77 # view 69 # view
78 hbox = Box(win) 70 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
79 hbox.horizontal = True 71 size_hint_align=FILL_HORIZ)
80 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
81 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
82 vbox.pack_end(hbox) 72 vbox.pack_end(hbox)
83 hbox.show() 73 hbox.show()
84 74
85 bt = Button(win) 75 bt = Button(win, text="Zoom +")
86 bt.text = "Zoom +"
87 bt.callback_clicked_add(cb_btn_zoom, map_obj, 1) 76 bt.callback_clicked_add(cb_btn_zoom, map_obj, 1)
88 hbox.pack_end(bt) 77 hbox.pack_end(bt)
89 bt.show() 78 bt.show()
90 79
91 bt = Button(win) 80 bt = Button(win, text="Zoom -")
92 bt.text = "Zoom -"
93 bt.callback_clicked_add(cb_btn_zoom, map_obj, -1) 81 bt.callback_clicked_add(cb_btn_zoom, map_obj, -1)
94 hbox.pack_end(bt) 82 hbox.pack_end(bt)
95 bt.show() 83 bt.show()
96 84
97 sl = Slider(win) 85 sl = Slider(win, text="Rotation:", min_max=(0, 360), value=0,
98 sl.text = "Rotation:" 86 indicator_format="%3.0f")
99 sl.min_max = (0, 360)
100 sl.value = 0
101 sl.indicator_format = "%3.0f"
102 sl.callback_changed_add(cb_slider_rot, map_obj) 87 sl.callback_changed_add(cb_slider_rot, map_obj)
103 hbox.pack_end(sl) 88 hbox.pack_end(sl)
104 sl.show() 89 sl.show()
105 90
106 ho = Hoversel(win) 91 src_type = ELM_MAP_SOURCE_TYPE_TILE
107 ho.hover_parent_set(win) 92
108 type = elementary.ELM_MAP_SOURCE_TYPE_TILE 93 ho = Hoversel(win, hover_parent=win,
109 ho.text_set("Tiles: %s" % (map_obj.source_get(type))) 94 text="Tiles: %s" % (map_obj.source_get(src_type)))
110 for src in map_obj.sources_get(type): 95 for src in map_obj.sources_get(src_type):
111 ho.item_add(src) 96 ho.item_add(src)
112 ho.callback_selected_add(cb_hovsel_selected, map_obj, type) 97 ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type)
113 hbox.pack_end(ho) 98 hbox.pack_end(ho)
114 ho.show() 99 ho.show()
115 100
116 # show / bring in 101 # show / bring in
117 hbox = Box(win) 102 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
118 hbox.horizontal = True 103 size_hint_align=FILL_HORIZ)
119 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
120 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
121 vbox.pack_end(hbox) 104 vbox.pack_end(hbox)
122 hbox.show() 105 hbox.show()
123 106
124 bt = Button(win) 107 bt = Button(win, text="Show Sydney")
125 bt.text = "Show Sydney"
126 bt.callback_clicked_add(cb_btn_show, map_obj, 151.175274, -33.859126) 108 bt.callback_clicked_add(cb_btn_show, map_obj, 151.175274, -33.859126)
127 hbox.pack_end(bt) 109 hbox.pack_end(bt)
128 bt.show() 110 bt.show()
129 111
130 bt = Button(win) 112 bt = Button(win, text="Show Paris")
131 bt.text = "Show Paris"
132 bt.callback_clicked_add(cb_btn_show, map_obj, 2.342913, 48.853701) 113 bt.callback_clicked_add(cb_btn_show, map_obj, 2.342913, 48.853701)
133 hbox.pack_end(bt) 114 hbox.pack_end(bt)
134 bt.show() 115 bt.show()
135 116
136 bt = Button(win) 117 bt = Button(win, text="BringIn Sydney")
137 bt.text = "BringIn Sydney"
138 bt.callback_clicked_add(cb_btn_bringin, map_obj, 151.175274, -33.859126) 118 bt.callback_clicked_add(cb_btn_bringin, map_obj, 151.175274, -33.859126)
139 hbox.pack_end(bt) 119 hbox.pack_end(bt)
140 bt.show() 120 bt.show()
141 121
142 bt = Button(win) 122 bt = Button(win, text="BringIn Paris")
143 bt.text = "BringIn Paris"
144 bt.callback_clicked_add(cb_btn_bringin, map_obj, 2.342913, 48.853701) 123 bt.callback_clicked_add(cb_btn_bringin, map_obj, 2.342913, 48.853701)
145 hbox.pack_end(bt) 124 hbox.pack_end(bt)
146 bt.show() 125 bt.show()
147 126
148 hbox = Box(win) 127 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
149 hbox.horizontal = True 128 size_hint_align=FILL_HORIZ)
150 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
151 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
152 vbox.pack_end(hbox) 129 vbox.pack_end(hbox)
153 hbox.show() 130 hbox.show()
154 131
155 # options 132 # options
156 ck = Check(win) 133 ck = Check(win, text="wheel_disabled")
157 ck.text = "wheel_disabled"
158 ck.callback_changed_add(lambda bt: map_obj.wheel_disabled_set(bt.state)) 134 ck.callback_changed_add(lambda bt: map_obj.wheel_disabled_set(bt.state))
159 hbox.pack_end(ck) 135 hbox.pack_end(ck)
160 ck.show() 136 ck.show()
161 137
162 ck = Check(win) 138 ck = Check(win, text="paused")
163 ck.text = "paused"
164 ck.callback_changed_add(lambda bt: map_obj.paused_set(bt.state)) 139 ck.callback_changed_add(lambda bt: map_obj.paused_set(bt.state))
165 hbox.pack_end(ck) 140 hbox.pack_end(ck)
166 ck.show() 141 ck.show()
167 142
168 print_map_info(map_obj) 143 print_map_info(map_obj)
169 144
170 win.resize(600, 600)
171 win.show() 145 win.show()
172 146
173 147
diff --git a/examples/elementary/test_map2.py b/examples/elementary/test_map2.py
index 32624ee..8a677d5 100644
--- a/examples/elementary/test_map2.py
+++ b/examples/elementary/test_map2.py
@@ -2,11 +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
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.box import Box 10from efl.elementary.box import Box
11from efl.elementary.button import Button 11from efl.elementary.button import Button
12from efl.elementary.check import Check 12from efl.elementary.check import Check
@@ -23,7 +23,7 @@ from efl.elementary.icon import Icon
23# from efl.elementary.index import Index 23# from efl.elementary.index import Index
24# from efl.elementary.innerwindow import InnerWindow 24# from efl.elementary.innerwindow import InnerWindow
25# from efl.elementary.image import Image 25# from efl.elementary.image import Image
26from efl.elementary.map import Map 26from efl.elementary.map import Map, MapOverlayClass, ELM_MAP_OVERLAY_TYPE_CLASS
27# from efl.elementary.fileselector import Fileselector 27# from efl.elementary.fileselector import Fileselector
28# from efl.elementary.fileselector_button import FileselectorButton 28# from efl.elementary.fileselector_button import FileselectorButton
29# from efl.elementary.fileselector_entry import FileselectorEntry 29# from efl.elementary.fileselector_entry import FileselectorEntry
@@ -36,38 +36,46 @@ from efl.elementary.map import Map
36# from efl.elementary.table import Table 36# from efl.elementary.table import Table
37# from efl.elementary.flipselector import FlipSelector 37# from efl.elementary.flipselector import FlipSelector
38 38
39EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
40EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
41FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
42FILL_HORIZ = EVAS_HINT_FILL, 0.5
39 43
40def cb_btn_clear_overlays(bt, Map): 44script_path = os.path.dirname(os.path.abspath(__file__))
41 for ov in Map.overlays: 45img_path = os.path.join(script_path, "images")
46
47def cb_btn_clear_overlays(bt, m):
48 for ov in m.overlays:
42 print(ov, ov.type) 49 print(ov, ov.type)
43 if (ov.type != elementary.ELM_MAP_OVERLAY_TYPE_CLASS): 50 if (ov.type != ELM_MAP_OVERLAY_TYPE_CLASS):
44 ov.delete() 51 ov.delete()
45 52
46def cb_btn_ungroup_overlays(bt, Map): 53def cb_btn_ungroup_overlays(bt, m):
47 for ov in Map.overlays: 54 for ov in m.overlays:
48 if isinstance(ov, MapOverlayClass): 55 if isinstance(ov, MapOverlayClass):
49 print(ov) 56 print(ov)
50 # TODO ungroup instead 57 # TODO ungroup instead
51 for ov2 in ov.members: 58 for ov2 in ov.members:
52 ov.delete() 59 print("deleting ov")
60 ov2.delete()
53 61
54def cb_btn_show_overlays(bt, Map): 62def cb_btn_show_overlays(bt, m):
55 Map.overlays_show(Map.overlays) 63 m.overlays_show(m.overlays)
56 64
57def cb_chk_overlays_hidden(ck, Map): 65def cb_chk_overlays_hidden(ck, m):
58 for ov in Map.overlays: 66 for ov in m.overlays:
59 ov.hide = ck.state 67 ov.hide = ck.state
60 68
61def cb_chk_overlays_paused(ck, Map): 69def cb_chk_overlays_paused(ck, m):
62 for ov in Map.overlays: 70 for ov in m.overlays:
63 ov.paused = ck.state 71 ov.paused = ck.state
64 72
65def cb_overlay_clicked(Map, ov): 73def cb_overlay_clicked(m, ov):
66 ov.delete() 74 ov.delete()
67 75
68def cb_ctx_overlay_add(li, item, Map, lon, lat, min_zoom = 0, icon = None): 76def cb_ctx_overlay_add(li, item, m, lon, lat, min_zoom = 0, icon = None):
69 item.widget_get().dismiss() 77 item.widget.dismiss()
70 ov = Map.overlay_add(lon, lat) 78 ov = m.overlay_add(lon, lat)
71 if min_zoom > 0: 79 if min_zoom > 0:
72 ov.displayed_zoom_min = min_zoom 80 ov.displayed_zoom_min = min_zoom
73 if icon: 81 if icon:
@@ -75,162 +83,140 @@ def cb_ctx_overlay_add(li, item, Map, lon, lat, min_zoom = 0, icon = None):
75 83
76 ov.callback_clicked_set(cb_overlay_clicked) 84 ov.callback_clicked_set(cb_overlay_clicked)
77 85
78def cb_ctx_overlay_add_custom(li, item, Map, lon, lat): 86def cb_ctx_overlay_add_custom(li, item, m, lon, lat):
79 item.widget_get().dismiss() 87 item.widget.dismiss()
80 cont = Icon(Map) 88 cont = Icon(m, file=os.path.join(img_path, "sky_01.jpg"),
81 cont.file_set("images/sky_01.jpg") 89 size_hint_min=(50, 50))
82 cont.size_hint_min = (50, 50)
83 cont.show() 90 cont.show()
84 ov = Map.overlay_add(lon, lat) 91 ov = m.overlay_add(lon, lat)
85 ov.content = cont 92 ov.content = cont
86 93
87def cb_ctx_overlay_add_random_color(li, item, Map, lon, lat): 94def cb_ctx_overlay_add_random_color(li, item, m, lon, lat):
88 item.widget_get().dismiss() 95 item.widget.dismiss()
89 ov = Map.overlay_add(lon, lat) 96 ov = m.overlay_add(lon, lat)
90 ov.color = (random.randint(0, 255), random.randint(0, 255), 97 ov.color = (random.randint(0, 255), random.randint(0, 255),
91 random.randint(0, 255), 200) 98 random.randint(0, 255), 200)
92 99
93def cb_ctx_overlay_grouped(li, item, Map, lon, lat, sx, sy): 100def cb_ctx_overlay_grouped(li, item, m, lon, lat, sx, sy):
94 item.widget_get().dismiss() 101 item.widget.dismiss()
95 cls = Map.overlay_class_add() 102 cls = m.overlay_class_add()
96 for x in range(4): 103 for x in range(4):
97 for y in range(4): 104 for y in range(4):
98 (lon, lat) = Map.canvas_to_region_convert(sx + x * 10, sy + y * 10) 105 (lon, lat) = m.canvas_to_region_convert(sx + x * 10, sy + y * 10)
99 ov = Map.overlay_add(lon, lat) 106 ov = m.overlay_add(lon, lat)
100 cls.append(ov) 107 cls.append(ov)
101 108
102def cb_ctx_overlay_bubble(li, item, Map, lon, lat): 109def cb_ctx_overlay_bubble(li, item, m, lon, lat):
103 item.widget_get().dismiss() 110 item.widget.dismiss()
104 111
105 ov = Map.overlay_add(lon, lat) 112 ov = m.overlay_add(lon, lat)
106 bub = Map.overlay_bubble_add() 113 bub = m.overlay_bubble_add()
107 bub.follow(ov) 114 bub.follow(ov)
108 115
109 lb = Label(Map) 116 lb = Label(m, text="You can push contents here")
110 lb.text = "You can push contents here"
111 bub.content_append(lb) 117 bub.content_append(lb)
112 lb.show() 118 lb.show()
113 119
114 ic = Icon(Map) 120 ic = Icon(m, file=os.path.join(img_path, "sky_01.jpg"),
115 ic.file_set("images/sky_01.jpg") 121 size_hint_min=(50, 50))
116 ic.size_hint_min = (50, 50)
117 bub.content_append(ic) 122 bub.content_append(ic)
118 ic.show() 123 ic.show()
119 124
120 bt = Button(Map) 125 bt = Button(m, text="clear me")
121 bt.text = "clear me"
122 bt.callback_clicked_add(lambda bt:bub.content_clear()) 126 bt.callback_clicked_add(lambda bt:bub.content_clear())
123 bub.content_append(bt) 127 bub.content_append(bt)
124 bt.show() 128 bt.show()
125 129
126def cb_ctx_overlay_line(li, item, Map, lon, lat): 130def cb_ctx_overlay_line(li, item, m, lon, lat):
127 item.widget_get().dismiss() 131 item.widget.dismiss()
128 line = Map.overlay_line_add(lon, lat, lon + 1, lat + 1) 132 line = m.overlay_line_add(lon, lat, lon + 1, lat + 1)
129 133
130def cb_ctx_overlay_polygon(li, item, Map, lon, lat): 134def cb_ctx_overlay_polygon(li, item, m, lon, lat):
131 item.widget_get().dismiss() 135 item.widget.dismiss()
132 poly = Map.overlay_polygon_add() 136 poly = m.overlay_polygon_add()
133 poly.region_add(lon, lat) 137 poly.region_add(lon, lat)
134 poly.region_add(lon + 1, lat + 1) 138 poly.region_add(lon + 1, lat + 1)
135 poly.region_add(lon + 1, lat - 1) 139 poly.region_add(lon + 1, lat - 1)
136 poly.region_add(lon - 1, lat) 140 poly.region_add(lon - 1, lat)
137 141
138def cb_ctx_overlay_circle(li, item, Map, lon, lat, radius): 142def cb_ctx_overlay_circle(li, item, m, lon, lat, radius):
139 item.widget_get().dismiss() 143 item.widget.dismiss()
140 Map.overlay_circle_add(lon, lat, radius) 144 m.overlay_circle_add(lon, lat, radius)
141 145
142def cb_ctx_overlay_scale(li, item, Map, x, y): 146def cb_ctx_overlay_scale(li, item, m, x, y):
143 item.widget_get().dismiss() 147 item.widget.dismiss()
144 Map.overlay_scale_add(x, y) 148 m.overlay_scale_add(x, y)
145 149
146def test(li, item, Map, lon, lat): 150def test(li, item, m, lon, lat):
147 print(li) 151 print(li)
148 print(item) 152 print(item)
149 print(Map) 153 print(m)
150 # ctx.dismiss() 154 # ctx.dismiss()
151 ov = Map.overlay_add(lon, lat) 155 ov = m.overlay_add(lon, lat)
152 156
153def cb_map_clicked(Map): 157def cb_map_clicked(m):
154 (x, y) = Map.evas.pointer_canvas_xy_get() 158 (x, y) = m.evas.pointer_canvas_xy_get()
155 (lon, lat) = Map.canvas_to_region_convert(x, y) 159 (lon, lat) = m.canvas_to_region_convert(x, y)
156 cp = Ctxpopup(Map) 160 cp = Ctxpopup(m)
157 cp.item_append("%f %f" % (lon, lat), None, None).disabled = True 161 cp.item_append("%f %f" % (lon, lat), None, None).disabled = True
158 cp.item_append("Add Overlay here", None, cb_ctx_overlay_add, Map, lon, lat) 162 cp.item_append("Add Overlay here", None, cb_ctx_overlay_add, m, lon, lat)
159 ic = Icon(Map) 163 ic = Icon(m, file=os.path.join(img_path, "logo.png"))
160 ic.file_set("images/logo.png") 164 cp.item_append("Add Overlay with icon", None, cb_ctx_overlay_add, m, lon, lat, 0, ic)
161 cp.item_append("Add Overlay with icon", None, cb_ctx_overlay_add, Map, lon, lat, 0, ic) 165 cp.item_append("Add Overlay custom content", None, cb_ctx_overlay_add_custom, m, lon, lat)
162 cp.item_append("Add Overlay custom content", None, cb_ctx_overlay_add_custom, Map, lon, lat) 166 cp.item_append("Add Overlay random color", None, cb_ctx_overlay_add_random_color, m, lon, lat)
163 cp.item_append("Add Overlay random color", None, cb_ctx_overlay_add_random_color, Map, lon, lat) 167 cp.item_append("Add Overlay (min zoom 4)", None, cb_ctx_overlay_add, m, lon, lat, 4)
164 cp.item_append("Add Overlay (min zoom 4)", None, cb_ctx_overlay_add, Map, lon, lat, 4) 168 cp.item_append("Add 16 Grouped Overlays", None, cb_ctx_overlay_grouped, m, lon, lat, x, y)
165 cp.item_append("Add 16 Grouped Overlays", None, cb_ctx_overlay_grouped, Map, lon, lat, x, y) 169 cp.item_append("Add one with a bubble attached", None, cb_ctx_overlay_bubble, m, lon, lat)
166 cp.item_append("Add one with a bubble attached", None, cb_ctx_overlay_bubble, Map, lon, lat) 170 cp.item_append("Add an Overlay Line", None, cb_ctx_overlay_line, m, lon, lat)
167 cp.item_append("Add an Overlay Line", None, cb_ctx_overlay_line, Map, lon, lat) 171 cp.item_append("Add an Overlay Polygon", None, cb_ctx_overlay_polygon, m, lon, lat)
168 cp.item_append("Add an Overlay Polygon", None, cb_ctx_overlay_polygon, Map, lon, lat) 172 cp.item_append("Add an Overlay Circle", None, cb_ctx_overlay_circle, m, lon, lat, 10)
169 cp.item_append("Add an Overlay Circle", None, cb_ctx_overlay_circle, Map, lon, lat, 10) 173 cp.item_append("Add an Overlay Scale", None, cb_ctx_overlay_scale, m, x, y)
170 cp.item_append("Add an Overlay Scale", None, cb_ctx_overlay_scale, Map, x, y)
171 cp.move(x, y) 174 cp.move(x, y)
172 cp.show() 175 cp.show()
173 176
174def map_overlays_clicked(obj): 177def map_overlays_clicked(obj):
175 win = Window("map2", elementary.ELM_WIN_BASIC) 178 win = StandardWindow("map2", "Map Overlay test", autodel=True,
176 win.title = "Map Overlay test" 179 size=(600, 600))
177 win.autodel = True
178 if obj is None: 180 if obj is None:
179 win.callback_delete_request_add(lambda o: elementary.exit()) 181 win.callback_delete_request_add(lambda o: elementary.exit())
180 182
181 bg = Background(win) 183 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
182 win.resize_object_add(bg)
183 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
184 bg.show()
185
186 vbox = Box(win)
187 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
188 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
189 win.resize_object_add(vbox) 184 win.resize_object_add(vbox)
190 vbox.show() 185 vbox.show()
191 186
192 map_obj = Map(win) 187 map_obj = Map(win, zoom=2, size_hint_weight=EXPAND_BOTH,
193 map_obj.zoom = 2 188 size_hint_align=FILL_BOTH)
194 map_obj.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
195 map_obj.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
196 map_obj.callback_clicked_add(cb_map_clicked) 189 map_obj.callback_clicked_add(cb_map_clicked)
197 vbox.pack_end(map_obj) 190 vbox.pack_end(map_obj)
198 map_obj.show() 191 map_obj.show()
199 192
200 # overlays 193 # overlays
201 hbox = Box(win) 194 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
202 hbox.horizontal = True 195 size_hint_align=FILL_HORIZ)
203 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
204 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
205 vbox.pack_end(hbox) 196 vbox.pack_end(hbox)
206 hbox.show() 197 hbox.show()
207 198
208 ck = Check(win) 199 ck = Check(win, text="overlays hidden")
209 ck.text = "overlays hidden"
210 ck.callback_changed_add(cb_chk_overlays_hidden, map_obj) 200 ck.callback_changed_add(cb_chk_overlays_hidden, map_obj)
211 hbox.pack_end(ck) 201 hbox.pack_end(ck)
212 ck.show() 202 ck.show()
213 203
214 ck = Check(win) 204 ck = Check(win, text="overlays paused")
215 ck.text = "overlays paused"
216 ck.callback_changed_add(cb_chk_overlays_paused, map_obj) 205 ck.callback_changed_add(cb_chk_overlays_paused, map_obj)
217 hbox.pack_end(ck) 206 hbox.pack_end(ck)
218 ck.show() 207 ck.show()
219 208
220 bt = Button(win) 209 bt = Button(win, text="clear overlays")
221 bt.text = "clear overlays"
222 bt.callback_clicked_add(cb_btn_clear_overlays, map_obj) 210 bt.callback_clicked_add(cb_btn_clear_overlays, map_obj)
223 hbox.pack_end(bt) 211 hbox.pack_end(bt)
224 bt.show() 212 bt.show()
225 213
226 bt = Button(win) 214 bt = Button(win, text="ungroup (BROKEN)")
227 bt.text = "ungroup (BROKEN)"
228 bt.callback_clicked_add(cb_btn_ungroup_overlays, map_obj) 215 bt.callback_clicked_add(cb_btn_ungroup_overlays, map_obj)
229 hbox.pack_end(bt) 216 hbox.pack_end(bt)
230 bt.show() 217 bt.show()
231 218
232 bt = Button(win) 219 bt = Button(win, text="overlays_show()")
233 bt.text = "overlays_show()"
234 bt.callback_clicked_add(cb_btn_show_overlays, map_obj) 220 bt.callback_clicked_add(cb_btn_show_overlays, map_obj)
235 hbox.pack_end(bt) 221 hbox.pack_end(bt)
236 bt.show() 222 bt.show()
diff --git a/examples/elementary/test_map3.py b/examples/elementary/test_map3.py
index f853b4c..1529510 100644
--- a/examples/elementary/test_map3.py
+++ b/examples/elementary/test_map3.py
@@ -1,154 +1,149 @@
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 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.ctxpopup import Ctxpopup 9from efl.elementary.ctxpopup import Ctxpopup
11from efl.elementary.entry import Entry 10from efl.elementary.entry import Entry
12from efl.elementary.hoversel import Hoversel 11from efl.elementary.hoversel import Hoversel
13from efl.elementary.label import Label 12from efl.elementary.label import Label
14from efl.elementary.map import Map 13from efl.elementary.map import Map, ELM_MAP_ROUTE_TYPE_MOTOCAR, \
14 ELM_MAP_ROUTE_METHOD_FASTEST, ELM_MAP_SOURCE_TYPE_ROUTE, \
15 ELM_MAP_SOURCE_TYPE_NAME
15from efl.elementary.separator import Separator 16from efl.elementary.separator import Separator
16 17
18EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
19EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
20FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
21FILL_HORIZ = EVAS_HINT_FILL, 0.5
17 22
18_from = None 23_from = None
19_to = None 24_to = None
20 25
21 26
22def cb_btn_goto(bt, Map): 27def cb_btn_goto(bt, m):
23 Map.zoom = 12 28 m.zoom = 12
24 Map.region_show(9.204, 45.446) 29 m.region_show(9.204, 45.446)
25 30
26def cb_ctx_set_from(ctx, item, Map, lon, lat): 31def cb_ctx_set_from(ctx, item, m, lon, lat):
27 global _from 32 global _from
28 33
29 ctx.dismiss() 34 ctx.dismiss()
30 if _from is None: 35 if _from is None:
31 _from = Map.overlay_add(lon, lat) 36 _from = m.overlay_add(lon, lat)
32 _from.color = (150, 0, 0, 150) 37 _from.color = (150, 0, 0, 150)
33 else: 38 else:
34 _from.region = (lon, lat) 39 _from.region = (lon, lat)
35 40
36def cb_ctx_set_to(ctx, item, Map, lon, lat): 41def cb_ctx_set_to(ctx, item, m, lon, lat):
37 global _to 42 global _to
38 43
39 ctx.dismiss() 44 ctx.dismiss()
40 if _to is None: 45 if _to is None:
41 _to = Map.overlay_add(lon, lat) 46 _to = m.overlay_add(lon, lat)
42 _to.color = (0, 0, 150, 150) 47 _to.color = (0, 0, 150, 150)
43 else: 48 else:
44 _to.region = (lon, lat) 49 _to.region = (lon, lat)
45 50
46def cb_btn_calc_route(bt, Map): 51def cb_btn_calc_route(bt, m):
47 if not (_from and _to): 52 if not (_from and _to):
48 return 53 return
49 54
50 (flon, flat) = _from.region 55 (flon, flat) = _from.region
51 (tlon, tlat) = _to.region 56 (tlon, tlat) = _to.region
52 Map.route_add(elementary.ELM_MAP_ROUTE_TYPE_MOTOCAR, 57 m.route_add(ELM_MAP_ROUTE_TYPE_MOTOCAR,
53 elementary.ELM_MAP_ROUTE_METHOD_FASTEST, 58 ELM_MAP_ROUTE_METHOD_FASTEST,
54 flon, flat, tlon, tlat, cb_route) 59 flon, flat, tlon, tlat, cb_route)
55 60
56 lb = Map.data["lb_distance"] 61 lb = m.data["lb_distance"]
57 lb.text = "requesting route..." 62 lb.text = "requesting route..."
58 63
59def cb_btn_search_name(bt, Map, en): 64def cb_btn_search_name(bt, m, en):
60 Map.name_add(en.text, 0, 0, cb_search_name, en) 65 m.name_add(en.text, 0, 0, cb_search_name, en)
61 en.text = "searching..." 66 en.text = "searching..."
62 67
63def cb_search_name(Map, name, en): 68def cb_search_name(m, name, en):
64 global _from 69 global _from
65 70
66 en.text = name.address 71 en.text = name.address
67 (lon, lat) = name.region 72 (lon, lat) = name.region
68 Map.zoom = 12 73 m.zoom = 12
69 Map.region_show(lon, lat) 74 m.region_show(lon, lat)
70 75
71 if _from is None: 76 if _from is None:
72 _from = Map.overlay_add(lon, lat) 77 _from = m.overlay_add(lon, lat)
73 _from.color = (150, 0, 0, 150) 78 _from.color = (150, 0, 0, 150)
74 else: 79 else:
75 _from.region = (lon, lat) 80 _from.region = (lon, lat)
76 81
77def cb_btn_search_region(bt, Map, en): 82def cb_btn_search_region(bt, m, en):
78 if _from is None: 83 if _from is None:
79 return 84 return
80 (lon, lat) = _from.region 85 (lon, lat) = _from.region
81 Map.name_add(None, lon, lat, cb_search_region, en) 86 m.name_add(None, lon, lat, cb_search_region, en)
82 en.text = "searching..." 87 en.text = "searching..."
83 88
84def cb_search_region(Map, name, en): 89def cb_search_region(m, name, en):
85 global _name 90 global _name
86 91
87 en.text = name.address 92 en.text = name.address
88 93
89def cb_route(Map, route): 94def cb_route(m, route):
90 nodes = route.node.count('\n') 95 nodes = route.node.count('\n')
91 lb = Map.data["lb_distance"] 96 lb = m.data["lb_distance"]
92 lb.text = "distance: %.2f Km nodes:%d" % (route.distance, nodes) 97 lb.text = "distance: %.2f Km nodes:%d" % (route.distance, nodes)
93 98
94 ov = Map.overlay_route_add(route) 99 ov = m.overlay_route_add(route)
95 100
96 print("Node: %s" % (route.node)) 101 print("Node: %s" % (route.node))
97 print("Waypoint %s" % (route.waypoint)) 102 print("Waypoint %s" % (route.waypoint))
98 103
99def cb_btn_clear_overlays(btn, Map): 104def cb_btn_clear_overlays(btn, m):
100 for ov in Map.overlays: 105 for ov in m.overlays:
101 if ov != _from and ov != _to: 106 if ov != _from and ov != _to:
102 ov.delete() 107 ov.delete()
103 108
104def cb_map_clicked(Map): 109def cb_map_clicked(m):
105 (x, y) = Map.evas.pointer_canvas_xy_get() 110 (x, y) = m.evas.pointer_canvas_xy_get()
106 (lon, lat) = Map.canvas_to_region_convert(x, y) 111 (lon, lat) = m.canvas_to_region_convert(x, y)
107 cp = Ctxpopup(Map) 112 cp = Ctxpopup(m)
108 cp.item_append("%f %f" % (lon, lat)).disabled = True 113 cp.item_append("%f %f" % (lon, lat)).disabled = True
109 cp.item_append("Set start point", None, cb_ctx_set_from, Map, lon, lat) 114 cp.item_append("Set start point", None, cb_ctx_set_from, m, lon, lat)
110 cp.item_append("Set end point", None, cb_ctx_set_to, Map, lon, lat) 115 cp.item_append("Set end point", None, cb_ctx_set_to, m, lon, lat)
111 cp.move(x, y) 116 cp.move(x, y)
112 cp.show() 117 cp.show()
113 118
114def cb_map_load(Map): 119def cb_map_load(m):
115 lb = Map.data["lb_load_status"] 120 lb = m.data["lb_load_status"]
116 lb.text = "tile_load_status: %d / %d" % Map.tile_load_status_get() 121 status = m.tile_load_status
122 lb.text = "tile_load_status: %d / %d" % (status[1], status[0])
117 123
118def cb_hovsel_selected(hov, item, Map, type, name): 124def cb_hovsel_selected(hov, item, m, type, name):
119 Map.source_set(type, item.text) 125 m.source_set(type, item.text)
120 hov.text = "%s: %s" % (name, item.text) 126 hov.text = "%s: %s" % (name, item.text)
121 127
122def map_route_clicked(obj): 128def map_route_clicked(obj):
123 win = Window("maproute", elementary.ELM_WIN_BASIC) 129 win = StandardWindow("maproute", "Map Route test", autodel=True,
124 win.title = "Map Route test" 130 size=(600, 600))
125 win.autodel = True
126 if obj is None: 131 if obj is None:
127 win.callback_delete_request_add(lambda o: elementary.exit()) 132 win.callback_delete_request_add(lambda o: elementary.exit())
128 133
129 bg = Background(win) 134 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
130 win.resize_object_add(bg)
131 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
132 bg.show()
133
134 vbox = Box(win)
135 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
136 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
137 win.resize_object_add(vbox) 135 win.resize_object_add(vbox)
138 vbox.show() 136 vbox.show()
139 137
140 map_obj = Map(win) 138 map_obj = Map(win, zoom=2, size_hint_weight=EXPAND_BOTH,
141 map_obj.zoom = 2 139 size_hint_align=FILL_BOTH)
142 map_obj.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
143 map_obj.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
144 map_obj.callback_clicked_add(cb_map_clicked) 140 map_obj.callback_clicked_add(cb_map_clicked)
145 map_obj.callback_tile_load_add(cb_map_load) 141 map_obj.callback_tile_load_add(cb_map_load)
146 map_obj.callback_tile_loaded_add(cb_map_load) 142 map_obj.callback_tile_loaded_add(cb_map_load)
147 vbox.pack_end(map_obj) 143 vbox.pack_end(map_obj)
148 map_obj.show() 144 map_obj.show()
149 145
150 lb = Label(win) 146 lb = Label(win, text="load_status: 0 / 0")
151 lb.text = "load_status: 0 / 0"
152 vbox.pack_end(lb) 147 vbox.pack_end(lb)
153 lb.show() 148 lb.show()
154 map_obj.data["lb_load_status"] = lb 149 map_obj.data["lb_load_status"] = lb
@@ -160,104 +155,85 @@ def map_route_clicked(obj):
160 map_obj.data["lb_distance"] = lb 155 map_obj.data["lb_distance"] = lb
161 156
162 # info 157 # info
163 hbox = Box(win) 158 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
164 hbox.horizontal = True 159 size_hint_align=FILL_HORIZ)
165 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
166 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
167 vbox.pack_end(hbox) 160 vbox.pack_end(hbox)
168 hbox.show() 161 hbox.show()
169 162
170 # route 163 # route
171 ho = Hoversel(win) 164 src_type = ELM_MAP_SOURCE_TYPE_ROUTE
172 ho.hover_parent_set(win) 165
173 type = elementary.ELM_MAP_SOURCE_TYPE_ROUTE 166 ho = Hoversel(win, hover_parent=win,
174 ho.text_set("Routes: %s" % (map_obj.source_get(type))) 167 text="Routes: %s" % (map_obj.source_get(src_type)))
175 for src in map_obj.sources_get(type): 168 for src in map_obj.sources_get(src_type):
176 ho.item_add(src) 169 ho.item_add(src)
177 ho.callback_selected_add(cb_hovsel_selected, map_obj, type, "Routes") 170 ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Routes")
178 hbox.pack_end(ho) 171 hbox.pack_end(ho)
179 ho.show() 172 ho.show()
180 173
181 sep = Separator(win) 174 sep = Separator(win)
182 sep.show() 175 sep.show()
183 hbox.pack_end(sep) 176 hbox.pack_end(sep)
184 177
185 bt = Button(win) 178 bt = Button(win, text="GOTO")
186 bt.text = "GOTO"
187 bt.callback_clicked_add(cb_btn_goto, map_obj) 179 bt.callback_clicked_add(cb_btn_goto, map_obj)
188 hbox.pack_end(bt) 180 hbox.pack_end(bt)
189 bt.show() 181 bt.show()
190 182
191 bt = Button(win) 183 bt = Button(win, text="Calc Route !")
192 bt.text = "Calc Route !"
193 bt.callback_clicked_add(cb_btn_calc_route, map_obj) 184 bt.callback_clicked_add(cb_btn_calc_route, map_obj)
194 hbox.pack_end(bt) 185 hbox.pack_end(bt)
195 bt.show() 186 bt.show()
196 187
197 bt = Button(win) 188 bt = Button(win, text="clear route overlays")
198 bt.text = "clear route overlays"
199 bt.callback_clicked_add(cb_btn_clear_overlays, map_obj) 189 bt.callback_clicked_add(cb_btn_clear_overlays, map_obj)
200 hbox.pack_end(bt) 190 hbox.pack_end(bt)
201 bt.show() 191 bt.show()
202 192
203 # names 193 # names
204 hbox = Box(win) 194 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
205 hbox.horizontal = True 195 size_hint_align=FILL_HORIZ)
206 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
207 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
208 vbox.pack_end(hbox) 196 vbox.pack_end(hbox)
209 hbox.show() 197 hbox.show()
210 198
211 ho = Hoversel(win) 199 src_type = ELM_MAP_SOURCE_TYPE_NAME
212 ho.hover_parent_set(win) 200
213 type = elementary.ELM_MAP_SOURCE_TYPE_NAME 201 ho = Hoversel(win, hover_parent=win,
214 ho.text_set("Names: %s" % (map_obj.source_get(type))) 202 text="Names: %s" % (map_obj.source_get(src_type)))
215 for src in map_obj.sources_get(type): 203 for src in map_obj.sources_get(src_type):
216 ho.item_add(src) 204 ho.item_add(src)
217 ho.callback_selected_add(cb_hovsel_selected, map_obj, type, "Names") 205 ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Names")
218 hbox.pack_end(ho) 206 hbox.pack_end(ho)
219 ho.show() 207 ho.show()
220 208
221 en = Entry(win) 209 en = Entry(win, scrollable=True, text="type an address here",
222 en.scrollable = True 210 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
223 # en.single_line = True 211 # en.single_line = True
224 en.text = "type an address here"
225 en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
226 en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
227 hbox.pack_end(en) 212 hbox.pack_end(en)
228 en.show() 213 en.show()
229 214
230 bt = Button(win) 215 bt = Button(win, text="Search Address !")
231 bt.text = "Search Address !"
232 bt.callback_clicked_add(cb_btn_search_name, map_obj, en) 216 bt.callback_clicked_add(cb_btn_search_name, map_obj, en)
233 hbox.pack_end(bt) 217 hbox.pack_end(bt)
234 bt.show() 218 bt.show()
235 219
236 hbox = Box(win) 220 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
237 hbox.horizontal = True 221 size_hint_align=FILL_HORIZ)
238 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
239 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
240 vbox.pack_end(hbox) 222 vbox.pack_end(hbox)
241 hbox.show() 223 hbox.show()
242 224
243 en = Entry(win) 225 en = Entry(win, scrollable=True, disabled=True,
244 en.scrollable = True 226 text="place the start point and press the button",
227 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
245 # en.single_line = True 228 # en.single_line = True
246 en.disabled = True
247 en.text = "place the start point and press the button"
248 en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
249 en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
250 hbox.pack_end(en) 229 hbox.pack_end(en)
251 en.show() 230 en.show()
252 231
253 bt = Button(win) 232 bt = Button(win, text="Search start point Region")
254 bt.text = "Search start point Region"
255 bt.callback_clicked_add(cb_btn_search_region, map_obj, en) 233 bt.callback_clicked_add(cb_btn_search_region, map_obj, en)
256 hbox.pack_start(bt) 234 hbox.pack_start(bt)
257 bt.show() 235 bt.show()
258 236
259
260 win.resize(600, 600)
261 win.show() 237 win.show()
262 238
263 239
diff --git a/examples/elementary/test_mapbuf.py b/examples/elementary/test_mapbuf.py
index 495796c..4577854 100644
--- a/examples/elementary/test_mapbuf.py
+++ b/examples/elementary/test_mapbuf.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, Rectangle
5from efl import elementary 7from efl import elementary
6from efl.elementary.window import Window 8from efl.elementary.window import 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
@@ -11,9 +13,19 @@ from efl.elementary.check import Check
11from efl.elementary.label import Label 13from efl.elementary.label import Label
12from efl.elementary.icon import Icon 14from efl.elementary.icon import Icon
13from efl.elementary.mapbuf import Mapbuf 15from efl.elementary.mapbuf import Mapbuf
14from efl.elementary.scroller import Scroller 16from efl.elementary.scroller import Scroller, ELM_SCROLLER_POLICY_OFF
15from efl.elementary.table import Table 17from efl.elementary.table import Table
16 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
23ALIGN_CENTER = 0.5, 0.5
24
25SCROLL_POLICY_OFF = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
26
27script_path = os.path.dirname(os.path.abspath(__file__))
28img_path = os.path.join(script_path, "images")
17 29
18names = [ "Hello", "World", "Spam", "Egg", "Ham", "Good", "Bad", "Milk", 30names = [ "Hello", "World", "Spam", "Egg", "Ham", "Good", "Bad", "Milk",
19 "Smell", "Of", "Sky", "Gold", "Hole", "Pig", "And", "Calm"] 31 "Smell", "Of", "Sky", "Gold", "Hole", "Pig", "And", "Calm"]
@@ -23,115 +35,96 @@ mb_list = []
23def cb_btn_close(btn, win): 35def cb_btn_close(btn, win):
24 win.delete() 36 win.delete()
25 elementary.exit() 37 elementary.exit()
26 38
27def cb_ck_map(ck): 39def cb_ck_map(ck):
28 for mb in mb_list: 40 for mb in mb_list:
29 mb.enabled = ck.state 41 mb.enabled = ck.state
30 42
31def cb_ck_alpha(ck): 43def cb_ck_alpha(ck):
32 for mb in mb_list: 44 for mb in mb_list:
33 mb.alpha = ck.state 45 mb.alpha = ck.state
34 46
35def cb_ck_smooth(ck): 47def cb_ck_smooth(ck):
36 for mb in mb_list: 48 for mb in mb_list:
37 mb.smooth = ck.state 49 mb.smooth = ck.state
38 50
39def cb_ck_fs(ck, win): 51def cb_ck_fs(ck, win):
40 win.fullscreen = ck.state 52 win.fullscreen = ck.state
41 53
42def mapbuf_clicked(obj, item=None): 54def mapbuf_clicked(obj, item=None):
43 global mb_list 55 global mb_list
44 56
45 win = Window("mapbuf", elementary.ELM_WIN_BASIC) 57 win = Window("mapbuf", ELM_WIN_BASIC, title="Mapbuf test", autodel=True,
46 win.title_set("Mapbuf test") 58 size=(480, 600))
47 win.autodel_set(True)
48 if obj is None: 59 if obj is None:
49 win.callback_delete_request_add(lambda o: elementary.exit()) 60 win.callback_delete_request_add(lambda o: elementary.exit())
50 61
51 bg = Background(win) 62 bg = Background(win, file=os.path.join(img_path, "sky_04.jpg"),
52 bg.file = "images/sky_04.jpg" 63 size_hint_weight=EXPAND_BOTH)
53 win.resize_object_add(bg) 64 win.resize_object_add(bg)
54 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
55 bg.show() 65 bg.show()
56 66
57 vbox = Box(win) 67 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
58 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
59 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
60 win.resize_object_add(vbox) 68 win.resize_object_add(vbox)
61 vbox.show() 69 vbox.show()
62 70
63 # launcher 71 # launcher
64 sc = Scroller(win); 72 sc = Scroller(win, bounce=(True, False), policy=SCROLL_POLICY_OFF,
65 sc.bounce = (True, False) 73 size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
66 sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_OFF)
67 sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
68 sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
69 vbox.pack_end(sc) 74 vbox.pack_end(sc)
70 75
71 bx = Box(win) 76 bx = Box(win, horizontal=True, homogeneous=True)
72 bx.horizontal = True
73 bx.homogeneous = True
74 bx.show() 77 bx.show()
75 78
76 for k in range(8): 79 for k in range(8):
77 tb = Table(win) 80 tb = Table(win, size_hint_align=ALIGN_CENTER,
78 tb.size_hint_align = (0.5, 0.5) 81 size_hint_weight=(0.0, 0.0))
79 tb.size_hint_weight = (0.0, 0.0)
80 tb.show() 82 tb.show()
81 83
82 pad = evas.Rectangle(win.evas) 84 pad = Rectangle(win.evas, color=(255, 255, 0, 255))
83 pad.color = (255, 255, 0, 255)
84 pad.size_hint_min = (464, 4) 85 pad.size_hint_min = (464, 4)
85 pad.size_hint_weight = (0.0, 0.0) 86 pad.size_hint_weight = (0.0, 0.0)
86 pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 87 pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
87 pad.show() 88 pad.show()
88 tb.pack(pad, 1, 0, 5, 1) 89 tb.pack(pad, 1, 0, 5, 1)
89 90
90 pad = evas.Rectangle(win.evas) 91 pad = Rectangle(win.evas, color=(255, 255, 0, 255))
91 pad.color = (255, 255, 0, 255)
92 pad.size_hint_min = (464, 4) 92 pad.size_hint_min = (464, 4)
93 pad.size_hint_weight = (0.0, 0.0) 93 pad.size_hint_weight = (0.0, 0.0)
94 pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 94 pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
95 pad.show() 95 pad.show()
96 tb.pack(pad, 1, 11, 5, 1) 96 tb.pack(pad, 1, 11, 5, 1)
97 97
98 pad = evas.Rectangle(win.evas) 98 pad = Rectangle(win.evas, color=(255, 255, 0, 255))
99 pad.color = (255, 255, 0, 255)
100 pad.size_hint_min = (4, 4) 99 pad.size_hint_min = (4, 4)
101 pad.size_hint_weight = (0.0, 0.0) 100 pad.size_hint_weight = (0.0, 0.0)
102 pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 101 pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
103 pad.show() 102 pad.show()
104 tb.pack(pad, 0, 1, 1, 10) 103 tb.pack(pad, 0, 1, 1, 10)
105 104
106 pad = evas.Rectangle(win.evas) 105 pad = Rectangle(win.evas, color=(255, 255, 0, 255))
107 pad.color = (255, 255, 0, 255)
108 pad.size_hint_min = (4, 4) 106 pad.size_hint_min = (4, 4)
109 pad.size_hint_weight = (0.0, 0.0) 107 pad.size_hint_weight = (0.0, 0.0)
110 pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 108 pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
111 pad.show() 109 pad.show()
112 tb.pack(pad, 6, 1, 1, 10) 110 tb.pack(pad, 6, 1, 1, 10)
113 111
114 mb = Mapbuf(win) 112 mb = Mapbuf(win, content=tb)
115 mb_list.append(mb) 113 mb_list.append(mb)
116 mb.content = tb
117 bx.pack_end(mb) 114 bx.pack_end(mb)
118 mb.show() 115 mb.show()
119 116
120 n = m = 0 117 n = m = 0
121 for j in range(5): 118 for j in range(5):
122 for i in range(5): 119 for i in range(5):
123 ic = Icon(win) 120 ic = Icon(win, scale=0.5,
124 ic.scale_set(0.5) 121 file=os.path.join(img_path, "icon_%02d.png" % (n)),
125 ic.file_set("images/icon_%02d.png" % (n)); 122 resizable=(False, False), size_hint_weight=EXPAND_BOTH,
126 ic.resizable_set(0, 0) 123 size_hint_align=ALIGN_CENTER)
127 ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
128 ic.size_hint_align_set(0.5, 0.5)
129 tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1) 124 tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
130 ic.show() 125 ic.show()
131 126
132 lb = Label(win) 127 lb = Label(win, style="marker", text=names[m])
133 lb.style = "marker"
134 lb.text = names[m]
135 tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1) 128 tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
136 lb.show() 129 lb.show()
137 130
@@ -143,51 +136,37 @@ def mapbuf_clicked(obj, item=None):
143 sc.show() 136 sc.show()
144 137
145 # controls 138 # controls
146 hbox = Box(win) 139 hbox = Box(win, horizontal=True, homogeneous=True,
147 hbox.horizontal = True 140 size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
148 hbox.homogeneous = True
149 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
150 hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
151 vbox.pack_start(hbox) 141 vbox.pack_start(hbox)
152 hbox.show() 142 hbox.show()
153 143
154 ck = Check(win) 144 ck = Check(win, text="Map", state=False)
155 ck.text = "Map"
156 ck.state = False
157 ck.callback_changed_add(cb_ck_map) 145 ck.callback_changed_add(cb_ck_map)
158 hbox.pack_end(ck) 146 hbox.pack_end(ck)
159 ck.show() 147 ck.show()
160 148
161 ck = Check(win) 149 ck = Check(win, text="Alpha", state=True)
162 ck.callback_changed_add(cb_ck_alpha) 150 ck.callback_changed_add(cb_ck_alpha)
163 ck.text = "Alpha"
164 ck.state = True
165 hbox.pack_end(ck) 151 hbox.pack_end(ck)
166 ck.show() 152 ck.show()
167 153
168 ck = Check(win) 154 ck = Check(win, text="Smooth", state=True)
169 ck.callback_changed_add(cb_ck_smooth) 155 ck.callback_changed_add(cb_ck_smooth)
170 ck.text = "Smooth"
171 ck.state = True
172 hbox.pack_end(ck) 156 hbox.pack_end(ck)
173 ck.show() 157 ck.show()
174 158
175 ck = Check(win) 159 ck = Check(win, text="FS", state=False)
176 ck.callback_changed_add(cb_ck_fs, win) 160 ck.callback_changed_add(cb_ck_fs, win)
177 ck.text = "FS"
178 ck.state = False
179 hbox.pack_end(ck) 161 hbox.pack_end(ck)
180 ck.show() 162 ck.show()
181 163
182 bt = Button(win) 164 bt = Button(win, text="Close", size_hint_align=FILL_BOTH,
183 bt.text = "Close" 165 size_hint_weight=EXPAND_HORIZ)
184 bt.callback_clicked_add(cb_btn_close, win) 166 bt.callback_clicked_add(cb_btn_close, win)
185 bt.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
186 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
187 hbox.pack_end(bt) 167 hbox.pack_end(bt)
188 bt.show() 168 bt.show()
189 169
190 win.resize(480, 600)
191 win.show() 170 win.show()
192 171
193 172
diff --git a/examples/elementary/test_menu.py b/examples/elementary/test_menu.py
index b815973..38111c1 100644
--- a/examples/elementary/test_menu.py
+++ b/examples/elementary/test_menu.py
@@ -1,12 +1,12 @@
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_CALLBACK_MOUSE_DOWN, 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.menu import Menu 7from efl.elementary.menu import Menu
9 8
9EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
10 10
11def menu_show(rect, evtinfo, menu): 11def menu_show(rect, evtinfo, menu):
12 (x,y) = evtinfo.position.canvas 12 (x,y) = evtinfo.position.canvas
@@ -63,34 +63,24 @@ def menu_populate_1(menu, item):
63 menu_populate_2(menu, item2) 63 menu_populate_2(menu, item2)
64 64
65def menu_clicked(obj): 65def menu_clicked(obj):
66 win = Window("menu", elementary.ELM_WIN_BASIC) 66 win = StandardWindow("menu", "Menu test", autodel=True, size=(350, 200))
67 win.title_set("Menu test")
68 win.autodel_set(True)
69 if obj is None: 67 if obj is None:
70 win.callback_delete_request_add(lambda o: elementary.exit()) 68 win.callback_delete_request_add(lambda o: elementary.exit())
71 69
72 bg = Background(win) 70 rect = Rectangle(win.evas_get(), color=(0, 0, 0, 0))
73 win.resize_object_add(bg)
74 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
75 bg.show()
76
77 rect = evas.Rectangle(win.evas_get())
78 win.resize_object_add(rect) 71 win.resize_object_add(rect)
79 rect.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 72 rect.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
80 rect.color_set(0, 0, 0, 0)
81 rect.show() 73 rect.show()
82 74
83 menu = Menu(win) 75 menu = Menu(win)
84 item = menu.item_add(None, "first item", "clock") 76 item = menu.item_add(None, "first item", "clock")
85
86 item = menu.item_add(None, "second item", "mail-send") 77 item = menu.item_add(None, "second item", "mail-send")
87 menu_populate_1(menu, item) 78 menu_populate_1(menu, item)
88 79
89 menu.item_add(item, "sub menu", "refresh") 80 menu.item_add(item, "sub menu", "refresh")
90 81
91 rect.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, menu_show, menu) 82 rect.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, menu_show, menu)
92 83
93 win.resize(350, 200)
94 win.show() 84 win.show()
95 85
96 86
diff --git a/examples/elementary/test_multibuttonentry.py b/examples/elementary/test_multibuttonentry.py
index 58a524e..ede1fdb 100644
--- a/examples/elementary/test_multibuttonentry.py
+++ b/examples/elementary/test_multibuttonentry.py
@@ -1,16 +1,21 @@
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 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.multibuttonentry import MultiButtonEntry 10from efl.elementary.multibuttonentry import MultiButtonEntry
12from efl.elementary.scroller import Scroller 11from efl.elementary.scroller import Scroller, ELM_SCROLLER_POLICY_OFF, \
12 ELM_SCROLLER_POLICY_AUTO
13 13
14EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
15EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
16FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
17FILL_HORIZ = EVAS_HINT_FILL, 0.5
18SCROLL_POLICY_VERT = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO
14 19
15counter = 0 20counter = 0
16 21
@@ -57,129 +62,94 @@ def cb_print(btn, mbe):
57 print(i.text) 62 print(i.text)
58 63
59def multibuttonentry_clicked(obj, item=None): 64def multibuttonentry_clicked(obj, item=None):
60 win = Window("multibuttonentry", elementary.ELM_WIN_BASIC) 65 win = StandardWindow("multibuttonentry", "MultiButtonEntry test",
61 win.title_set("MultiButtonEntry test") 66 autodel=True, size=(320, 320))
62 win.autodel_set(True)
63 if obj is None: 67 if obj is None:
64 win.callback_delete_request_add(lambda o: elementary.exit()) 68 win.callback_delete_request_add(lambda o: elementary.exit())
65 69
66 bg = Background(win) 70 vbox = Box(win, size_hint_weight=EXPAND_BOTH)
67 win.resize_object_add(bg)
68 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
69 bg.show()
70
71 vbox = Box(win)
72 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
73 win.resize_object_add(vbox) 71 win.resize_object_add(vbox)
74 vbox.show() 72 vbox.show()
75 73
76 sc = Scroller(win) 74 mbe = MultiButtonEntry(win, size_hint_align=FILL_BOTH,
77 sc.bounce = (False, True) 75 size_hint_weight=EXPAND_BOTH, text="To: ")
78 sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_AUTO)
79 sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
80 sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
81 vbox.pack_end(sc)
82 sc.show()
83
84 mbe = MultiButtonEntry(win)
85 mbe.callback_item_selected_add(cb_item_selected) 76 mbe.callback_item_selected_add(cb_item_selected)
86 mbe.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
87 mbe.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
88 mbe.text = "To: "
89 mbe.part_text_set("guide", "Tap to add recipient") 77 mbe.part_text_set("guide", "Tap to add recipient")
90 mbe.filter_append(cb_filter1) 78 mbe.filter_append(cb_filter1)
91 sc.content = mbe
92 mbe.show() 79 mbe.show()
93 80
81 sc = Scroller(win, bounce=(False, True), policy=SCROLL_POLICY_VERT,
82 size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH, content=mbe)
83 vbox.pack_end(sc)
84 sc.show()
85
94 print(mbe.entry) 86 print(mbe.entry)
95 87
96 hbox = Box(win) 88 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
97 hbox.horizontal = True
98 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
99 vbox.pack_end(hbox) 89 vbox.pack_end(hbox)
100 hbox.show() 90 hbox.show()
101 91
102 bt = Button(win) 92 bt = Button(win, text="item_append", size_hint_align=FILL_HORIZ,
103 bt.text = "item_append" 93 size_hint_weight=EXPAND_HORIZ)
104 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
105 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
106 bt.callback_clicked_add(cb_btn_item_append, mbe) 94 bt.callback_clicked_add(cb_btn_item_append, mbe)
107 hbox.pack_end(bt) 95 hbox.pack_end(bt)
108 bt.show() 96 bt.show()
109 97
110 bt = Button(win) 98 bt = Button(win, text="item_prepend", size_hint_align=FILL_HORIZ,
111 bt.text = "item_prepend" 99 size_hint_weight=EXPAND_HORIZ)
112 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
113 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
114 bt.callback_clicked_add(cb_btn_item_prepend, mbe) 100 bt.callback_clicked_add(cb_btn_item_prepend, mbe)
115 hbox.pack_end(bt) 101 hbox.pack_end(bt)
116 bt.show() 102 bt.show()
117 103
118 bt = Button(win) 104 bt = Button(win, text="item_insert_after", size_hint_align=FILL_HORIZ,
119 bt.text = "item_insert_after" 105 size_hint_weight=EXPAND_HORIZ)
120 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
121 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
122 bt.callback_clicked_add(cb_btn_item_insert_after, mbe) 106 bt.callback_clicked_add(cb_btn_item_insert_after, mbe)
123 hbox.pack_end(bt) 107 hbox.pack_end(bt)
124 bt.show() 108 bt.show()
125 109
126 bt = Button(win) 110 bt = Button(win, text="item_insert_before", size_hint_align=FILL_HORIZ,
127 bt.text = "item_insert_before" 111 size_hint_weight=EXPAND_HORIZ)
128 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
129 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
130 bt.callback_clicked_add(cb_btn_item_insert_before, mbe) 112 bt.callback_clicked_add(cb_btn_item_insert_before, mbe)
131 hbox.pack_end(bt) 113 hbox.pack_end(bt)
132 bt.show() 114 bt.show()
133 115
134 116
135 hbox = Box(win) 117 hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
136 hbox.horizontal = True
137 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
138 vbox.pack_end(hbox) 118 vbox.pack_end(hbox)
139 hbox.show() 119 hbox.show()
140 120
141 bt = Button(win) 121 bt = Button(win, text="delete selected item", size_hint_align=FILL_HORIZ,
142 bt.text = "delete selected item" 122 size_hint_weight=EXPAND_HORIZ)
143 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
144 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
145 bt.callback_clicked_add(lambda btn: mbe.selected_item.delete()) 123 bt.callback_clicked_add(lambda btn: mbe.selected_item.delete())
146 hbox.pack_end(bt) 124 hbox.pack_end(bt)
147 bt.show() 125 bt.show()
148 126
149 bt = Button(win) 127 bt = Button(win, text="clear", size_hint_align=FILL_HORIZ,
150 bt.text = "clear" 128 size_hint_weight=EXPAND_HORIZ)
151 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
152 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
153 bt.callback_clicked_add(lambda bt: mbe.clear()) 129 bt.callback_clicked_add(lambda bt: mbe.clear())
154 hbox.pack_end(bt) 130 hbox.pack_end(bt)
155 bt.show() 131 bt.show()
156 132
157 bt = Button(win) 133 bt = Button(win, text="clear2", size_hint_align=FILL_HORIZ,
158 bt.text = "clear2" 134 size_hint_weight=EXPAND_HORIZ)
159 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
160 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
161 bt.callback_clicked_add(cb_btn_clear2, mbe) 135 bt.callback_clicked_add(cb_btn_clear2, mbe)
162 hbox.pack_end(bt) 136 hbox.pack_end(bt)
163 bt.show() 137 bt.show()
164 138
165 bt = Button(win) 139 bt = Button(win, text="toggle expand", size_hint_align=FILL_HORIZ,
166 bt.text = "toggle expand" 140 size_hint_weight=EXPAND_HORIZ)
167 bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
168 bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
169 bt.callback_clicked_add(lambda btn: mbe.expanded_set(not mbe.expanded_get())) 141 bt.callback_clicked_add(lambda btn: mbe.expanded_set(not mbe.expanded_get()))
170 hbox.pack_end(bt) 142 hbox.pack_end(bt)
171 bt.show() 143 bt.show()
172 144
173 bt = Button(win) 145 bt = Button(win, text="print", size_hint_align=FILL_HORIZ,
174 bt.text = "print" 146 size_hint_weight=EXPAND_HORIZ)
175 bt.size_hint_align = evas.EVAS_HINT_FILL, 0.0
176 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
177 bt.callback_clicked_add(cb_print, mbe) 147 bt.callback_clicked_add(cb_print, mbe)
178 hbox.pack_end(bt) 148 hbox.pack_end(bt)
179 bt.show() 149 bt.show()
180 150
181 mbe.focus = True 151 mbe.focus = True
182 win.resize(320, 320) 152
183 win.show() 153 win.show()
184 154
185 155
diff --git a/examples/elementary/test_naviframe.py b/examples/elementary/test_naviframe.py
index 0d8b5b5..6a5d700 100644
--- a/examples/elementary/test_naviframe.py
+++ b/examples/elementary/test_naviframe.py
@@ -1,23 +1,22 @@
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.icon import Icon 11from efl.elementary.icon import Icon
11from efl.elementary.naviframe import Naviframe 12from efl.elementary.naviframe import Naviframe
12from efl.elementary.photo import Photo 13from efl.elementary.photo import Photo
13 14
15EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
16FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
14 17
15def content_new(parent, img): 18script_path = os.path.dirname(os.path.abspath(__file__))
16 photo = Photo(parent) 19img_path = os.path.join(script_path, "images")
17 photo.file_set(img)
18 photo.fill_inside_set(True)
19 photo.style_set("shadow")
20 return photo
21 20
22def navi_pop(bt, nf): 21def navi_pop(bt, nf):
23 nf.item_pop() 22 nf.item_pop()
@@ -29,115 +28,107 @@ def title_visible(obj, item):
29 item.title_visible = not item.title_visible 28 item.title_visible = not item.title_visible
30 29
31def page2(bt, nf): 30def page2(bt, nf):
32 ic = Icon(nf) 31 ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png"))
33 ic.file_set("images/icon_right_arrow.png") 32
34 bt = Button(nf) 33 bt = Button(nf, content=ic)
35 bt.callback_clicked_add(page3, nf) 34 bt.callback_clicked_add(page3, nf)
36 bt.content_set(ic)
37 35
38 content = content_new(nf, "images/plant_01.jpg"); 36 content = Photo(nf, file=os.path.join(img_path, "plant_01.jpg"),
37 fill_inside=True, style="shadow")
38
39 item = nf.item_push("Page 2", None, bt, content, "basic") 39 item = nf.item_push("Page 2", None, bt, content, "basic")
40 item.part_text_set("subtitle", "Here is sub-title part!") 40 item.part_text_set("subtitle", "Here is sub-title part!")
41 41
42def page3(bt, nf): 42def page3(bt, nf):
43 bt = Button(nf) 43 bt = Button(nf, text="Prev")
44 bt.callback_clicked_add(navi_pop, nf) 44 bt.callback_clicked_add(navi_pop, nf)
45 bt.text_set("Prev")
46 45
47 bt2 = Button(nf) 46 bt2 = Button(nf, text="Next")
48 bt2.callback_clicked_add(page4, nf) 47 bt2.callback_clicked_add(page4, nf)
49 bt2.text_set("Next")
50 48
51 content = content_new(nf, "images/rock_01.jpg"); 49 content = Photo(nf, file=os.path.join(img_path, "rock_01.jpg"),
50 fill_inside=True, style="shadow")
51
52 item = nf.item_push("Page 3", bt, bt2, content, "basic") 52 item = nf.item_push("Page 3", bt, bt2, content, "basic")
53 ic = Icon(nf) 53
54 ic.file_set("images/logo_small.png") 54 ic = Icon(nf, file=os.path.join(img_path, "logo_small.png"))
55 item.part_content_set("icon", ic) 55 item.part_content_set("icon", ic)
56 56
57def page4(bt, nf): 57def page4(bt, nf):
58 ic = Icon(nf) 58 ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png"))
59 ic.file_set("images/icon_right_arrow.png") 59 bt = Button(nf, content=ic)
60 bt = Button(nf)
61 bt.callback_clicked_add(page5, nf) 60 bt.callback_clicked_add(page5, nf)
62 bt.content_set(ic)
63 61
64 content = content_new(nf, "images/rock_02.jpg"); 62 content = Photo(nf, file=os.path.join(img_path, "rock_02.jpg"),
63 fill_inside=True, style="shadow")
64
65 item = nf.item_push("Page 4", None, bt, content, "basic") 65 item = nf.item_push("Page 4", None, bt, content, "basic")
66 ic = Icon(nf) 66 ic = Icon(nf, file=os.path.join(img_path, "logo_small.png"))
67 ic.file_set("images/logo_small.png")
68 item.part_content_set("icon", ic) 67 item.part_content_set("icon", ic)
69 item.part_text_set("subtitle", "Title area visibility test") 68 item.part_text_set("subtitle", "Title area visibility test")
70 item.title_visible_set(False) 69 item.title_visible_set(False)
70
71 content.callback_clicked_add(title_visible, item) 71 content.callback_clicked_add(title_visible, item)
72 72
73def page5(bt, nf): 73def page5(bt, nf):
74 bt = Button(nf) 74 bt = Button(nf, text="Page 4")
75 bt.callback_clicked_add(navi_pop, nf) 75 bt.callback_clicked_add(navi_pop, nf)
76 bt.text_set("Page 4")
77 76
78 bt2 = Button(nf) 77 bt2 = Button(nf, text="Page 6")
79 bt2.callback_clicked_add(page6, nf) 78 bt2.callback_clicked_add(page6, nf)
80 bt2.text_set("Page 6")
81 79
82 content = content_new(nf, "images/sky_01.jpg"); 80 content = Photo(nf, file=os.path.join(img_path, "sky_01.jpg"),
81 fill_inside=True, style="shadow")
82
83 item = nf.item_insert_after(nf.top_item_get(), "Page 5", bt, bt2, content, "basic") 83 item = nf.item_insert_after(nf.top_item_get(), "Page 5", bt, bt2, content, "basic")
84 item.part_text_set("subtitle", "This page is inserted without transition (TODO)") 84 item.part_text_set("subtitle", "This page is inserted without transition (TODO)")
85 85
86def page6(bt, nf): 86def page6(bt, nf):
87 bt = Button(nf) 87 bt = Button(nf, text="Page 5")
88 bt.callback_clicked_add(navi_pop, nf) 88 bt.callback_clicked_add(navi_pop, nf)
89 bt.text_set("Page 5")
90 89
91 bt2 = Button(nf) 90 bt2 = Button(nf, text="Page 7")
92 bt2.callback_clicked_add(page7, nf) 91 bt2.callback_clicked_add(page7, nf)
93 bt2.text_set("Page 7")
94 92
95 content = content_new(nf, "images/sky_03.jpg"); 93 content = Photo(nf, file=os.path.join(img_path, "sky_03.jpg"),
94 fill_inside=True, style="shadow")
95
96 item = nf.item_push("Page 6", bt, bt2, content, "overlap") 96 item = nf.item_push("Page 6", bt, bt2, content, "overlap")
97 item.part_text_set("subtitle", "Overlap style!") 97 item.part_text_set("subtitle", "Overlap style!")
98 98
99def page7(bt, nf): 99def page7(bt, nf):
100 bt = Button(nf) 100 bt = Button(nf, text="Page 6")
101 bt.callback_clicked_add(navi_pop, nf) 101 bt.callback_clicked_add(navi_pop, nf)
102 bt.text_set("Page 6")
103 102
104 bt2 = Button(nf) 103 bt2 = Button(nf, text="Page 1")
105 bt2.callback_clicked_add(navi_promote, nf, nf.data["page1"]) 104 bt2.callback_clicked_add(navi_promote, nf, nf.data["page1"])
106 bt2.text_set("Page 1")
107 105
108 content = content_new(nf, "images/sky_02.jpg"); 106 content = Photo(nf, file=os.path.join(img_path, "sky_02.jpg"),
107 fill_inside=True, style="shadow")
108
109 item = nf.item_push("Page 7", bt, bt2, content, "overlap") 109 item = nf.item_push("Page 7", bt, bt2, content, "overlap")
110 item.part_text_set("subtitle", "Overlap style!") 110 item.part_text_set("subtitle", "Overlap style!")
111 111
112 112
113def naviframe_clicked(obj): 113def naviframe_clicked(obj):
114 win = Window("naviframe", elementary.ELM_WIN_BASIC) 114 win = StandardWindow("naviframe", "Naviframe test", autodel=True,
115 win.title_set("Naviframe test") 115 size=(400, 600))
116 win.autodel_set(True)
117 if obj is None: 116 if obj is None:
118 win.callback_delete_request_add(lambda o: elementary.exit()) 117 win.callback_delete_request_add(lambda o: elementary.exit())
119 118
120 bg = Background(win) 119 nf = Naviframe(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
121 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
122 bg.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
123 win.resize_object_add(bg)
124 bg.show()
125
126 nf = Naviframe(win)
127 nf.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
128 nf.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
129 win.resize_object_add(nf) 120 win.resize_object_add(nf)
130 nf.show() 121 nf.show()
131 122
132 bt = Button(win) 123 bt = Button(win, text="Next")
133 bt.callback_clicked_add(page2, nf) 124 bt.callback_clicked_add(page2, nf)
134 bt.text_set("Next")
135 125
136 content = content_new(nf, "images/logo.png") 126 content = Photo(nf, file=os.path.join(img_path, "logo.png"),
127 fill_inside=True, style="shadow")
128
137 item = nf.item_push("Page 1", None, bt, content, "basic") 129 item = nf.item_push("Page 1", None, bt, content, "basic")
138 nf.data["page1"] = item 130 nf.data["page1"] = item
139 131
140 win.resize(400, 600)
141 win.show() 132 win.show()
142 133
143 134
diff --git a/examples/elementary/test_notify.py b/examples/elementary/test_notify.py
index e7150e7..0ace966 100644
--- a/examples/elementary/test_notify.py
+++ b/examples/elementary/test_notify.py
@@ -1,115 +1,94 @@
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 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.label import Label 9from efl.elementary.label import Label
11from efl.elementary.notify import Notify 10from efl.elementary.notify import Notify, ELM_NOTIFY_ORIENT_TOP, \
11 ELM_NOTIFY_ORIENT_CENTER, ELM_NOTIFY_ORIENT_BOTTOM, \
12 ELM_NOTIFY_ORIENT_LEFT, ELM_NOTIFY_ORIENT_RIGHT, \
13 ELM_NOTIFY_ORIENT_TOP_LEFT, ELM_NOTIFY_ORIENT_TOP_RIGHT, \
14 ELM_NOTIFY_ORIENT_BOTTOM_LEFT, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT
12from efl.elementary.table import Table 15from efl.elementary.table import Table
13 16
17EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
18FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
14 19
15def notify_close(bt, notify): 20def notify_close(bt, notify):
16 notify.hide() 21 notify.hide()
17 22
18def notify_show(bt, win, orient): 23def notify_show(bt, win, orient):
19 notify = Notify(win) 24 notify = Notify(win, repeat_events=False, timeout=5, orient=orient)
20 notify.repeat_events_set(False) 25
21 notify.timeout_set(5) 26 bx = Box(win, size_hint_weight=EXPAND_BOTH, horizontal=True)
22 notify.orient_set(orient)
23
24 bx = Box(win)
25 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
26 bx.horizontal_set(True)
27 notify.content_set(bx) 27 notify.content_set(bx)
28 bx.show() 28 bx.show()
29 29
30 lb = Label(win) 30 lb = Label(win, text="Text notification")
31 lb.text_set("Text notification")
32 bx.pack_end(lb) 31 bx.pack_end(lb)
33 lb.show() 32 lb.show()
34 33
35 bt = Button(win) 34 bt = Button(win, text="Close")
36 bt.text_set("Close")
37 bt.callback_clicked_add(notify_close, notify) 35 bt.callback_clicked_add(notify_close, notify)
38 bx.pack_end(bt) 36 bx.pack_end(bt)
39 bt.show() 37 bt.show()
40 notify.show() 38 notify.show()
41 39
42def notify_clicked(obj): 40def notify_clicked(obj):
43 win = Window("notify", elementary.ELM_WIN_BASIC) 41 win = StandardWindow("notify", "Notify test", autodel=True, size=(320, 320),
44 win.title_set("Notify test") 42 size_hint_min=(160, 160), size_hint_max=(320, 320))
45 win.autodel_set(True)
46 win.size_hint_min_set(160, 160)
47 win.size_hint_max_set(320, 320)
48 win.resize(320, 320)
49 if obj is None: 43 if obj is None:
50 win.callback_delete_request_add(lambda o: elementary.exit()) 44 win.callback_delete_request_add(lambda o: elementary.exit())
51 45
52 bg = Background(win) 46 tb = Table(win, size_hint_weight=EXPAND_BOTH)
53 win.resize_object_add(bg)
54 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
55 bg.show()
56
57 tb = Table(win)
58 tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
59 win.resize_object_add(tb) 47 win.resize_object_add(tb)
60 tb.show() 48 tb.show()
61 49
62 bt = Button(win) 50 bt = Button(win, text="Top")
63 bt.text_set("Top") 51 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_TOP)
64 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP)
65 tb.pack(bt, 1, 0, 1, 1) 52 tb.pack(bt, 1, 0, 1, 1)
66 bt.show() 53 bt.show()
67 54
68 bt = Button(win) 55 bt = Button(win, text="Center")
69 bt.text_set("Center") 56 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_CENTER)
70 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER)
71 tb.pack(bt, 1, 1, 1, 1) 57 tb.pack(bt, 1, 1, 1, 1)
72 bt.show() 58 bt.show()
73 59
74 bt = Button(win) 60 bt = Button(win, text="Bottom")
75 bt.text_set("Bottom") 61 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_BOTTOM)
76 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM)
77 tb.pack(bt, 1, 2, 1, 1) 62 tb.pack(bt, 1, 2, 1, 1)
78 bt.show() 63 bt.show()
79 64
80 bt = Button(win) 65 bt = Button(win, text="Left")
81 bt.text_set("Left") 66 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_LEFT)
82 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_LEFT)
83 tb.pack(bt, 0, 1, 1, 1) 67 tb.pack(bt, 0, 1, 1, 1)
84 bt.show() 68 bt.show()
85 69
86 bt = Button(win) 70 bt = Button(win, text="Top Left")
87 bt.text_set("Top Left") 71 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_TOP_LEFT)
88 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_LEFT)
89 tb.pack(bt, 0, 0, 1, 1) 72 tb.pack(bt, 0, 0, 1, 1)
90 bt.show() 73 bt.show()
91 74
92 bt = Button(win) 75 bt = Button(win, text="Bottom Left")
93 bt.text_set("Bottom Left") 76 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_BOTTOM_LEFT)
94 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_LEFT)
95 tb.pack(bt, 0, 2, 1, 1) 77 tb.pack(bt, 0, 2, 1, 1)
96 bt.show() 78 bt.show()
97 79
98 bt = Button(win) 80 bt = Button(win, text="Right")
99 bt.text_set("Right") 81 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_RIGHT)
100 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_RIGHT)
101 tb.pack(bt, 2, 1, 1, 1) 82 tb.pack(bt, 2, 1, 1, 1)
102 bt.show() 83 bt.show()
103 84
104 bt = Button(win) 85 bt = Button(win, text="Top Right")
105 bt.text_set("Top Right") 86 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_TOP_RIGHT)
106 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_RIGHT)
107 tb.pack(bt, 2, 0, 1, 1) 87 tb.pack(bt, 2, 0, 1, 1)
108 bt.show() 88 bt.show()
109 89
110 bt = Button(win) 90 bt = Button(win, text="Bottom Right")
111 bt.text_set("Bottom Right") 91 bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT)
112 bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_RIGHT)
113 tb.pack(bt, 2, 2, 1, 1) 92 tb.pack(bt, 2, 2, 1, 1)
114 bt.show() 93 bt.show()
115 94
diff --git a/examples/elementary/test_panel.py b/examples/elementary/test_panel.py
index 970f725..1fa19b3 100644
--- a/examples/elementary/test_panel.py
+++ b/examples/elementary/test_panel.py
@@ -1,49 +1,37 @@
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 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.panel import Panel 9from efl.elementary.panel import Panel, ELM_PANEL_ORIENT_LEFT
11 10
11EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
12EXPAND_VERT = 0.0, EVAS_HINT_EXPAND
13FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
14FILL_VERT_ALIGN_LEFT = 0.0, EVAS_HINT_FILL
12 15
13def panel_clicked(obj): 16def panel_clicked(obj):
14 win = Window("panel", elementary.ELM_WIN_BASIC) 17 win = StandardWindow("panel", "Panel test", autodel=True, size=(300, 300))
15 win.title_set("Panel test")
16 win.autodel_set(True)
17 if obj is None: 18 if obj is None:
18 win.callback_delete_request_add(lambda o: elementary.exit()) 19 win.callback_delete_request_add(lambda o: elementary.exit())
19 20
20 bg = Background(win) 21 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 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
27 win.resize_object_add(bx) 22 win.resize_object_add(bx)
28 bx.show() 23 bx.show()
29 24
30 panel = Panel(win) 25 bt = Button(win, text="HIDE ME :)", size_hint_weight=EXPAND_BOTH,
31 panel.orient = elementary.ELM_PANEL_ORIENT_LEFT 26 size_hint_align=FILL_BOTH)
32 panel.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND);
33 panel.size_hint_align_set(0.0, evas.EVAS_HINT_FILL);
34
35 bt = Button(win)
36 bt.text_set("HIDE ME :)")
37 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND);
38 bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL);
39 bt.show() 27 bt.show()
40 28
41 panel.content_set(bt) 29 panel = Panel(win, orient=ELM_PANEL_ORIENT_LEFT, content=bt,
30 size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT_ALIGN_LEFT)
42 31
43 bx.pack_end(panel) 32 bx.pack_end(panel)
44 panel.show() 33 panel.show()
45 34
46 win.resize(300, 300)
47 win.show() 35 win.show()
48 36
49 37
diff --git a/examples/elementary/test_panes.py b/examples/elementary/test_panes.py
index f3edb6c..accc3be 100644
--- a/examples/elementary/test_panes.py
+++ b/examples/elementary/test_panes.py
@@ -1,63 +1,49 @@
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 Window 6from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background
8from efl.elementary.button import Button 7from efl.elementary.button import Button
9from efl.elementary.panes import Panes 8from efl.elementary.panes import Panes
10 9
10EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
11FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
11 12
12def cb_panes(panes, event): 13def cb_panes(panes, event):
13 print(("Event: %s" % (event))) 14 print(("Event: %s" % (event)))
14 15
15def panes_clicked(obj): 16def panes_clicked(obj):
16 win = Window("panes", elementary.ELM_WIN_BASIC) 17 win = StandardWindow("panes", "Panes test", autodel=True, size=(320, 480))
17 win.title_set("Panes test")
18 win.autodel_set(True)
19 if obj is None: 18 if obj is None:
20 win.callback_delete_request_add(lambda o: elementary.exit()) 19 win.callback_delete_request_add(lambda o: elementary.exit())
21 20
22 bg = Background(win) 21 panes = Panes(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
23 win.resize_object_add(bg)
24 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
25 bg.show()
26
27 panes = Panes(win)
28 win.resize_object_add(panes) 22 win.resize_object_add(panes)
29 panes.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
30 panes.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
31 panes.callback_clicked_add(cb_panes, "clicked") 23 panes.callback_clicked_add(cb_panes, "clicked")
32 panes.callback_clicked_double_add(cb_panes, "clicked,double") 24 panes.callback_clicked_double_add(cb_panes, "clicked,double")
33 panes.callback_press_add(cb_panes, "press") 25 panes.callback_press_add(cb_panes, "press")
34 panes.callback_unpress_add(cb_panes, "unpress") 26 panes.callback_unpress_add(cb_panes, "unpress")
35 panes.show() 27 panes.show()
36 28
37 bt = Button(win) 29 bt = Button(win, text="Left")
38 bt.text = "Left"
39 panes.part_content_set("left", bt) 30 panes.part_content_set("left", bt)
40 bt.show() 31 bt.show()
41 32
42 panes_h = Panes(win) 33 panes_h = Panes(win, horizontal=True, size_hint_weight=EXPAND_BOTH,
34 size_hint_align=FILL_BOTH)
43 panes_h.horizontal = True 35 panes_h.horizontal = True
44 panes_h.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
45 panes_h.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
46 panes.part_content_set("right", panes_h) 36 panes.part_content_set("right", panes_h)
47 panes_h.show() 37 panes_h.show()
48 38
49 bt = Button(win) 39 bt = Button(win, text="Up")
50 bt.text = "Up"
51 panes_h.part_content_set("left", bt) 40 panes_h.part_content_set("left", bt)
52 bt.show() 41 bt.show()
53 42
54 bt = Button(win) 43 bt = Button(win, text="Down")
55 bt.text = "Down"
56 panes_h.part_content_set("right", bt) 44 panes_h.part_content_set("right", bt)
57 bt.show() 45 bt.show()
58 46
59
60 win.resize(320, 480)
61 win.show() 47 win.show()
62 48
63 49
diff --git a/examples/elementary/test_photo.py b/examples/elementary/test_photo.py
index a5839bc..f1b2c1a 100644
--- a/examples/elementary/test_photo.py
+++ b/examples/elementary/test_photo.py
@@ -1,14 +1,22 @@
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.photo import Photo 9from efl.elementary.photo import Photo
9from efl.elementary.scroller import Scroller 10from efl.elementary.scroller import Scroller
10from efl.elementary.table import Table 11from efl.elementary.table import Table
11 12
13EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
14EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
15FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
16FILL_HORIZ = EVAS_HINT_FILL, 0.5
17
18script_path = os.path.dirname(os.path.abspath(__file__))
19img_path = os.path.join(script_path, "images")
12 20
13images = ["panel_01.jpg", 21images = ["panel_01.jpg",
14 "mystrale.jpg", 22 "mystrale.jpg",
@@ -21,53 +29,38 @@ images = ["panel_01.jpg",
21 "wood_01.jpg"] 29 "wood_01.jpg"]
22 30
23def photo_clicked(obj): 31def photo_clicked(obj):
24 win = Window("photo", elementary.ELM_WIN_BASIC) 32 win = StandardWindow("photo", "Photo test", autodel=True, size=(300, 300))
25 win.title_set("Photo test")
26 win.autodel_set(True)
27 if obj is None: 33 if obj is None:
28 win.callback_delete_request_add(lambda o: elementary.exit()) 34 win.callback_delete_request_add(lambda o: elementary.exit())
29 35
30 bg = Background(win)
31 win.resize_object_add(bg)
32 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
33 bg.show()
34
35 sc = Scroller(win)
36 sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
37 win.resize_object_add(sc)
38 sc.show()
39
40 elementary.need_ethumb() 36 elementary.need_ethumb()
41 37
42 tb = Table(win) 38 tb = Table(win, size_hint_weight=EXPAND_BOTH)
43 tb.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
44 sc.content = tb
45 tb.show() 39 tb.show()
46 40
41 sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
42 win.resize_object_add(sc)
43 sc.show()
44
47 n = 0 45 n = 0
48 for j in range(12): 46 for j in range(12):
49 for i in range(12): 47 for i in range(12):
50 ph = Photo(win) 48 ph = Photo(win, aspect_fixed=False, size=80, editable=True,
51 name = "images/%s" % (images[n]) 49 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
50 name = os.path.join(img_path, images[n])
52 n += 1 51 n += 1
53 if n >= 9: n = 0 52 if n >= 9: n = 0
54 ph.aspect_fixed = False
55 ph.size = 80
56 if n == 8: 53 if n == 8:
57 ph.thumb = name 54 ph.thumb = name
58 else: 55 else:
59 ph.file = name 56 ph.file = name
60 ph.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
61 ph.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
62 ph.editable = True
63 if n in [2, 3]: 57 if n in [2, 3]:
64 ph.fill_inside = True 58 ph.fill_inside = True
65 ph.style = "shadow" 59 ph.style = "shadow"
66 60
67 tb.pack(ph, i, j, 1, 1) 61 tb.pack(ph, i, j, 1, 1)
68 ph.show() 62 ph.show()
69 63
70 win.resize(300, 300)
71 win.show() 64 win.show()
72 65
73 66
diff --git a/examples/elementary/test_photocam.py b/examples/elementary/test_photocam.py
index f724009..0dc0f5f 100644
--- a/examples/elementary/test_photocam.py
+++ b/examples/elementary/test_photocam.py
@@ -1,30 +1,33 @@
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.box import Box 7from efl.elementary.box import Box
8from efl.elementary.button import Button 8from efl.elementary.button import Button
9from efl.elementary.photocam import Photocam 9from efl.elementary.photocam import Photocam, ELM_PHOTOCAM_ZOOM_MODE_MANUAL, \
10 ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL
10from efl.elementary.progressbar import Progressbar 11from efl.elementary.progressbar import Progressbar
11from efl.elementary.separator import Separator 12from efl.elementary.separator import Separator
12from efl.elementary.table import Table 13from efl.elementary.table import Table
13from efl.elementary.fileselector_button import FileselectorButton 14from efl.elementary.fileselector_button import FileselectorButton
14 15
16EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
17FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
15 18
16 19
17remote_url = "http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x10800.jpg" 20remote_url = "http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x10800.jpg"
18 21
19 22
20def _cb_zoom_in(bt, pc): 23def _cb_zoom_in(bt, pc):
21 pc.zoom_mode = elementary.ELM_PHOTOCAM_ZOOM_MODE_MANUAL 24 pc.zoom_mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL
22 zoom = pc.zoom - 0.5 25 zoom = pc.zoom - 0.5
23 if zoom >= (1.0 / 32.0): 26 if zoom >= (1.0 / 32.0):
24 pc.zoom = zoom 27 pc.zoom = zoom
25 28
26def _cb_zoom_out(bt, pc): 29def _cb_zoom_out(bt, pc):
27 pc.zoom_mode = elementary.ELM_PHOTOCAM_ZOOM_MODE_MANUAL 30 pc.zoom_mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL
28 zoom = pc.zoom + 0.5 31 zoom = pc.zoom + 0.5
29 if zoom <= 256.0: 32 if zoom <= 256.0:
30 pc.zoom = zoom 33 pc.zoom = zoom
@@ -51,71 +54,57 @@ def _cb_pc_download_error(im, info, pb):
51 54
52 55
53def photocam_clicked(obj): 56def photocam_clicked(obj):
54 win = StandardWindow("photocam", "Photocam test") 57 win = StandardWindow("photocam", "Photocam test", autodel=True,
55 win.autodel_set(True) 58 size=(600, 600))
56 if obj is None: 59 if obj is None:
57 win.callback_delete_request_add(lambda o: elementary.exit()) 60 win.callback_delete_request_add(lambda o: elementary.exit())
58 61
59 # Photocam widget 62 # Photocam widget
60 pc = Photocam(win) 63 pc = Photocam(win, size_hint_weight=EXPAND_BOTH)
61 pc.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
62 win.resize_object_add(pc) 64 win.resize_object_add(pc)
63 pc.show() 65 pc.show()
64 66
65 # table for buttons 67 # table for buttons
66 tb = Table(win); 68 tb = Table(win, size_hint_weight=EXPAND_BOTH)
67 tb.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
68 win.resize_object_add(tb) 69 win.resize_object_add(tb)
69 tb.show() 70 tb.show()
70 71
71 # zoom out btn 72 # zoom out btn
72 bt = Button(win) 73 bt = Button(win, text="Z -", size_hint_weight=EXPAND_BOTH,
73 bt.text = "Z -" 74 size_hint_align=(0.1, 0.1))
74 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
75 bt.size_hint_align = 0.1, 0.1
76 bt.callback_clicked_add(_cb_zoom_out, pc) 75 bt.callback_clicked_add(_cb_zoom_out, pc)
77 tb.pack(bt, 0, 0, 1, 1) 76 tb.pack(bt, 0, 0, 1, 1)
78 bt.show() 77 bt.show()
79 78
80 # select file btn 79 # select file btn
81 bt = FileselectorButton(win) 80 bt = FileselectorButton(win, text="Select Photo File",
82 bt.text = "Select Photo File" 81 size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.1))
83 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
84 bt.size_hint_align = 0.5, 0.1
85 bt.callback_file_chosen_add(lambda fs, path: pc.file_set(path)) 82 bt.callback_file_chosen_add(lambda fs, path: pc.file_set(path))
86 tb.pack(bt, 1, 0, 1, 1) 83 tb.pack(bt, 1, 0, 1, 1)
87 bt.show() 84 bt.show()
88 85
89 # zoom in btn 86 # zoom in btn
90 bt = Button(win) 87 bt = Button(win, text="Z +", size_hint_weight=EXPAND_BOTH,
91 bt.text = "Z +" 88 size_hint_align=(0.9, 0.1))
92 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
93 bt.size_hint_align = 0.9, 0.1
94 bt.callback_clicked_add(_cb_zoom_in, pc) 89 bt.callback_clicked_add(_cb_zoom_in, pc)
95 tb.pack(bt, 2, 0, 1, 1) 90 tb.pack(bt, 2, 0, 1, 1)
96 bt.show() 91 bt.show()
97 92
98 # progressbar for remote loading 93 # progressbar for remote loading
99 pb = Progressbar(win) 94 pb = Progressbar(win, unit_format="loading %.2f %%",
100 pb.unit_format = "loading %.2f %%" 95 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
101 pb.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
102 pb.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
103 tb.pack(pb, 1, 1, 1, 1) 96 tb.pack(pb, 1, 1, 1, 1)
104 97
105 # Fit btn 98 # Fit btn
106 bt = Button(win); 99 bt = Button(win, text="Fit", size_hint_weight=EXPAND_BOTH,
107 bt.text = "Fit" 100 size_hint_align=(0.1, 0.9))
108 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
109 bt.size_hint_align = 0.1, 0.9
110 bt.callback_clicked_add(lambda b: pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT)) 101 bt.callback_clicked_add(lambda b: pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT))
111 tb.pack(bt, 0, 2, 1, 1) 102 tb.pack(bt, 0, 2, 1, 1)
112 bt.show() 103 bt.show()
113 104
114 # load remote url 105 # load remote url
115 bt = Button(win) 106 bt = Button(win, text="Load remote URL (27MB)",
116 bt.text = "Load remote URL (27MB)" 107 size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.9))
117 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
118 bt.size_hint_align = 0.5, 0.9
119 bt.callback_clicked_add(lambda b: pc.file_set(remote_url)) 108 bt.callback_clicked_add(lambda b: pc.file_set(remote_url))
120 tb.pack(bt, 1, 2, 1, 1) 109 tb.pack(bt, 1, 2, 1, 1)
121 bt.show() 110 bt.show()
@@ -126,16 +115,13 @@ def photocam_clicked(obj):
126 pc.callback_download_error_add(_cb_pc_download_error, pb) 115 pc.callback_download_error_add(_cb_pc_download_error, pb)
127 116
128 # Fill btn 117 # Fill btn
129 bt = Button(win); 118 bt = Button(win, text="Fill", size_hint_weight=EXPAND_BOTH,
130 bt.text = "Fill" 119 size_hint_align=(0.9, 0.9))
131 bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
132 bt.size_hint_align = 0.9, 0.9
133 bt.callback_clicked_add(lambda b: pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL)) 120 bt.callback_clicked_add(lambda b: pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL))
134 tb.pack(bt, 2, 2, 1, 1) 121 tb.pack(bt, 2, 2, 1, 1)
135 bt.show() 122 bt.show()
136 123
137 # show the win 124 # show the win
138 win.resize(600, 600)
139 win.show() 125 win.show()
140 126
141 127
diff --git a/examples/elementary/test_popup.py b/examples/elementary/test_popup.py
index dd5c69c..718f255 100644
--- a/examples/elementary/test_popup.py
+++ b/examples/elementary/test_popup.py
@@ -1,15 +1,21 @@
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, FilledImage
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.button import Button 9from efl.elementary.button import Button
9from efl.elementary.list import List 10from efl.elementary.list import List, ELM_LIST_LIMIT
10from efl.elementary.icon import Icon 11from efl.elementary.icon import Icon
11from efl.elementary.popup import Popup 12from efl.elementary.popup import Popup, ELM_WRAP_CHAR
13
14EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
15FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
12 16
17script_path = os.path.dirname(os.path.abspath(__file__))
18img_path = os.path.join(script_path, "images")
13 19
14def cb_bnt_close(btn, popup): 20def cb_bnt_close(btn, popup):
15 if "im" in popup.data: 21 if "im" in popup.data:
@@ -18,7 +24,7 @@ def cb_bnt_close(btn, popup):
18 24
19def cb_btn_restack(btn, popup): 25def cb_btn_restack(btn, popup):
20 im = evas.FilledImage(popup.evas); 26 im = evas.FilledImage(popup.evas);
21 im.file = "images/mystrale_2.jpg" 27 im.file = os.path.join(img_path, "mystrale_2.jpg")
22 im.move(40, 40) 28 im.move(40, 40)
23 im.resize(500, 320) 29 im.resize(500, 320)
24 im.show() 30 im.show()
@@ -27,38 +33,31 @@ def cb_btn_restack(btn, popup):
27 popup.raise_() 33 popup.raise_()
28 34
29def cb_popup_center_text(li, item, win): 35def cb_popup_center_text(li, item, win):
30 popup = Popup(win) 36 popup = Popup(win, size_hint_weight=EXPAND_BOTH, timeout=3.0)
31 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
32 popup.text = "This Popup has content area and timeout value is 3 seconds" 37 popup.text = "This Popup has content area and timeout value is 3 seconds"
33 popup.timeout = 3.0
34 popup.show() 38 popup.show()
35 39
36def cb_popup_center_title_text_1button(li, item, win): 40def cb_popup_center_title_text_1button(li, item, win):
37 popup = Popup(win) 41 popup = Popup(win, size_hint_weight=EXPAND_BOTH)
38 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
39 popup.text = "This Popup has content area and " \ 42 popup.text = "This Popup has content area and " \
40 "action area set, action area has one button Close" 43 "action area set, action area has one button Close"
41 bt = Button(win) 44 bt = Button(win, text="Close")
42 bt.text = "Close"
43 bt.callback_clicked_add(cb_bnt_close, popup) 45 bt.callback_clicked_add(cb_bnt_close, popup)
44 popup.part_content_set("button1", bt) 46 popup.part_content_set("button1", bt)
45 popup.show() 47 popup.show()
46 48
47def cb_popup_center_title_text_1button(li, item, win): 49def cb_popup_center_title_text_1button(li, item, win):
48 popup = Popup(win) 50 popup = Popup(win, size_hint_weight=EXPAND_BOTH)
49 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
50 popup.text = "This Popup has title area, content area and " \ 51 popup.text = "This Popup has title area, content area and " \
51 "action area set, action area has one button Close" 52 "action area set, action area has one button Close"
52 popup.part_text_set("title,text", "Title") 53 popup.part_text_set("title,text", "Title")
53 bt = Button(win) 54 bt = Button(win, text="Close")
54 bt.text = "Close"
55 bt.callback_clicked_add(cb_bnt_close, popup) 55 bt.callback_clicked_add(cb_bnt_close, popup)
56 popup.part_content_set("button1", bt) 56 popup.part_content_set("button1", bt)
57 popup.show() 57 popup.show()
58 58
59def cb_popup_center_title_text_block_clicked_event(li, item, win): 59def cb_popup_center_title_text_block_clicked_event(li, item, win):
60 popup = Popup(win) 60 popup = Popup(win, size_hint_weight=EXPAND_BOTH)
61 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
62 popup.text = "This Popup has title area and content area. " \ 61 popup.text = "This Popup has title area and content area. " \
63 "When clicked on blocked event region, popup gets deleted" 62 "When clicked on blocked event region, popup gets deleted"
64 popup.part_text_set("title,text", "Title") 63 popup.part_text_set("title,text", "Title")
@@ -66,102 +65,81 @@ def cb_popup_center_title_text_block_clicked_event(li, item, win):
66 popup.show() 65 popup.show()
67 66
68def cb_popup_bottom_title_text_3button(li, item, win): 67def cb_popup_bottom_title_text_3button(li, item, win):
69 popup = Popup(win) 68 popup = Popup(win, size_hint_weight=EXPAND_BOTH,
70 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 69 content_text_wrap_type=ELM_WRAP_CHAR)
71 popup.text = "This Popup has title area, content area and " \ 70 popup.text = "This Popup has title area, content area and " \
72 "action area set with content being character wrapped. " \ 71 "action area set with content being character wrapped. " \
73 "action area has three buttons OK, Cancel and Close" 72 "action area has three buttons OK, Cancel and Close"
74 popup.content_text_wrap_type = elementary.ELM_WRAP_CHAR
75 popup.part_text_set("title,text", "Title") 73 popup.part_text_set("title,text", "Title")
76 74
77 ic = Icon(win) 75 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
78 ic.file = "images/logo_small.png"
79 popup.part_content_set("title,icon", ic) 76 popup.part_content_set("title,icon", ic)
80 77
81 bt = Button(win) 78 bt = Button(win, text="OK")
82 bt.text = "OK"
83 popup.part_content_set("button1", bt) 79 popup.part_content_set("button1", bt)
84 80
85 bt = Button(win) 81 bt = Button(win, text="Cancel")
86 bt.text = "Cancel"
87 popup.part_content_set("button2", bt) 82 popup.part_content_set("button2", bt)
88 83
89 bt = Button(win) 84 bt = Button(win, text="Close")
90 bt.text = "Close"
91 bt.callback_clicked_add(cb_bnt_close, popup) 85 bt.callback_clicked_add(cb_bnt_close, popup)
92 popup.part_content_set("button3", bt) 86 popup.part_content_set("button3", bt)
93 87
94 popup.show() 88 popup.show()
95 89
96def cb_popup_center_title_content_3button(li, item, win): 90def cb_popup_center_title_content_3button(li, item, win):
97 popup = Popup(win) 91 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
98 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 92 bt = Button(win, text="Content", content=ic)
93
94 popup = Popup(win, size_hint_weight=EXPAND_BOTH, content=bt)
99 popup.part_text_set("title,text", "Title") 95 popup.part_text_set("title,text", "Title")
100 96
101 ic = Icon(win) 97 bt = Button(win, text="OK")
102 ic.file = "images/logo_small.png"
103 bt = Button(win)
104 bt.text = "Content"
105 bt.content = ic
106 popup.content = bt
107
108 bt = Button(win)
109 bt.text = "OK"
110 popup.part_content_set("button1", bt) 98 popup.part_content_set("button1", bt)
111 99
112 bt = Button(win) 100 bt = Button(win, text="Cancel")
113 bt.text = "Cancel"
114 popup.part_content_set("button2", bt) 101 popup.part_content_set("button2", bt)
115 102
116 bt = Button(win) 103 bt = Button(win, text="Close")
117 bt.text = "Close"
118 bt.callback_clicked_add(cb_bnt_close, popup) 104 bt.callback_clicked_add(cb_bnt_close, popup)
119 popup.part_content_set("button3", bt) 105 popup.part_content_set("button3", bt)
120 106
121 popup.show() 107 popup.show()
122 108
123def cb_popup_center_title_item_3button(li, item, win): 109def cb_popup_center_title_item_3button(li, item, win):
124 popup = Popup(win) 110 popup = Popup(win, size_hint_weight=EXPAND_BOTH)
125 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
126 popup.part_text_set("title,text", "Title") 111 popup.part_text_set("title,text", "Title")
127 112
128 for i in range(1, 11): 113 for i in range(1, 11):
129 if i in [3, 5, 6]: 114 if i in [3, 5, 6]:
130 ic = Icon(win) 115 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
131 ic.file = "images/logo_small.png"
132 popup.item_append("item"+str(i), ic) 116 popup.item_append("item"+str(i), ic)
133 else: 117 else:
134 popup.item_append("item"+str(i)) 118 popup.item_append("item"+str(i), None)
135 119
136 bt = Button(win) 120 bt = Button(win, text="OK")
137 bt.text = "OK"
138 popup.part_content_set("button1", bt) 121 popup.part_content_set("button1", bt)
139 122
140 bt = Button(win) 123 bt = Button(win, text="Cancel")
141 bt.text = "Cancel"
142 popup.part_content_set("button2", bt) 124 popup.part_content_set("button2", bt)
143 125
144 bt = Button(win) 126 bt = Button(win, text="Close")
145 bt.text = "Close"
146 bt.callback_clicked_add(cb_bnt_close, popup) 127 bt.callback_clicked_add(cb_bnt_close, popup)
147 popup.part_content_set("button3", bt) 128 popup.part_content_set("button3", bt)
148 129
149 popup.show() 130 popup.show()
150 131
151def cb_popup_center_title_text_2button_restack(li, item, win): 132def cb_popup_center_title_text_2button_restack(li, item, win):
152 popup = Popup(win) 133 popup = Popup(win, size_hint_weight=EXPAND_BOTH)
153 popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
154 popup.text = "When you click the 'Restack' button, " \ 134 popup.text = "When you click the 'Restack' button, " \
155 "an image will be located under this popup" 135 "an image will be located under this popup"
156 popup.part_text_set("title,text", "Title") 136 popup.part_text_set("title,text", "Title")
157 137
158 bt = Button(win) 138 bt = Button(win, text="Restack")
159 bt.text = "Restack"
160 bt.callback_clicked_add(cb_btn_restack, popup) 139 bt.callback_clicked_add(cb_btn_restack, popup)
161 popup.part_content_set("button1", bt) 140 popup.part_content_set("button1", bt)
162 141
163 bt = Button(win) 142 bt = Button(win, text="Close")
164 bt.text = "Close"
165 bt.callback_clicked_add(cb_bnt_close, popup) 143 bt.callback_clicked_add(cb_bnt_close, popup)
166 popup.part_content_set("button3", bt) 144 popup.part_content_set("button3", bt)
167 145
@@ -180,13 +158,11 @@ def cb_popup_center_text_1button_hide_show(li, item, win):
180 g_popup.show() 158 g_popup.show()
181 return 159 return
182 160
183 g_popup = Popup(win) 161 g_popup = Popup(win, size_hint_weight=EXPAND_BOTH)
184 g_popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
185 g_popup.text = "Hide this popup by using the button." \ 162 g_popup.text = "Hide this popup by using the button." \
186 "When you click list item again, you will see this popup again." 163 "When you click list item again, you will see this popup again."
187 164
188 bt = Button(win) 165 bt = Button(win, text="Hide")
189 bt.text = "Hide"
190 bt.callback_clicked_add(lambda b: g_popup.hide()) 166 bt.callback_clicked_add(lambda b: g_popup.hide())
191 g_popup.part_content_set("button1", bt) 167 g_popup.part_content_set("button1", bt)
192 168
@@ -194,20 +170,11 @@ def cb_popup_center_text_1button_hide_show(li, item, win):
194 170
195 171
196def popup_clicked(obj): 172def popup_clicked(obj):
197 win = Window("popup", elementary.ELM_WIN_BASIC) 173 win = StandardWindow("popup", "Popup test", autodel=True, size=(480, 800))
198 win.title_set("Popup test")
199 win.autodel_set(True)
200 if obj is None: 174 if obj is None:
201 win.callback_delete_request_add(lambda o: elementary.exit()) 175 win.callback_delete_request_add(lambda o: elementary.exit())
202 176
203 bg = Background(win) 177 li = List(win, mode=ELM_LIST_LIMIT, size_hint_weight=EXPAND_BOTH)
204 win.resize_object_add(bg)
205 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
206 bg.show()
207
208 li = List(win)
209 li.mode = elementary.ELM_LIST_LIMIT
210 li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
211 li.callback_selected_add(lambda li, it: it.selected_set(False)) 178 li.callback_selected_add(lambda li, it: it.selected_set(False))
212 win.resize_object_add(li) 179 win.resize_object_add(li)
213 li.show() 180 li.show()
@@ -232,7 +199,7 @@ def popup_clicked(obj):
232 cb_popup_center_text_1button_hide_show, win) 199 cb_popup_center_text_1button_hide_show, win)
233 200
234 li.go() 201 li.go()
235 win.resize(480, 800) 202
236 win.show() 203 win.show()
237 204
238 205
diff --git a/examples/elementary/test_progressbar.py b/examples/elementary/test_progressbar.py
index d5f4028..50d0999 100644
--- a/examples/elementary/test_progressbar.py
+++ b/examples/elementary/test_progressbar.py
@@ -1,16 +1,25 @@
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
5from efl import ecore 5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
7 EVAS_ASPECT_CONTROL_VERTICAL, EVAS_ASPECT_CONTROL_HORIZONTAL, FilledImage
8from efl.ecore import Timer, ECORE_CALLBACK_RENEW, ECORE_CALLBACK_CANCEL
6from efl import elementary 9from efl import elementary
7from efl.elementary.window import StandardWindow 10from efl.elementary.window import StandardWindow
8from efl.elementary.background import Background
9from efl.elementary.box import Box 11from efl.elementary.box import Box
10from efl.elementary.button import Button 12from efl.elementary.button import Button
11from efl.elementary.icon import Icon 13from efl.elementary.icon import Icon
12from efl.elementary.progressbar import Progressbar 14from efl.elementary.progressbar import Progressbar
13 15
16EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
17FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
18FILL_HORIZ = EVAS_HINT_FILL, 0.5
19
20script_path = os.path.dirname(os.path.abspath(__file__))
21img_path = os.path.join(script_path, "images")
22
14 23
15my_progressbar_run = False 24my_progressbar_run = False
16my_progressbar_timer = None 25my_progressbar_timer = None
@@ -25,13 +34,13 @@ def pb_timer_cb(pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8):
25 pb4.value_set(progress) 34 pb4.value_set(progress)
26 pb3.value_set(progress) 35 pb3.value_set(progress)
27 pb6.value_set(progress) 36 pb6.value_set(progress)
28 pb8.part_value_set("elm.cur.progressbar", progress * 1.50) 37 pb8.part_value_set("elm.cur.progressbar", progress)
29 pb8.part_value_set("elm.cur.progressbar1", progress) 38 pb8.part_value_set("elm.cur.progressbar1", progress * 1.50)
30 if progress < 1.0: 39 if progress < 1.0:
31 return ecore.ECORE_CALLBACK_RENEW 40 return ECORE_CALLBACK_RENEW
32 global my_progressbar_run 41 global my_progressbar_run
33 my_progressbar_run = False 42 my_progressbar_run = False
34 return ecore.ECORE_CALLBACK_CANCEL 43 return ECORE_CALLBACK_CANCEL
35 44
36def begin_test(obj, *args, **kwargs): 45def begin_test(obj, *args, **kwargs):
37 (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8) = args 46 (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8) = args
@@ -41,8 +50,7 @@ def begin_test(obj, *args, **kwargs):
41 global my_progressbar_run 50 global my_progressbar_run
42 global my_progressbar_timer 51 global my_progressbar_timer
43 if not my_progressbar_run: 52 if not my_progressbar_run:
44 my_progressbar_timer = ecore.timer_add(0.1, pb_timer_cb, 53 my_progressbar_timer = Timer(0.1, pb_timer_cb, *args)
45 *args)
46 my_progressbar_run = True 54 my_progressbar_run = True
47 55
48def end_test(obj, pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8): 56def end_test(obj, pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8):
@@ -64,118 +72,78 @@ def progressbar_clicked(obj):
64 if obj is None: 72 if obj is None:
65 win.callback_delete_request_add(lambda o: elementary.exit()) 73 win.callback_delete_request_add(lambda o: elementary.exit())
66 74
67 bx = Box(win) 75 bx = Box(win, size_hint_weight=EXPAND_BOTH)
68 win.resize_object_add(bx) 76 win.resize_object_add(bx)
69 bx.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
70 bx.show() 77 bx.show()
71 78
72 pb1 = Progressbar(win) 79 pb1 = Progressbar(win, span_size=300, size_hint_weight=EXPAND_BOTH,
73 pb1.span_size = 300 80 size_hint_align=FILL_HORIZ)
74 pb1.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
75 pb1.size_hint_align = evas.EVAS_HINT_FILL, 0.5
76 bx.pack_end(pb1) 81 bx.pack_end(pb1)
77 pb1.show() 82 pb1.show()
78 83
79 pb2 = Progressbar(win) 84 pb2 = Progressbar(win, size_hint_weight=EXPAND_BOTH,
80 pb2.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND 85 size_hint_align=FILL_HORIZ, text="Infinite bounce", pulse_mode=True)
81 pb2.size_hint_align = evas.EVAS_HINT_FILL, 0.5
82 pb2.text = "Infinite bounce"
83 pb2.pulse_mode = True
84 bx.pack_end(pb2) 86 bx.pack_end(pb2)
85 pb2.show() 87 pb2.show()
86 88
87 ic1 = Icon(win) 89 ic1 = Icon(win, file=os.path.join(img_path, "logo_small.png"),
88 ic1.file = 'images/logo_small.png' 90 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
89 ic1.size_hint_aspect = evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1 91
90 92 pb3 = Progressbar(win, text="Inverted", content=ic1, inverted=True,
91 pb3 = Progressbar(win) 93 unit_format="%1.1f units", size_hint_align=FILL_HORIZ,
92 pb3.text = "Inverted" 94 size_hint_weight=EXPAND_BOTH)
93 pb3.content = ic1
94 pb3.inverted = True
95 pb3.unit_format = "%1.1f units"
96 pb3.size_hint_align = evas.EVAS_HINT_FILL, 0.5
97 pb3.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
98 bx.pack_end(pb3) 95 bx.pack_end(pb3)
99 ic1.show() 96 ic1.show()
100 pb3.show() 97 pb3.show()
101 98
102 pb8 = Progressbar(win) 99 pb8 = Progressbar(win, style="double", text="Style: double",
103 pb8.style = "recording" 100 size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_BOTH)
104 pb8.text = "Style: recording"
105 pb8.size_hint_align = evas.EVAS_HINT_FILL, 0.5
106 pb8.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
107 bx.pack_end(pb8) 101 bx.pack_end(pb8)
108 pb8.show() 102 pb8.show()
109 103
110 hbx = Box(win) 104 hbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH,
111 hbx.horizontal = True 105 size_hint_align=FILL_BOTH)
112 hbx.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
113 hbx.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
114 bx.pack_end(hbx) 106 bx.pack_end(hbx)
115 hbx.show() 107 hbx.show()
116 108
117 pb4 = Progressbar(win) 109 pb4 = Progressbar(win, horizontal=False, size_hint_weight=EXPAND_BOTH,
118 pb4.horizontal = False 110 size_hint_align=FILL_BOTH, span_size=60, text="Vertical")
119 pb4.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
120 pb4.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
121 hbx.pack_end(pb4) 111 hbx.pack_end(pb4)
122 pb4.span_size = 60
123 pb4.text = "Vertical"
124 pb4.show() 112 pb4.show()
125 113
126 pb5 = Progressbar(win) 114 pb5 = Progressbar(win, horizontal=False, size_hint_weight=EXPAND_BOTH,
127 pb5.horizontal = False 115 size_hint_align=FILL_HORIZ, span_size=120, pulse_mode=True,
128 pb5.size_hint_align = evas.EVAS_HINT_FILL, 0.5 116 unit_format=None, text="Infinite bounce")
129 pb5.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
130 pb5.span_size = 120
131 pb5.pulse_mode = True
132 pb5.unit_format = None
133 pb5.text = "Infinite bounce"
134 hbx.pack_end(pb5) 117 hbx.pack_end(pb5)
135 pb5.show() 118 pb5.show()
136 119
137 ic2 = Icon(win) 120 ic2 = Icon(win, file=os.path.join(img_path, "logo_small.png"),
138 ic2.file = 'images/logo_small.png' 121 size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1))
139 ic2.size_hint_aspect = evas.EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1 122
140 123 pb6 = Progressbar(win, horizontal=False, text="Inverted", content=ic2,
141 pb6 = Progressbar(win) 124 inverted=True, unit_format="%1.2f%%", span_size=200,
142 pb6.horizontal = False 125 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
143 pb6.text = "Inverted"
144 pb6.content = ic2
145 pb6.inverted = True
146 pb6.unit_format = "%1.2f%%"
147 pb6.span_size = 200
148 pb6.size_hint_align = evas.EVAS_HINT_FILL, 0.5
149 pb6.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
150 hbx.pack_end(pb6) 126 hbx.pack_end(pb6)
151 ic2.show() 127 ic2.show()
152 pb6.show() 128 pb6.show()
153 129
154 pb7 = Progressbar(win) 130 pb7 = Progressbar(win, style="wheel", text="Style: wheel", pulse_mode=True,
155 pb7.style = "wheel" 131 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
156 pb7.text = "Style: wheel"
157 pb7.pulse_mode = True
158 pb7.size_hint_align = evas.EVAS_HINT_FILL, 0.5
159 pb7.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
160 bx.pack_end(pb7) 132 bx.pack_end(pb7)
161 pb7.show() 133 pb7.show()
162 134
163 bt_bx = Box(win) 135 bt_bx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
164 bt_bx.horizontal = True
165 bt_bx.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
166 bx.pack_end(bt_bx) 136 bx.pack_end(bt_bx)
167 bt_bx.show() 137 bt_bx.show()
168 138
169 pbt = (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8) 139 pbt = (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8)
170 140
171 bt = Button(win) 141 bt = Button(win, text="Start")
172 bt.text = "Start"
173 bt.callback_clicked_add(begin_test, *pbt) 142 bt.callback_clicked_add(begin_test, *pbt)
174 bt_bx.pack_end(bt) 143 bt_bx.pack_end(bt)
175 bt.show() 144 bt.show()
176 145
177 bt = Button(win) 146 bt = Button(win, text="Stop")
178 bt.text = "Stop"
179 bt.callback_clicked_add(end_test, *pbt) 147 bt.callback_clicked_add(end_test, *pbt)
180 bt_bx.pack_end(bt) 148 bt_bx.pack_end(bt)
181 bt.show() 149 bt.show()
diff --git a/examples/elementary/test_radio.py b/examples/elementary/test_radio.py
index fd3d050..a396b45 100644
--- a/examples/elementary/test_radio.py
+++ b/examples/elementary/test_radio.py
@@ -1,97 +1,76 @@
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, \
7 EVAS_ASPECT_CONTROL_VERTICAL
5from efl import elementary 8from efl import elementary
6from efl.elementary.window import Window 9from efl.elementary.window import StandardWindow
7from efl.elementary.background import Background
8from efl.elementary.box import Box 10from efl.elementary.box import Box
9from efl.elementary.icon import Icon 11from efl.elementary.icon import Icon
10from efl.elementary.radio import Radio 12from efl.elementary.radio import Radio
11 13
14EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
15FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
16FILL_HORIZ = EVAS_HINT_FILL, 0.5
17
18script_path = os.path.dirname(os.path.abspath(__file__))
19img_path = os.path.join(script_path, "images")
12 20
13def radio_clicked(obj): 21def radio_clicked(obj):
14 win = Window("radio", elementary.ELM_WIN_BASIC) 22 win = StandardWindow("radio", "Radio test", autodel=True)
15 win.title_set("Radio test")
16 win.autodel_set(True)
17 if obj is None: 23 if obj is None:
18 win.callback_delete_request_add(lambda o: elementary.exit()) 24 win.callback_delete_request_add(lambda o: elementary.exit())
19 25
20 bg = Background(win) 26 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 bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
27 win.resize_object_add(bx) 27 win.resize_object_add(bx)
28 bx.show() 28 bx.show()
29 29
30 ic = Icon(win) 30 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
31 ic.file_set('images/logo_small.png') 31 size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
32 ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) 32 rd = Radio(win, state_value=0, size_hint_weight=EXPAND_BOTH,
33 rd = Radio(win) 33 size_hint_align=FILL_HORIZ, text="Icon sized to radio", content=ic)
34 rd.state_value_set(0)
35 rd.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
36 rd.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
37 rd.text_set("Icon sized to radio")
38 rd.content_set(ic)
39 bx.pack_end(rd) 34 bx.pack_end(rd)
40 rd.show() 35 rd.show()
41 ic.show() 36 ic.show()
42 rdg = rd 37 rdg = rd
43 38
44 ic = Icon(win) 39 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
45 ic.file_set('images/logo_small.png') 40 resizable=(False, False))
46 ic.resizable_set(0, 0) 41 rd = Radio(win, state_value=1, text="Icon no scale", content=ic)
47 rd = Radio(win)
48 rd.state_value_set(1)
49 rd.group_add(rdg) 42 rd.group_add(rdg)
50 rd.text_set("Icon no scale")
51 rd.content_set(ic)
52 bx.pack_end(rd) 43 bx.pack_end(rd)
53 rd.show() 44 rd.show()
54 ic.show() 45 ic.show()
55 46
56 rd = Radio(win) 47 rd = Radio(win, state_value=2, text="Label Only")
57 rd.state_value_set(2)
58 rd.group_add(rdg) 48 rd.group_add(rdg)
59 rd.text_set("Label Only")
60 bx.pack_end(rd) 49 bx.pack_end(rd)
61 rd.show() 50 rd.show()
62 51
63 rd = Radio(win) 52 rd = Radio(win, state_value=3, text="Disabled", disabled=True)
64 rd.state_value_set(3)
65 rd.group_add(rdg) 53 rd.group_add(rdg)
66 rd.text_set("Disabled")
67 rd.disabled_set(True)
68 bx.pack_end(rd) 54 bx.pack_end(rd)
69 rd.show() 55 rd.show()
70 56
71 ic = Icon(win) 57 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
72 ic.file_set('images/logo_small.png') 58 resizable=(False, False))
73 ic.resizable_set(0, 0) 59 rd = Radio(win, state_value=4, content=ic)
74 rd = Radio(win)
75 rd.state_value_set(4)
76 rd.group_add(rdg) 60 rd.group_add(rdg)
77 rd.content_set(ic)
78 bx.pack_end(rd) 61 bx.pack_end(rd)
79 rd.show() 62 rd.show()
80 ic.show() 63 ic.show()
81 64
82 ic = Icon(win) 65 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
83 ic.file_set('images/logo_small.png') 66 resizable=(False, False))
84 ic.resizable_set(0, 0) 67 rd = Radio(win, state_value=5, content=ic, disabled=True)
85 rd = Radio(win)
86 rd.state_value_set(5)
87 rd.group_add(rdg) 68 rd.group_add(rdg)
88 rd.content_set(ic)
89 rd.disabled_set(True)
90 bx.pack_end(rd) 69 bx.pack_end(rd)
91 rd.show() 70 rd.show()
92 ic.show() 71 ic.show()
93 72
94 rdg.value_set(2) 73 rdg.value = 2
95 74
96 win.show() 75 win.show()
97 76
diff --git a/examples/elementary/test_scroller.py b/examples/elementary/test_scroller.py
index 933b277..53c0bf6 100644
--- a/examples/elementary/test_scroller.py
+++ b/examples/elementary/test_scroller.py
@@ -1,14 +1,23 @@
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.button import Button 10from efl.elementary.button import Button
9from efl.elementary.scroller import Scroller 11from efl.elementary.scroller import Scroller
10from efl.elementary.table import Table 12from efl.elementary.table import Table
11 13
14EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
15EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
16FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
17FILL_HORIZ = EVAS_HINT_FILL, 0.5
18
19script_path = os.path.dirname(os.path.abspath(__file__))
20img_path = os.path.join(script_path, "images")
12 21
13def my_scroller_go_300_300(bt, sc): 22def my_scroller_go_300_300(bt, sc):
14 sc.region_bring_in(300, 300, 318, 318) 23 sc.region_bring_in(300, 300, 318, 318)
@@ -23,56 +32,46 @@ def my_scroller_go_900_900(obj, sc):
23 sc.region_bring_in(900, 900, 318, 318) 32 sc.region_bring_in(900, 900, 318, 318)
24 33
25def cb_edges(obj, border): 34def cb_edges(obj, border):
26 print(("Border callback:", border)) 35 print("Border callback: " + border)
27 36
28def cb_drags(obj, action): 37def cb_drags(obj, action):
29 print(("Drag callback:", action)) 38 print("Drag callback: " + action)
30 39
31def cb_anims(obj, action): 40def cb_anims(obj, action):
32 print(("Anim callback:", action)) 41 print("Anim callback: " + action)
33 42
34def scroller_clicked(obj): 43def scroller_clicked(obj):
35 win = Window("scroller", elementary.ELM_WIN_BASIC) 44 win = StandardWindow("scroller", "Scroller", autodel=True, size=(320, 320))
36 win.title_set("Scroller")
37 win.autodel_set(True)
38 if obj is None: 45 if obj is None:
39 win.callback_delete_request_add(lambda o: elementary.exit()) 46 win.callback_delete_request_add(lambda o: elementary.exit())
40 47
41 bg = Background(win) 48 tb = Table(win, size_hint_weight=EXPAND_BOTH)
42 win.resize_object_add(bg)
43 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
44 bg.show()
45
46 tb = Table(win)
47 tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
48 49
49 img = ["images/panel_01.jpg", 50 img = ["panel_01.jpg",
50 "images/plant_01.jpg", 51 "plant_01.jpg",
51 "images/rock_01.jpg", 52 "rock_01.jpg",
52 "images/rock_02.jpg", 53 "rock_02.jpg",
53 "images/sky_01.jpg", 54 "sky_01.jpg",
54 "images/sky_02.jpg", 55 "sky_02.jpg",
55 "images/sky_03.jpg", 56 "sky_03.jpg",
56 "images/sky_04.jpg", 57 "sky_04.jpg",
57 "images/wood_01.jpg"] 58 "wood_01.jpg"]
58 59
59 n = 0 60 n = 0
60 for j in range(12): 61 for j in range(12):
61 for i in range(12): 62 for i in range(12):
62 bg2 = Background(win) 63 bg2 = Background(win, file=os.path.join(img_path, img[n]),
63 bg2.file_set(img[n]) 64 size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
65 size_hint_min=(318, 318))
64 66
65 n = n + 1 67 n = n + 1
66 if n >= 9: 68 if n >= 9:
67 n = 0 69 n = 0
68 bg2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
69 bg2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
70 bg2.size_hint_min_set(318, 318)
71 tb.pack(bg2, i, j, 1, 1) 70 tb.pack(bg2, i, j, 1, 1)
72 bg2.show() 71 bg2.show()
73 72
74 sc = Scroller(win) 73 sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb,
75 sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 74 page_relative=(1.0, 1.0))
76 sc.callback_edge_top_add(cb_edges, "top") 75 sc.callback_edge_top_add(cb_edges, "top")
77 sc.callback_edge_bottom_add(cb_edges, "bottom") 76 sc.callback_edge_bottom_add(cb_edges, "bottom")
78 sc.callback_edge_left_add(cb_edges, "left") 77 sc.callback_edge_left_add(cb_edges, "left")
@@ -83,51 +82,39 @@ def scroller_clicked(obj):
83 sc.callback_scroll_anim_stop_add(cb_anims, "stop") 82 sc.callback_scroll_anim_stop_add(cb_anims, "stop")
84 win.resize_object_add(sc) 83 win.resize_object_add(sc)
85 84
86 sc.content_set(tb)
87 tb.show() 85 tb.show()
88 86
89 sc.page_relative_set(1.0, 1.0)
90 sc.show() 87 sc.show()
91 88
92 tb2 = Table(win) 89 tb2 = Table(win, size_hint_weight=EXPAND_BOTH)
93 tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
94 win.resize_object_add(tb2) 90 win.resize_object_add(tb2)
95 91
96 bt = Button(win) 92 bt = Button(win, text="to 300 300", size_hint_weight=EXPAND_BOTH,
97 bt.text_set("to 300 300") 93 size_hint_align=(0.1, 0.1))
98 bt.callback_clicked_add(my_scroller_go_300_300, sc) 94 bt.callback_clicked_add(my_scroller_go_300_300, sc)
99 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
100 bt.size_hint_align_set(0.1, 0.1)
101 tb2.pack(bt, 0, 0, 1, 1) 95 tb2.pack(bt, 0, 0, 1, 1)
102 bt.show() 96 bt.show()
103 97
104 bt = Button(win) 98 bt = Button(win, text="to 900 300", size_hint_weight=EXPAND_BOTH,
105 bt.text_set("to 900 300") 99 size_hint_align=(0.9, 0.1))
106 bt.callback_clicked_add(my_scroller_go_900_300, sc) 100 bt.callback_clicked_add(my_scroller_go_900_300, sc)
107 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
108 bt.size_hint_align_set(0.9, 0.1)
109 tb2.pack(bt, 1, 0, 1, 1) 101 tb2.pack(bt, 1, 0, 1, 1)
110 bt.show() 102 bt.show()
111 103
112 bt = Button(win) 104 bt = Button(win, text="to 300 900", size_hint_weight=EXPAND_BOTH,
113 bt.text_set("to 300 900") 105 size_hint_align=(0.1, 0.9))
114 bt.callback_clicked_add(my_scroller_go_300_900, sc) 106 bt.callback_clicked_add(my_scroller_go_300_900, sc)
115 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
116 bt.size_hint_align_set(0.1, 0.9)
117 tb2.pack(bt, 0, 1, 1, 1) 107 tb2.pack(bt, 0, 1, 1, 1)
118 bt.show() 108 bt.show()
119 109
120 bt = Button(win) 110 bt = Button(win, text="to 900 900", size_hint_weight=EXPAND_BOTH,
121 bt.text_set("to 900 900") 111 size_hint_align=(0.9, 0.9))
122 bt.callback_clicked_add(my_scroller_go_900_900, sc) 112 bt.callback_clicked_add(my_scroller_go_900_900, sc)
123 bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
124 bt.size_hint_align_set(0.9, 0.9)
125 tb2.pack(bt, 1, 1, 1, 1) 113 tb2.pack(bt, 1, 1, 1, 1)
126 bt.show() 114 bt.show()
127 115
128 tb2.show() 116 tb2.show()
129 117
130 win.resize(320, 320)
131 win.show() 118 win.show()
132 119
133 120
diff --git a/examples/elementary/test_segment_control.py b/examples/elementary/test_segment_control.py
index 51b247f..9fb109f 100644
--- a/examples/elementary/test_segment_control.py
+++ b/examples/elementary/test_segment_control.py
@@ -1,110 +1,98 @@
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.icon import Icon 10from efl.elementary.icon import Icon
10from efl.elementary.segment_control import SegmentControl 11from efl.elementary.segment_control import SegmentControl
11 12
13EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
14EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
15FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
16FILL_HORIZ = EVAS_HINT_FILL, 0.5
17
18script_path = os.path.dirname(os.path.abspath(__file__))
19img_path = os.path.join(script_path, "images")
12 20
13def cb_seg_changed(seg, item): 21def cb_seg_changed(seg, item):
14 print(seg) 22 print(seg)
15 print(item) 23 print(item)
16 24
17def segment_control_clicked(obj): 25def segment_control_clicked(obj):
18 win = Window("segment-control", elementary.ELM_WIN_BASIC) 26 win = StandardWindow("segment-control", "Segment Control test",
19 win.title_set("Segment Control test") 27 autodel=True, size=(320, 280))
20 win.autodel_set(True)
21 if obj is None: 28 if obj is None:
22 win.callback_delete_request_add(lambda o: elementary.exit()) 29 win.callback_delete_request_add(lambda o: elementary.exit())
23 30
24 bg = Background(win) 31 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
25 win.resize_object_add(bg)
26 bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
27 bg.show()
28
29 vbox = Box(win)
30 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
31 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
32 win.resize_object_add(vbox) 32 win.resize_object_add(vbox)
33 vbox.show() 33 vbox.show()
34 34
35 # segment 1 35 # segment 1
36 seg = SegmentControl(win) 36 seg = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
37 seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 37 size_hint_align=FILL_HORIZ)
38 seg.size_hint_align = (evas.EVAS_HINT_FILL,0.5)
39 seg.item_add(None, "Only Text") 38 seg.item_add(None, "Only Text")
40 ic = Icon(win) 39 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
41 ic.file = "images/logo_small.png"
42 it = seg.item_add(ic) 40 it = seg.item_add(ic)
43 ic = Icon(win) 41 ic = Icon(win)
44 ic.file = "images/logo_small.png" 42 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
45 seg.item_add(ic, "Text + Icon") 43 seg.item_add(ic, "Text + Icon")
46 seg.item_add(None, "Seg4") 44 seg.item_add(None, "Seg4")
47 seg.item_add(None, "Seg5") 45 seg.item_add(None, "Seg5")
48 46
49 seg.callback_changed_add(cb_seg_changed) 47 seg.callback_changed_add(cb_seg_changed)
50 # it.selected_set(True) 48 it.selected = True
51 vbox.pack_end(seg) 49 vbox.pack_end(seg)
52 seg.show() 50 seg.show()
53 51
54 # segment 2 52 # segment 2
55 seg = SegmentControl(win) 53 seg = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
56 seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 54 size_hint_align=FILL_HORIZ)
57 seg.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
58 seg.item_add(None, "SegmentItem") 55 seg.item_add(None, "SegmentItem")
59 it = seg.item_add(None, "SegmentItem") 56 it = seg.item_add(None, "SegmentItem")
60 seg.item_add(None, "SegmentItem") 57 seg.item_add(None, "SegmentItem")
61 seg.item_add(None, "SegmentItem") 58 seg.item_add(None, "SegmentItem")
62 59
63 print(it) 60 it.selected = True
64 # it.selected_set(True)
65 vbox.pack_end(seg) 61 vbox.pack_end(seg)
66 seg.show() 62 seg.show()
67 63
68 # segment 3 64 # segment 3
69 seg = SegmentControl(win) 65 seg = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
70 seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 66 size_hint_align=(0.5, 0.5))
71 seg.size_hint_align = (0.5, 0.5)
72 67
73 for i in range(3): 68 for i in range(3):
74 ic = Icon(win) 69 ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
75 ic.file = "images/logo_small.png"
76 if i == 1: 70 if i == 1:
77 it = seg.item_add(ic) 71 it = seg.item_add(ic)
78 else: 72 else:
79 seg.item_add(ic) 73 seg.item_add(ic)
80 74
81 # it.selected_set(True) 75 it.selected = True
82 vbox.pack_end(seg) 76 vbox.pack_end(seg)
83 seg.show() 77 seg.show()
84 78
85 # segment 4 79 # segment 4
86 seg = SegmentControl(win)