summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-02-26 21:29:11 +0100
committerDave Andreoli <dave@gurumeditation.it>2017-02-26 21:29:11 +0100
commita293b4e1244cf924174d02df3fd1d4d1e4c01117 (patch)
treeb3ceb4bae6839c6dfbf4c8995f3c2dff38a12c21
parente3224c882ae1e366d4380a22ea3ac1e8fe9804c7 (diff)
Split 2 elm.Image tests in 2 files
-rwxr-xr-xexamples/elementary/test.py4
-rw-r--r--examples/elementary/test_image.py96
-rw-r--r--examples/elementary/test_image_memfile.py38
3 files changed, 59 insertions, 79 deletions
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index 312af39..bcb5aa5 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -155,8 +155,8 @@ items = [
155 ("Icon", "test_icon", "icon_clicked"), 155 ("Icon", "test_icon", "icon_clicked"),
156 ("Icon Transparent", "test_icon", "icon_transparent_clicked"), 156 ("Icon Transparent", "test_icon", "icon_transparent_clicked"),
157 ("Icon Standard", "test_icon", "icon_standard_clicked"), 157 ("Icon Standard", "test_icon", "icon_standard_clicked"),
158 ("Image", "test_image", "image_clicked"), 158 ("Image", "test_image", "test_image"),
159 ("Image with memfile", "test_image", "image2_clicked"), 159 ("Image with memfile", "test_image_memfile", "test_image_memfile"),
160 ("Photo", "test_photo", "photo_clicked"), 160 ("Photo", "test_photo", "photo_clicked"),
161 ("Photocam", "test_photocam", "photocam_clicked"), 161 ("Photocam", "test_photocam", "photocam_clicked"),
162 ("Slideshow", "test_slideshow", "slideshow_clicked"), 162 ("Slideshow", "test_slideshow", "slideshow_clicked"),
diff --git a/examples/elementary/test_image.py b/examples/elementary/test_image.py
index 08bdabd..50bb240 100644
--- a/examples/elementary/test_image.py
+++ b/examples/elementary/test_image.py
@@ -3,34 +3,25 @@
3 3
4import os 4import os
5 5
6from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \ 6from efl import evas
7 EVAS_IMAGE_ORIENT_0,EVAS_IMAGE_ORIENT_90, EVAS_IMAGE_ORIENT_180, \ 7from efl import elementary as elm
8 EVAS_IMAGE_ORIENT_270, EVAS_IMAGE_FLIP_HORIZONTAL, EVAS_IMAGE_FLIP_VERTICAL, \ 8from efl.evas import EXPAND_BOTH, FILL_BOTH
9 EVAS_IMAGE_FLIP_TRANSPOSE, EVAS_IMAGE_FLIP_TRANSVERSE 9from efl.elementary import StandardWindow, Box, Button, Image, \
10from efl import elementary 10 Progressbar, Separator
11from efl.elementary.window import StandardWindow
12from efl.elementary.box import Box, ELM_BOX_LAYOUT_FLOW_HORIZONTAL
13from efl.elementary.button import Button
14from efl.elementary.image import Image
15from efl.elementary.progressbar import Progressbar
16from efl.elementary.separator import Separator
17from efl.elementary.label import Label
18from efl.elementary.frame import Frame
19from efl.elementary.list import List
20 11
21 12
22script_path = os.path.dirname(os.path.abspath(__file__)) 13script_path = os.path.dirname(os.path.abspath(__file__))
23img_path = os.path.join(script_path, "images") 14img_path = os.path.join(script_path, "images")
24 15
25orients = [ 16orients = [
26 ("Orient 0", EVAS_IMAGE_ORIENT_0), 17 ("Orient 0", evas.EVAS_IMAGE_ORIENT_0),
27 ("Orient 90", EVAS_IMAGE_ORIENT_90), 18 ("Orient 90", evas.EVAS_IMAGE_ORIENT_90),
28 ("Orient 180", EVAS_IMAGE_ORIENT_180), 19 ("Orient 180", evas.EVAS_IMAGE_ORIENT_180),
29 ("Orient 270", EVAS_IMAGE_ORIENT_270), 20 ("Orient 270", evas.EVAS_IMAGE_ORIENT_270),
30 ("Flip Horizontal", EVAS_IMAGE_FLIP_HORIZONTAL), 21 ("Flip Horizontal", evas.EVAS_IMAGE_FLIP_HORIZONTAL),
31 ("Flip Vertical", EVAS_IMAGE_FLIP_VERTICAL), 22 ("Flip Vertical", evas.EVAS_IMAGE_FLIP_VERTICAL),
32 ("Flip Transpose", EVAS_IMAGE_FLIP_TRANSPOSE), 23 ("Flip Transpose", evas.EVAS_IMAGE_FLIP_TRANSPOSE),
33 ("Flip Tranverse", EVAS_IMAGE_FLIP_TRANSVERSE), 24 ("Flip Tranverse", evas.EVAS_IMAGE_FLIP_TRANSVERSE),
34] 25]
35 26
36remote_url = "http://41.media.tumblr.com/29f1ecd4f98aaff73fb21f479b450d4c/tumblr_mqsxdciQmB1rrju89o1_1280.jpg" 27remote_url = "http://41.media.tumblr.com/29f1ecd4f98aaff73fb21f479b450d4c/tumblr_mqsxdciQmB1rrju89o1_1280.jpg"
@@ -54,10 +45,10 @@ def _cb_im_download_error(im, info, pb):
54 pb.value = 1.0 45 pb.value = 1.0
55 46
56 47
57def image_clicked(obj, it=None): 48def test_image(obj, it=None):
58 win = StandardWindow("image", "Image test", autodel=True, size=(320, 480)) 49 win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
59 if obj is None: 50 if obj is None:
60 win.callback_delete_request_add(lambda o: elementary.exit()) 51 win.callback_delete_request_add(lambda o: elm.exit())
61 52
62 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) 53 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
63 win.resize_object_add(vbox) 54 win.resize_object_add(vbox)
@@ -72,7 +63,7 @@ def image_clicked(obj, it=None):
72 vbox.pack_end(sep) 63 vbox.pack_end(sep)
73 sep.show() 64 sep.show()
74 65
75 hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, 66 hbox = Box(win, layout=elm.ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
76 size_hint_align=FILL_BOTH) 67 size_hint_align=FILL_BOTH)
77 vbox.pack_end(hbox) 68 vbox.pack_end(hbox)
78 hbox.show() 69 hbox.show()
@@ -109,56 +100,7 @@ def image_clicked(obj, it=None):
109 win.show() 100 win.show()
110 101
111 102
112def image2_clicked(obj, it=None):
113 win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
114 if obj is None:
115 win.callback_delete_request_add(lambda o: elementary.exit())
116
117 vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
118 win.resize_object_add(vbox)
119
120 im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
121
122 with open(os.path.join(img_path, "logo.png"), "rb") as fp:
123 image_data = fp.read()
124 im.memfile_set(image_data, len(image_data))
125 vbox.pack_end(im)
126 im.show()
127
128 vbox.show()
129 win.show()
130
131
132if __name__ == "__main__": 103if __name__ == "__main__":
133 win = StandardWindow("test", "python-elementary test application", 104 elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
134 size=(320, 520)) 105 test_image(None)
135 win.callback_delete_request_add(lambda o: elementary.exit()) 106 elm.run()
136
137 box0 = Box(win, size_hint_weight=EXPAND_BOTH)
138 win.resize_object_add(box0)
139 box0.show()
140
141 lb = Label(win)
142 lb.text_set("Please select a test from the list below<br>"
143 "by clicking the test button to show the<br>"
144 "test window.")
145 lb.show()
146
147 fr = Frame(win, text="Information", content=lb)
148 box0.pack_end(fr)
149 fr.show()
150
151 items = [("Image", image_clicked),
152 ("Image with memfile", image2_clicked)]
153
154 li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
155 box0.pack_end(li)
156 li.show()
157
158 for item in items:
159 li.item_append(item[0], callback=item[1])
160
161 li.go()
162
163 win.show()
164 elementary.run()
diff --git a/examples/elementary/test_image_memfile.py b/examples/elementary/test_image_memfile.py
new file mode 100644
index 0000000..68dda58
--- /dev/null
+++ b/examples/elementary/test_image_memfile.py
@@ -0,0 +1,38 @@
1#!/usr/bin/env python
2# encoding: utf-8
3
4import os
5
6from efl import elementary as elm
7from efl.elementary import StandardWindow, Box, Image
8from efl.evas import EXPAND_BOTH, FILL_BOTH
9
10
11script_path = os.path.dirname(os.path.abspath(__file__))
12img_path = os.path.join(script_path, "images")
13
14
15def test_image_memfile(obj, it=None):
16 win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
17 if obj is None:
18 win.callback_delete_request_add(lambda o: elm.exit())
19
20 box = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
21 win.resize_object_add(box)
22 box.show()
23
24 im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
25
26 with open(os.path.join(img_path, "logo.png"), "rb") as fp:
27 image_data = fp.read()
28 im.memfile_set(image_data, len(image_data))
29 box.pack_end(im)
30 im.show()
31
32 win.show()
33
34
35if __name__ == "__main__":
36 elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
37 test_image_memfile(None)
38 elm.run()