diff options
author | Dave Andreoli <dave@gurumeditation.it> | 2015-04-12 13:41:05 +0200 |
---|---|---|
committer | Dave Andreoli <dave@gurumeditation.it> | 2015-04-12 13:41:05 +0200 |
commit | e9f07ff5373e744bf0fe71baa6809641e55531e7 (patch) | |
tree | 095beb54f96ee0dd13ee3de506d7e28363f508fd | |
parent | 6fbe0ba320cda32a47201a5f152bfbff5af39002 (diff) |
New 1.14 API: elm.Photocam.image_orient
with test.
NOTE: playing with the test reveal lots of image_orient errors
-rw-r--r-- | efl/elementary/photocam.pxd | 4 | ||||
-rw-r--r-- | efl/elementary/photocam.pyx | 18 | ||||
-rw-r--r-- | efl/evas/efl.evas.pyx | 4 | ||||
-rw-r--r-- | 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 @@ | |||
1 | from efl.evas cimport Eina_Bool, Evas_Object, Evas_Load_Error | 1 | from efl.evas cimport Eina_Bool, Evas_Object, Evas_Load_Error, Evas_Image_Orient |
2 | 2 | ||
3 | 3 | ||
4 | cdef extern from "Elementary.h": | 4 | cdef extern from "Elementary.h": |
@@ -32,6 +32,8 @@ cdef extern from "Elementary.h": | |||
32 | void elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) | 32 | void elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) |
33 | void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h) | 33 | void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h) |
34 | void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h) | 34 | void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h) |
35 | Evas_Image_Orient elm_photocam_image_orient_get(const Evas_Object *obj) | ||
36 | void elm_photocam_image_orient_set(const Evas_Object *obj, Evas_Image_Orient orient) | ||
35 | void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) | 37 | void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) |
36 | Eina_Bool elm_photocam_paused_get(const Evas_Object *obj) | 38 | Eina_Bool elm_photocam_paused_get(const Evas_Object *obj) |
37 | Evas_Object *elm_photocam_internal_image_get(const Evas_Object *obj) | 39 | 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): | |||
354 | """ | 354 | """ |
355 | elm_photocam_image_region_bring_in(self.obj, x, y, w, h) | 355 | elm_photocam_image_region_bring_in(self.obj, x, y, w, h) |
356 | 356 | ||
357 | property image_orient: | ||
358 | """This allows to rotate or flip the photocam image. | ||
359 | |||
360 | :type: :ref:`Evas_Image_Orient` | ||
361 | |||
362 | .. versionadded:: 1.14 | ||
363 | |||
364 | """ | ||
365 | def __set__(self, orient): | ||
366 | elm_photocam_image_orient_set(self.obj, orient) | ||
367 | def __get__(self): | ||
368 | return elm_photocam_image_orient_get(self.obj) | ||
369 | |||
370 | def image_orient_set(self, orient): | ||
371 | elm_photocam_image_orient_set(self.obj, orient) | ||
372 | def image_orient_get(self): | ||
373 | return elm_photocam_image_orient_get(self.obj) | ||
374 | |||
357 | property paused: | 375 | property paused: |
358 | """Set the paused state for photocam | 376 | """Set the paused state for photocam |
359 | 377 | ||
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 | |||
701 | 701 | ||
702 | Flip image vertically | 702 | Flip image vertically |
703 | 703 | ||
704 | .. data:: EVAS_IMAGE_FLIP_TRANSVERSE | 704 | .. data:: EVAS_IMAGE_FLIP_TRANSPOSE |
705 | 705 | ||
706 | Flip image along the y = (width - x) line (bottom-left to top-right) | 706 | Flip image along the y = (width - x) line (bottom-left to top-right) |
707 | 707 | ||
708 | .. data:: EVAS_IMAGE_ORIENT | 708 | .. data:: EVAS_IMAGE_FLIP_TRANSVERSE |
709 | 709 | ||
710 | Flip image along the y = x line (top-left to bottom-right) | 710 | Flip image along the y = x line (top-left to bottom-right) |
711 | 711 | ||
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 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | # encoding: utf-8 | 2 | # encoding: utf-8 |
3 | 3 | ||
4 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH | 4 | from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \ |
5 | EVAS_IMAGE_ORIENT_0, EVAS_IMAGE_ORIENT_90, EVAS_IMAGE_ORIENT_180, \ | ||
6 | EVAS_IMAGE_ORIENT_270, EVAS_IMAGE_FLIP_HORIZONTAL, EVAS_IMAGE_FLIP_VERTICAL, \ | ||
7 | EVAS_IMAGE_FLIP_TRANSPOSE, EVAS_IMAGE_FLIP_TRANSVERSE | ||
5 | from efl import elementary | 8 | from efl import elementary |
6 | from efl.elementary.window import StandardWindow | 9 | from efl.elementary.window import StandardWindow |
7 | from efl.elementary.box import Box | 10 | from efl.elementary.box import Box |
@@ -50,6 +53,10 @@ def _cb_pc_download_error(im, info, pb): | |||
50 | pb.hide() | 53 | pb.hide() |
51 | 54 | ||
52 | 55 | ||
56 | def _cb_orient(btn, pc, orient): | ||
57 | pc.image_orient = orient | ||
58 | |||
59 | |||
53 | def photocam_clicked(obj): | 60 | def photocam_clicked(obj): |
54 | win = StandardWindow("photocam", "Photocam test", autodel=True, | 61 | win = StandardWindow("photocam", "Photocam test", autodel=True, |
55 | size=(600, 600)) | 62 | size=(600, 600)) |
@@ -118,6 +125,28 @@ def photocam_clicked(obj): | |||
118 | tb.pack(bt, 2, 2, 1, 1) | 125 | tb.pack(bt, 2, 2, 1, 1) |
119 | bt.show() | 126 | bt.show() |
120 | 127 | ||
128 | # Orient buttons | ||
129 | box = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) | ||
130 | tb.pack(box, 0, 1, 1, 1) | ||
131 | box.show() | ||
132 | |||
133 | orients = [ | ||
134 | (EVAS_IMAGE_ORIENT_0, "Orient 0"), | ||
135 | (EVAS_IMAGE_ORIENT_90, "Orient 90"), | ||
136 | (EVAS_IMAGE_ORIENT_180, "Orient 180"), | ||
137 | (EVAS_IMAGE_ORIENT_270, "Orient 270"), | ||
138 | (EVAS_IMAGE_FLIP_HORIZONTAL, "Flip Horiz"), | ||
139 | (EVAS_IMAGE_FLIP_VERTICAL, "Flip Vert"), | ||
140 | (EVAS_IMAGE_FLIP_TRANSPOSE, "Transpose"), | ||
141 | (EVAS_IMAGE_FLIP_TRANSVERSE, "Transverse"), | ||
142 | ] | ||
143 | |||
144 | for val, label in orients: | ||
145 | bt = Button(win, text=label, size_hint_align=(0.1, 0.5)) | ||
146 | bt.callback_clicked_add(_cb_orient, pc, val) | ||
147 | box.pack_end(bt) | ||
148 | bt.show() | ||
149 | |||
121 | # show the win | 150 | # show the win |
122 | win.show() | 151 | win.show() |
123 | 152 | ||