summaryrefslogtreecommitdiff
path: root/examples/elementary/test_mapbuf.py
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-03-01 21:01:50 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-03-01 21:01:50 +0000
commit0873fe162131bf672245e51d2670fc1ce822cfdd (patch)
tree4fa8667a51105ad846560dafe7e8fe64d935e616 /examples/elementary/test_mapbuf.py
parente02e6491d4d7902df7c326e98d5a061a6bc3fccf (diff)
Do not import EVERY widget while importing efl.elementary
Now the user is responsable of importing the widget used one by one, this should be a great speedup in the launch of the app. You have to import stuff in this way: from efl import evas from efl import elementary from efl.elementary.window import Window from efl.elementary.layout import Layout ...sorry for the inconvenience SVN revision: 84402
Diffstat (limited to 'examples/elementary/test_mapbuf.py')
-rw-r--r--examples/elementary/test_mapbuf.py42
1 files changed, 26 insertions, 16 deletions
diff --git a/examples/elementary/test_mapbuf.py b/examples/elementary/test_mapbuf.py
index 39db81a..495796c 100644
--- a/examples/elementary/test_mapbuf.py
+++ b/examples/elementary/test_mapbuf.py
@@ -1,8 +1,18 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# encoding: utf-8 2# encoding: utf-8
3 3
4from efl import elementary
5from efl import evas 4from efl import evas
5from efl import elementary
6from efl.elementary.window import Window
7from efl.elementary.background import Background
8from efl.elementary.box import Box
9from efl.elementary.button import Button
10from efl.elementary.check import Check
11from efl.elementary.label import Label
12from efl.elementary.icon import Icon
13from efl.elementary.mapbuf import Mapbuf
14from efl.elementary.scroller import Scroller
15from efl.elementary.table import Table
6 16
7 17
8names = [ "Hello", "World", "Spam", "Egg", "Ham", "Good", "Bad", "Milk", 18names = [ "Hello", "World", "Spam", "Egg", "Ham", "Good", "Bad", "Milk",
@@ -32,39 +42,39 @@ def cb_ck_fs(ck, win):
32def mapbuf_clicked(obj, item=None): 42def mapbuf_clicked(obj, item=None):
33 global mb_list 43 global mb_list
34 44
35 win = elementary.Window("mapbuf", elementary.ELM_WIN_BASIC) 45 win = Window("mapbuf", elementary.ELM_WIN_BASIC)
36 win.title_set("Mapbuf test") 46 win.title_set("Mapbuf test")
37 win.autodel_set(True) 47 win.autodel_set(True)
38 if obj is None: 48 if obj is None:
39 win.callback_delete_request_add(lambda o: elementary.exit()) 49 win.callback_delete_request_add(lambda o: elementary.exit())
40 50
41 bg = elementary.Background(win) 51 bg = Background(win)
42 bg.file = "images/sky_04.jpg" 52 bg.file = "images/sky_04.jpg"
43 win.resize_object_add(bg) 53 win.resize_object_add(bg)
44 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 54 bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
45 bg.show() 55 bg.show()
46 56
47 vbox = elementary.Box(win) 57 vbox = Box(win)
48 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 58 vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
49 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 59 vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
50 win.resize_object_add(vbox) 60 win.resize_object_add(vbox)
51 vbox.show() 61 vbox.show()
52 62
53 # launcher 63 # launcher
54 sc = elementary.Scroller(win); 64 sc = Scroller(win);
55 sc.bounce = (True, False) 65 sc.bounce = (True, False)
56 sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_OFF) 66 sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_OFF)
57 sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 67 sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
58 sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) 68 sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
59 vbox.pack_end(sc) 69 vbox.pack_end(sc)
60 70
61 bx = elementary.Box(win) 71 bx = Box(win)
62 bx.horizontal = True 72 bx.horizontal = True
63 bx.homogeneous = True 73 bx.homogeneous = True
64 bx.show() 74 bx.show()
65 75
66 for k in range(8): 76 for k in range(8):
67 tb = elementary.Table(win) 77 tb = Table(win)
68 tb.size_hint_align = (0.5, 0.5) 78 tb.size_hint_align = (0.5, 0.5)
69 tb.size_hint_weight = (0.0, 0.0) 79 tb.size_hint_weight = (0.0, 0.0)
70 tb.show() 80 tb.show()
@@ -101,7 +111,7 @@ def mapbuf_clicked(obj, item=None):
101 pad.show() 111 pad.show()
102 tb.pack(pad, 6, 1, 1, 10) 112 tb.pack(pad, 6, 1, 1, 10)
103 113
104 mb = elementary.Mapbuf(win) 114 mb = Mapbuf(win)
105 mb_list.append(mb) 115 mb_list.append(mb)
106 mb.content = tb 116 mb.content = tb
107 bx.pack_end(mb) 117 bx.pack_end(mb)
@@ -110,7 +120,7 @@ def mapbuf_clicked(obj, item=None):
110 n = m = 0 120 n = m = 0
111 for j in range(5): 121 for j in range(5):
112 for i in range(5): 122 for i in range(5):
113 ic = elementary.Icon(win) 123 ic = Icon(win)
114 ic.scale_set(0.5) 124 ic.scale_set(0.5)
115 ic.file_set("images/icon_%02d.png" % (n)); 125 ic.file_set("images/icon_%02d.png" % (n));
116 ic.resizable_set(0, 0) 126 ic.resizable_set(0, 0)
@@ -119,7 +129,7 @@ def mapbuf_clicked(obj, item=None):
119 tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1) 129 tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
120 ic.show() 130 ic.show()
121 131
122 lb = elementary.Label(win) 132 lb = Label(win)
123 lb.style = "marker" 133 lb.style = "marker"
124 lb.text = names[m] 134 lb.text = names[m]
125 tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1) 135 tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
@@ -133,7 +143,7 @@ def mapbuf_clicked(obj, item=None):
133 sc.show() 143 sc.show()
134 144
135 # controls 145 # controls
136 hbox = elementary.Box(win) 146 hbox = Box(win)
137 hbox.horizontal = True 147 hbox.horizontal = True
138 hbox.homogeneous = True 148 hbox.homogeneous = True
139 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) 149 hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
@@ -141,35 +151,35 @@ def mapbuf_clicked(obj, item=None):
141 vbox.pack_start(hbox) 151 vbox.pack_start(hbox)
142 hbox.show() 152 hbox.show()
143 153
144 ck = elementary.Check(win) 154 ck = Check(win)
145 ck.text = "Map" 155 ck.text = "Map"
146 ck.state = False 156 ck.state = False
147 ck.callback_changed_add(cb_ck_map) 157 ck.callback_changed_add(cb_ck_map)
148 hbox.pack_end(ck) 158 hbox.pack_end(ck)
149 ck.show() 159 ck.show()
150 160
151 ck = elementary.Check(win) 161 ck = Check(win)
152 ck.callback_changed_add(cb_ck_alpha) 162 ck.callback_changed_add(cb_ck_alpha)
153 ck.text = "Alpha" 163 ck.text = "Alpha"
154 ck.state = True 164 ck.state = True
155 hbox.pack_end(ck) 165 hbox.pack_end(ck)
156 ck.show() 166 ck.show()
157 167
158 ck = elementary.Check(win) 168 ck = Check(win)
159 ck.callback_changed_add(cb_ck_smooth) 169 ck.callback_changed_add(cb_ck_smooth)
160 ck.text = "Smooth" 170 ck.text = "Smooth"
161 ck.state = True 171 ck.state = True
162 hbox.pack_end(ck) 172 hbox.pack_end(ck)
163 ck.show() 173 ck.show()
164 174
165 ck = elementary.Check(win) 175 ck = Check(win)
166 ck.callback_changed_add(cb_ck_fs, win) 176 ck.callback_changed_add(cb_ck_fs, win)
167 ck.text = "FS" 177 ck.text = "FS"
168 ck.state = False 178 ck.state = False
169 hbox.pack_end(ck) 179 hbox.pack_end(ck)
170 ck.show() 180 ck.show()
171 181
172 bt = elementary.Button(win) 182 bt = Button(win)
173 bt.text = "Close" 183 bt.text = "Close"
174 bt.callback_clicked_add(cb_btn_close, win) 184 bt.callback_clicked_add(cb_btn_close, win)
175 bt.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) 185 bt.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)