davemds pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=e9f07ff5373e744bf0fe71baa6809641e55531e7
commit e9f07ff5373e744bf0fe71baa6809641e55531e7 Author: Dave Andreoli <d...@gurumeditation.it> Date: Sun Apr 12 13:41:05 2015 +0200 New 1.14 API: elm.Photocam.image_orient with test. NOTE: playing with the test reveal lots of image_orient errors --- efl/elementary/photocam.pxd | 4 +++- efl/elementary/photocam.pyx | 18 ++++++++++++++++++ efl/evas/efl.evas.pyx | 4 ++-- examples/elementary/test_photocam.py | 31 ++++++++++++++++++++++++++++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/efl/elementary/photocam.pxd b/efl/elementary/photocam.pxd index da5b5b8..5cd2121 100644 --- a/efl/elementary/photocam.pxd +++ b/efl/elementary/photocam.pxd @@ -1,4 +1,4 @@ -from efl.evas cimport Eina_Bool, Evas_Object, Evas_Load_Error +from efl.evas cimport Eina_Bool, Evas_Object, Evas_Load_Error, Evas_Image_Orient cdef extern from "Elementary.h": @@ -32,6 +32,8 @@ cdef extern from "Elementary.h": void elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h) void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h) + Evas_Image_Orient elm_photocam_image_orient_get(const Evas_Object *obj) + void elm_photocam_image_orient_set(const Evas_Object *obj, Evas_Image_Orient orient) void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) Eina_Bool elm_photocam_paused_get(const Evas_Object *obj) Evas_Object *elm_photocam_internal_image_get(const Evas_Object *obj) diff --git a/efl/elementary/photocam.pyx b/efl/elementary/photocam.pyx index 5c48b50..a71e393 100644 --- a/efl/elementary/photocam.pyx +++ b/efl/elementary/photocam.pyx @@ -354,6 +354,24 @@ cdef class Photocam(Object): """ elm_photocam_image_region_bring_in(self.obj, x, y, w, h) + property image_orient: + """This allows to rotate or flip the photocam image. + + :type: :ref:`Evas_Image_Orient` + + .. versionadded:: 1.14 + + """ + def __set__(self, orient): + elm_photocam_image_orient_set(self.obj, orient) + def __get__(self): + return elm_photocam_image_orient_get(self.obj) + + def image_orient_set(self, orient): + elm_photocam_image_orient_set(self.obj, orient) + def image_orient_get(self): + return elm_photocam_image_orient_get(self.obj) + property paused: """Set the paused state for photocam diff --git a/efl/evas/efl.evas.pyx b/efl/evas/efl.evas.pyx index d026bc0..747daf5 100644 --- a/efl/evas/efl.evas.pyx +++ b/efl/evas/efl.evas.pyx @@ -701,11 +701,11 @@ Evas_Image_Orient Flip image vertically -.. data:: EVAS_IMAGE_FLIP_TRANSVERSE +.. data:: EVAS_IMAGE_FLIP_TRANSPOSE Flip image along the y = (width - x) line (bottom-left to top-right) -.. data:: EVAS_IMAGE_ORIENT +.. data:: EVAS_IMAGE_FLIP_TRANSVERSE Flip image along the y = x line (top-left to bottom-right) diff --git a/examples/elementary/test_photocam.py b/examples/elementary/test_photocam.py index ee9d589..1eac672 100644 --- a/examples/elementary/test_photocam.py +++ b/examples/elementary/test_photocam.py @@ -1,7 +1,10 @@ #!/usr/bin/env python # encoding: utf-8 -from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH +from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \ + EVAS_IMAGE_ORIENT_0, EVAS_IMAGE_ORIENT_90, EVAS_IMAGE_ORIENT_180, \ + EVAS_IMAGE_ORIENT_270, EVAS_IMAGE_FLIP_HORIZONTAL, EVAS_IMAGE_FLIP_VERTICAL, \ + EVAS_IMAGE_FLIP_TRANSPOSE, EVAS_IMAGE_FLIP_TRANSVERSE from efl import elementary from efl.elementary.window import StandardWindow from efl.elementary.box import Box @@ -50,6 +53,10 @@ def _cb_pc_download_error(im, info, pb): pb.hide() +def _cb_orient(btn, pc, orient): + pc.image_orient = orient + + def photocam_clicked(obj): win = StandardWindow("photocam", "Photocam test", autodel=True, size=(600, 600)) @@ -118,6 +125,28 @@ def photocam_clicked(obj): tb.pack(bt, 2, 2, 1, 1) bt.show() + # Orient buttons + box = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) + tb.pack(box, 0, 1, 1, 1) + box.show() + + orients = [ + (EVAS_IMAGE_ORIENT_0, "Orient 0"), + (EVAS_IMAGE_ORIENT_90, "Orient 90"), + (EVAS_IMAGE_ORIENT_180, "Orient 180"), + (EVAS_IMAGE_ORIENT_270, "Orient 270"), + (EVAS_IMAGE_FLIP_HORIZONTAL, "Flip Horiz"), + (EVAS_IMAGE_FLIP_VERTICAL, "Flip Vert"), + (EVAS_IMAGE_FLIP_TRANSPOSE, "Transpose"), + (EVAS_IMAGE_FLIP_TRANSVERSE, "Transverse"), + ] + + for val, label in orients: + bt = Button(win, text=label, size_hint_align=(0.1, 0.5)) + bt.callback_clicked_add(_cb_orient, pc, val) + box.pack_end(bt) + bt.show() + # show the win win.show() --