davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=77d14470c47a490122d8d33c7b114aa5712c11f6

commit 77d14470c47a490122d8d33c7b114aa5712c11f6
Author: Dave Andreoli <[email protected]>
Date:   Sat Jan 17 15:55:47 2015 +0100

    New 1.13 elm.Transit.tween_mode_factor_n_set
    
    Also added some missing TRANSIT_TWEEN_MODE_*
---
 efl/elementary/transit.pxd        |  5 +++
 efl/elementary/transit.pyx        | 81 +++++++++++++++++++++++++++++++++------
 efl/utils/conversions.pyx         | 25 ++++++++++++
 include/efl.utils.conversions.pxd |  1 +
 4 files changed, 100 insertions(+), 12 deletions(-)

diff --git a/efl/elementary/transit.pxd b/efl/elementary/transit.pxd
index e9a86e8..4e40a5b 100644
--- a/efl/elementary/transit.pxd
+++ b/efl/elementary/transit.pxd
@@ -28,6 +28,10 @@ cdef extern from "Elementary.h":
         ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL
         ELM_TRANSIT_TWEEN_MODE_DECELERATE
         ELM_TRANSIT_TWEEN_MODE_ACCELERATE
+        ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP
+        ELM_TRANSIT_TWEEN_MODE_BOUNCE
+        ELM_TRANSIT_TWEEN_MODE_SPRING
+        ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE
     ctypedef enum Elm_Transit_Tween_Mode:
         pass
 
@@ -59,6 +63,7 @@ cdef extern from "Elementary.h":
     Elm_Transit_Tween_Mode   elm_transit_tween_mode_get(Elm_Transit *transit)
     void                     elm_transit_tween_mode_factor_set(Elm_Transit 
*transit, double v1, double v2)
     void                     elm_transit_tween_mode_factor_get(const 
Elm_Transit *transit, double *v1, double *v2)
+    void                     elm_transit_tween_mode_factor_n_set(Elm_Transit 
*transit, unsigned int v_size, double *v);
     void                     elm_transit_duration_set(Elm_Transit *transit, 
double duration)
     double                   elm_transit_duration_get(Elm_Transit *transit)
     void                     elm_transit_go(Elm_Transit *transit)
diff --git a/efl/elementary/transit.pyx b/efl/elementary/transit.pyx
index c9b4d90..7a59fb7 100644
--- a/efl/elementary/transit.pyx
+++ b/efl/elementary/transit.pyx
@@ -45,22 +45,23 @@ Example::
 Some transition effects are used to change the properties of objects. They
 are:
 
-- :py:func:`effect_translation_add`
-- :py:func:`effect_color_add`
-- :py:func:`effect_rotation_add`
-- :py:func:`effect_wipe_add`
-- :py:func:`effect_zoom_add`
-- :py:func:`effect_resizing_add`
+- :py:func:`~Transit.effect_translation_add`
+- :py:func:`~Transit.effect_color_add`
+- :py:func:`~Transit.effect_rotation_add`
+- :py:func:`~Transit.effect_wipe_add`
+- :py:func:`~Transit.effect_zoom_add`
+- :py:func:`~Transit.effect_resizing_add`
 
 Other transition effects are used to make one object disappear and another
 object appear on its place. These effects are:
 
-- :py:func:`effect_flip_add`
-- :py:func:`effect_resizable_flip_add`
-- :py:func:`effect_fade_add`
-- :py:func:`effect_blend_add`
+- :py:func:`~Transit.effect_flip_add`
+- :py:func:`~Transit.effect_resizable_flip_add`
+- :py:func:`~Transit.effect_fade_add`
+- :py:func:`~Transit.effect_blend_add`
 
-It's also possible to make a transition chain with 
:py:func:`chain_transit_add`.
+It's also possible to make a transition chain with
+:py:func:`~Transit.chain_transit_add`.
 
 .. warning:: We strongly recommend to use elm_transit just when edje can
     not do the trick. Edje is better at handling transitions than
@@ -142,13 +143,41 @@ Tween modes
 
     Starts slow and increase speed over time
 
+.. data:: ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP
+
+    Start at gradient v1, interpolated via power of v2 curve
+
+    .. versionadded:: 1.13
+
+.. data:: ELM_TRANSIT_TWEEN_MODE_BOUNCE
+
+    Start at 0.0 then "drop" like a ball bouncing to the ground at 1.0, and
+    bounce v2 times, with decay factor of v1
+
+    .. versionadded:: 1.13
+
+.. data:: ELM_TRANSIT_TWEEN_MODE_SPRING
+
+    Start at 0.0 then "wobble" like a spring rest position 1.0, and wobble
+    v2 times, with decay factor of v1
+
+    .. versionadded:: 1.13
+
+.. data:: ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE
+
+    Follow the cubic-bezier curve calculated with the control points (x1,
+    y1), (x2, y2)
+
+    .. versionadded:: 1.13
+
 """
 
+from libc.stdlib cimport free
 from cpython cimport Py_INCREF, Py_DECREF
 
 from efl.evas cimport Object as evasObject
 from efl.utils.conversions cimport eina_list_objects_to_python_list, \
-    python_list_strings_to_eina_list
+    python_list_strings_to_eina_list, python_list_doubles_to_array_of_doubles
 
 import traceback
 
@@ -512,6 +541,8 @@ cdef class Transit(object):
 
         :type: (float **v1**, float **v2**) (defaults are 1.0, 0.0)
 
+        .. seealso:: :py:attr:`tween_mode_factor_n`
+
         .. versionadded:: 1.8
 
         """
@@ -533,6 +564,32 @@ cdef class Transit(object):
         elm_transit_tween_mode_factor_get(self.obj, &v1, &v2)
         return (v1, v2)
 
+    property tween_mode_factor_n:
+        """Set the transit animation acceleration factors.
+
+        This is the same as :py:attr:`tween_mode_factor`, but lets you
+        specify more than 2 values. Actually only need for the
+        :ref:`ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE` mode.
+
+        ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE
+            Use an interpolated cubic-bezier curve ajusted with 4 parameters:
+            (x1, y1, x2, y2)
+
+        :type: list of doubles
+
+        .. seealso:: :py:attr:`tween_mode_factor`
+        
+        .. versionadded:: 1.13
+
+        """
+        def __set__(self, values):
+            self.tween_mode_factor_n_set(values)
+
+    def tween_mode_factor_n_set(self, list values):
+        cdef double *varray = python_list_doubles_to_array_of_doubles(values)
+        elm_transit_tween_mode_factor_n_set(self.obj, len(values), varray)
+        free(varray)
+
     property duration:
         """Set the transit animation time
 
diff --git a/efl/utils/conversions.pyx b/efl/utils/conversions.pyx
index e413851..3c1cc76 100644
--- a/efl/utils/conversions.pyx
+++ b/efl/utils/conversions.pyx
@@ -135,6 +135,31 @@ cdef int * python_list_ints_to_array_of_ints(list ints) 
except NULL:
 
     return array
 
+cdef double * python_list_doubles_to_array_of_doubles(list doubles) except 
NULL:
+    """
+
+    Converts a python list to an array of doubles.
+
+    Note: Remember to free the array when it's no longer needed.
+
+    """
+    cdef:
+        double *array = NULL
+        unsigned int i
+        unsigned int arr_len = len(doubles)
+
+    if arr_len == 0:
+        return NULL
+
+    array = <double *>malloc(arr_len * sizeof(double))
+    if not array:
+        raise MemoryError()
+
+    for i in range(arr_len):
+        array[i] = doubles[i]
+
+    return array
+
 cdef list eina_list_strings_to_python_list(const Eina_List *lst):
     cdef:
         const char *s
diff --git a/include/efl.utils.conversions.pxd 
b/include/efl.utils.conversions.pxd
index 0bab55e..0aeebd4 100644
--- a/include/efl.utils.conversions.pxd
+++ b/include/efl.utils.conversions.pxd
@@ -28,3 +28,4 @@ cdef list eina_list_objects_to_python_list(const Eina_List 
*lst)
 cdef Eina_List *python_list_objects_to_eina_list(list objects)
 cdef int * python_list_ints_to_array_of_ints(list ints) except NULL
 cdef list array_of_ints_to_python_list(int *array, int array_length)
+cdef double * python_list_doubles_to_array_of_doubles(list doubles) except NULL

-- 


Reply via email to