path: root/tests/elementary/test_photo.py
diff options
authorDavide Andreoli <dave@gurumeditation.it>2013-02-11 22:32:50 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-02-11 22:32:50 +0000
commit8b8639886059814a36f57164d5572e97bcb00a47 (patch)
tree1c5a170de002793c1402d6afcc16c63115d81caa /tests/elementary/test_photo.py
Put in a first, still wip, version of the python bindings in a merged tree.
This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
Diffstat (limited to 'tests/elementary/test_photo.py')
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/elementary/test_photo.py b/tests/elementary/test_photo.py
new file mode 100644
index 0000000..da56685
--- /dev/null
+++ b/tests/elementary/test_photo.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# encoding: utf-8
+from efl import elementary
+from efl import evas
+images = ["panel_01.jpg",
+ "mystrale.jpg",
+ "mystrale_2.jpg",
+ "rock_02.jpg",
+ "sky_01.jpg",
+ "sky_02.jpg",
+ "sky_03.jpg",
+ "sky_04.jpg",
+ "wood_01.jpg"]
+def photo_clicked(obj):
+ win = elementary.Window("photo", elementary.ELM_WIN_BASIC)
+ win.title_set("Photo test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+ sc = elementary.Scroller(win)
+ sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(sc)
+ sc.show()
+ elementary.need_ethumb()
+ tb = elementary.Table(win)
+ tb.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc.content = tb
+ tb.show()
+ n = 0
+ for j in range(12):
+ for i in range(12):
+ ph = elementary.Photo(win)
+ name = "images/%s" % (images[n])
+ n += 1
+ if n >= 9: n = 0
+ ph.aspect_fixed = False
+ ph.size = 80
+ if n == 8:
+ ph.thumb = name
+ else:
+ ph.file = name
+ ph.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ph.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ ph.editable = True
+ if n in [2, 3]:
+ ph.fill_inside = True
+ ph.style = "shadow"
+ tb.pack(ph, i, j, 1, 1)
+ ph.show()
+ win.resize(300, 300)
+ win.show()
+if __name__ == "__main__":
+ elementary.init()
+ photo_clicked(None)
+ elementary.run()
+ elementary.shutdown()