Elementary: Add new thumb functions

This commit is contained in:
Kai Huuhko 2013-09-20 14:49:56 +03:00
parent 88db824a77
commit ac9b1bf001
3 changed files with 271 additions and 5 deletions

View File

@ -394,6 +394,31 @@ cdef extern from "Elementary.h":
ELM_THUMB_ANIMATION_STOP
ELM_THUMB_ANIMATION_LAST
ctypedef enum Ethumb_Thumb_FDO_Size:
ETHUMB_THUMB_NORMAL # 128x128 as defined by FreeDesktop.Org standard
ETHUMB_THUMB_LARGE # 256x256 as defined by FreeDesktop.Org standard
ctypedef enum Ethumb_Thumb_Format:
ETHUMB_THUMB_FDO # PNG as defined by FreeDesktop.Org standard
ETHUMB_THUMB_JPEG # JPEGs are often smaller and faster to read/write
ETHUMB_THUMB_EET # EFL's own storage system, supports key parameter
ctypedef enum Ethumb_Thumb_Aspect:
ETHUMB_THUMB_KEEP_ASPECT # keep original proportion between width and height
ETHUMB_THUMB_IGNORE_ASPECT # ignore aspect and foce it to match thumbnail's width and height
ETHUMB_THUMB_CROP # keep aspect but crop (cut) the largest dimension
ctypedef enum Ethumb_Thumb_Orientation:
ETHUMB_THUMB_ORIENT_NONE # keep orientation as pixel data is
ETHUMB_THUMB_ROTATE_90_CW # rotate 90° clockwise
ETHUMB_THUMB_ROTATE_180 # rotate 180°
ETHUMB_THUMB_ROTATE_90_CCW # rotate 90° counter-clockwise
ETHUMB_THUMB_FLIP_HORIZONTAL # flip horizontally
ETHUMB_THUMB_FLIP_VERTICAL # flip vertically
ETHUMB_THUMB_FLIP_TRANSPOSE # transpose
ETHUMB_THUMB_FLIP_TRANSVERSE # transverse
ETHUMB_THUMB_ORIENT_ORIGINAL # use orientation from metadata (EXIF-only currently)
ctypedef enum Elm_Toolbar_Item_Scrollto_Type:
ELM_TOOLBAR_ITEM_SCROLLTO_NONE
ELM_TOOLBAR_ITEM_SCROLLTO_IN

View File

@ -1,5 +1,7 @@
from efl.evas cimport Eina_Bool, Evas_Object
from enums cimport Elm_Thumb_Animation_Setting
from efl.evas cimport Eina_Bool, Evas_Object, const_Evas_Object
from enums cimport Elm_Thumb_Animation_Setting, Ethumb_Thumb_Aspect, \
Ethumb_Thumb_Format, Ethumb_Thumb_Orientation, \
Ethumb_Thumb_FDO_Size
from libc.string cimport const_char
cdef extern from "Elementary.h":
@ -8,6 +10,22 @@ cdef extern from "Elementary.h":
void elm_thumb_file_set(Evas_Object *obj, const_char *file, const_char *key)
void elm_thumb_file_get(Evas_Object *obj, const_char **file, const_char **key)
void elm_thumb_path_get(Evas_Object *obj, const_char **file, const_char **key)
void elm_thumb_aspect_set(Evas_Object *obj, Ethumb_Thumb_Aspect aspect)
Ethumb_Thumb_Aspect elm_thumb_aspect_get(const_Evas_Object *obj)
void elm_thumb_fdo_size_set(Evas_Object *obj, Ethumb_Thumb_FDO_Size size)
Ethumb_Thumb_FDO_Size elm_thumb_fdo_size_get(const_Evas_Object *obj)
void elm_thumb_format_set(Evas_Object *obj, Ethumb_Thumb_Format format)
Ethumb_Thumb_Format elm_thumb_format_get(const_Evas_Object *obj)
void elm_thumb_orientation_set(Evas_Object *obj, Ethumb_Thumb_Orientation orient)
Ethumb_Thumb_Orientation elm_thumb_orientation_get(const_Evas_Object *obj)
void elm_thumb_size_set(Evas_Object *obj, int tw, int th)
void elm_thumb_size_get(const_Evas_Object *obj, int *tw, int *th)
void elm_thumb_crop_align_set(Evas_Object *obj, double cropx, double cropy)
void elm_thumb_crop_align_get(const_Evas_Object *obj, double *cropx, double *cropy)
void elm_thumb_compress_set(Evas_Object *obj, int compress)
void elm_thumb_compress_get(const_Evas_Object *obj, int *compress)
void elm_thumb_quality_set(Evas_Object *obj, int quality)
void elm_thumb_quality_get(const_Evas_Object *obj, int *quality)
void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s)
Elm_Thumb_Animation_Setting elm_thumb_animate_get(Evas_Object *obj)
void *elm_thumb_ethumb_client_get()

View File

@ -64,8 +64,8 @@ Enumerations
.. _Elm_Thumb_Animation_Setting:
Thumb animation modes
=====================
Thumb animation mode
====================
.. data:: ELM_THUMB_ANIMATION_START
@ -79,6 +79,99 @@ Thumb animation modes
Stop playing the animation
.. _Ethumb_Thumb_FDO_Size:
Thumb FDO size
==============
.. data:: ETHUMB_THUMB_NORMAL
128x128 as defined by FreeDesktop.Org standard
.. data:: ETHUMB_THUMB_LARGE
256x256 as defined by FreeDesktop.Org standard
.. _Ethumb_Thumb_Format:
Thumb format
============
.. data:: ETHUMB_THUMB_FDO
PNG as defined by FreeDesktop.Org standard
.. data:: ETHUMB_THUMB_JPEG
JPEGs are often smaller and faster to read/write
.. data:: ETHUMB_THUMB_EET
EFL's own storage system, supports key parameter
.. _Ethumb_Thumb_Aspect:
Thumb aspect
============
.. data:: ETHUMB_THUMB_KEEP_ASPECT
keep original proportion between width and height
.. data:: ETHUMB_THUMB_IGNORE_ASPECT
ignore aspect and foce it to match thumbnail's width and height
.. data:: ETHUMB_THUMB_CROP
keep aspect but crop (cut) the largest dimension
.. _Ethumb_Thumb_Orientation:
Thumb orientation
=================
.. data:: ETHUMB_THUMB_ORIENT_NONE
keep orientation as pixel data is
.. data:: ETHUMB_THUMB_ROTATE_90_CW
rotate 90° clockwise
.. data:: ETHUMB_THUMB_ROTATE_180
rotate 180°
.. data:: ETHUMB_THUMB_ROTATE_90_CCW
rotate 90° counter-clockwise
.. data:: ETHUMB_THUMB_FLIP_HORIZONTAL
flip horizontally
.. data:: ETHUMB_THUMB_FLIP_VERTICAL
flip vertically
.. data:: ETHUMB_THUMB_FLIP_TRANSPOSE
transpose
.. data:: ETHUMB_THUMB_FLIP_TRANSVERSE
transverse
.. data:: ETHUMB_THUMB_ORIENT_ORIGINAL
use orientation from metadata (EXIF-only currently)
"""
include "widget_header.pxi"
@ -163,6 +256,136 @@ cdef class Thumb(Object):
elm_thumb_path_get(self.obj, &path, &key)
return(_ctouni(path), _ctouni(key))
property aspect:
"""
The aspect for the thumb object.
:since: 1.8
:type: :ref:`Ethumb_Thumb_Aspect`
"""
def __set__(self, aspect):
elm_thumb_aspect_set(self.obj, aspect)
def __get__(self):
return elm_thumb_aspect_get(self.obj)
property fdo_size:
"""
The FDO size for the thumb object.
:since: 1.8
:type: :ref:`Ethumb_Thumb_FDO_Size`
"""
def __set__(self, size):
elm_thumb_fdo_size_set(self.obj, size)
def __get__(self):
return elm_thumb_fdo_size_get(self.obj)
property format:
"""
The format for the thumb object.
:since: 1.8
:type: :ref:`Ethumb_Thumb_Format`
"""
def __set__(self, format):
elm_thumb_format_set(self.obj, format)
def __get__(self):
return elm_thumb_format_get(self.obj)
property orientation:
"""
The orientation for the thumb object.
:since: 1.8
:type: :ref:`Ethumb_Thumb_Orientation`
"""
def __set__(self, orient):
elm_thumb_orientation_set(self.obj, orient)
def __get__(self):
return elm_thumb_orientation_get(self.obj)
property size:
"""
The size for the thumb object.
:since: 1.8
:type: (int tw, int th)
"""
def __set__(self, value):
tw, th = value
elm_thumb_size_set(self.obj, tw, th)
def __get__(self):
cdef int tw, th
elm_thumb_size_get(self.obj, &tw, &th)
return tw, th
property crop_align:
"""
Set the crop alignment for the thumb object.
:since: 1.8
:type: (double cropx, double cropy)
"""
def __set__(self, value):
cropx, cropy = value
elm_thumb_crop_align_set(self.obj, cropx, cropy)
def __get__(self):
cdef double cropx, cropy
elm_thumb_crop_align_get(self.obj, &cropx, &cropy)
return cropx, cropy
property compress:
"""
Set the compression for the thumb object.
:since: 1.8
:type: int
"""
def __set__(self, compress):
elm_thumb_compress_set(self.obj, compress)
def __get__(self):
cdef int compress
elm_thumb_compress_get(self.obj, &compress)
return compress
property quality:
"""
Set the quality for the thumb object.
:since: 1.8
:type: int
"""
def __set__(self, int quality):
elm_thumb_quality_set(self.obj, quality)
def __get__(self):
cdef int quality
elm_thumb_quality_get(self.obj, &quality)
return quality
property animate:
"""Set the animation state for the thumb object. If its content is
an animated video, you may start/stop the animation or tell it to
@ -226,7 +449,7 @@ cdef class Thumb(Object):
"""
return None
#return elm_thumb_ethumb_client_get(void)
# TODO: return elm_thumb_ethumb_client_get(void)
property ethumb_client_connected:
"""Get the ethumb_client connection state.