New 1.18 API: 3 new getters for elm.Photo

NOTE: the test for the editable property is failing...need to recheck this!
This commit is contained in:
Davide Andreoli 2016-08-12 10:00:14 +02:00
parent 30c2ce90c3
commit 78d90dd467
3 changed files with 42 additions and 13 deletions

View File

@ -84,31 +84,45 @@ cdef class Photo(Object):
<const char *>group if group is not None else NULL)
property size:
"""Set the size that will be used on the photo.
"""The size that will be used on the photo.
:type: int
.. versionchanged:: 1.18
This property is now also readable
"""
def __set__(self, size):
def __set__(self, int size):
elm_photo_size_set(self.obj, size)
def __get__(self):
return elm_photo_size_get(self.obj)
def size_set(self, size):
elm_photo_size_set(self.obj, size)
def size_get(self):
return elm_photo_size_get(self.obj)
property fill_inside:
"""Set if the photo should be completely visible or not.
"""If the photo should be completely visible or not.
:type: bool
"""
def __set__(self, fill):
elm_photo_fill_inside_set(self.obj, fill)
.. versionchanged:: 1.18
This property is now also readable
def fill_inside_set(self, fill):
"""
def __set__(self, bint fill):
elm_photo_fill_inside_set(self.obj, fill)
def __get__(self):
return bool(elm_photo_fill_inside_get(self.obj))
def fill_inside_set(self, bint fill):
elm_photo_fill_inside_set(self.obj, fill)
def fill_inside_set(self):
return bool(elm_photo_fill_inside_get(self.obj))
property editable:
"""Set editability of the photo.
"""Editability of the photo.
An editable photo can be dragged to or from, and can be cut or
pasted too. Note that pasting an image or dropping an item on the
@ -116,12 +130,19 @@ cdef class Photo(Object):
:type: bool
"""
def __set__(self, fill):
elm_photo_editable_set(self.obj, fill)
.. versionchanged:: 1.18
This property is now also readable
def editable_set(self, fill):
elm_photo_editable_set(self.obj, fill)
"""
def __set__(self, bint editable):
elm_photo_editable_set(self.obj, editable)
def __get__(self):
return bool(elm_photo_editable_get(self.obj))
def editable_set(self, bint editable):
elm_photo_editable_set(self.obj, editable)
def editable_get(self):
return bool(elm_photo_editable_get(self.obj))
property aspect_fixed:
"""Whether the original aspect ratio of the photo should be kept on

View File

@ -2,8 +2,11 @@ cdef extern from "Elementary.h":
Evas_Object *elm_photo_add(Evas_Object *parent)
Eina_Bool elm_photo_file_set(Evas_Object *obj, const char *file)
void elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group)
int elm_photo_size_get(const Evas_Object *obj)
void elm_photo_size_set(Evas_Object *obj, int size)
Eina_Bool elm_photo_fill_inside_get(const Evas_Object *obj)
void elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill)
Eina_Bool elm_photo_editable_get(const Evas_Object *obj)
void elm_photo_editable_set(Evas_Object *obj, Eina_Bool editable)
void elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
Eina_Bool elm_photo_aspect_fixed_get(const Evas_Object *obj)

View File

@ -55,6 +55,11 @@ def photo_clicked(obj):
ph.fill_inside = True
ph.style = "shadow"
if j == i == 0:
print("Size:", ph.size)
print("Fill Inside:", ph.fill_inside)
print("Editable:", ph.editable) # THIS ONE IS FAILING !!
tb.pack(ph, i, j, 1, 1)
ph.show()