kuuko pushed a commit to branch master.

commit 724b99909565257a5fe15dd321377532d46a1d5c
Author: Kai Huuhko <[email protected]>
Date:   Sun Apr 21 15:43:37 2013 +0000

    Ecore: Optimizations.
---
 efl/ecore/efl.ecore.pyx        | 198 +++++++++++++++++++++++++++++++++++------
 efl/ecore/efl.ecore_events.pxi |  10 +--
 efl/ecore/efl.ecore_exe.pxi    |  99 +++++++++++----------
 include/efl.ecore.enums.pxd    |  54 +++++++++++
 include/efl.ecore.pxd          |  25 +-----
 5 files changed, 283 insertions(+), 103 deletions(-)

diff --git a/efl/ecore/efl.ecore.pyx b/efl/ecore/efl.ecore.pyx
index fbd8204..a554bac 100644
--- a/efl/ecore/efl.ecore.pyx
+++ b/efl/ecore/efl.ecore.pyx
@@ -15,32 +15,178 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with this Python-EFL.  If not, see <http://www.gnu.org/licenses/>.
 
+"""
+
+.. _Ecore_Fd_Handler_Flags:
+
+Fd handler flags
+================
+
+What to monitor the file descriptor for: reading, writing or error.
+
+.. data:: ECORE_FD_READ
+
+    Fd Read mask
+
+.. data:: ECORE_FD_WRITE
+
+    Fd Write mask
+
+.. data:: ECORE_FD_ERROR
+
+    Fd Error mask
+
+
+.. _Ecore_Exe_Flags:
+
+Exe flags
+=========
+
+Flags for executing a child with its stdin and/or stdout piped back.
+
+.. data:: ECORE_EXE_NONE
+
+    No exe flags at all
+
+.. data:: ECORE_EXE_PIPE_READ
+
+    Exe Pipe Read mask
+
+.. data:: ECORE_EXE_PIPE_WRITE
+
+    Exe Pipe Write mask
+
+.. data:: ECORE_EXE_PIPE_ERROR
+
+    Exe Pipe error mask
+
+.. data:: ECORE_EXE_PIPE_READ_LINE_BUFFERED
+
+    Reads are buffered until a newline and split 1 line per 
Ecore_Exe_Event_Data_Line
+
+.. data:: ECORE_EXE_PIPE_ERROR_LINE_BUFFERED
+
+    Errors are buffered until a newline and split 1 line per 
Ecore_Exe_Event_Data_Line
+
+.. data:: ECORE_EXE_PIPE_AUTO
+
+    stdout and stderr are buffered automatically
+
+.. data:: ECORE_EXE_RESPAWN
+
+    FIXME: Exe is restarted if it dies
+
+.. data:: ECORE_EXE_USE_SH
+
+    Use /bin/sh to run the command.
+
+.. data:: ECORE_EXE_NOT_LEADER
+
+    Do not use setsid() to have the executed process be its own session leader
+
+.. data:: ECORE_EXE_TERM_WITH_PARENT
+
+    Makes child receive SIGTERM when parent dies.
+
+
+Callback return values
+======================
+ECORE_CALLBACK_CANCEL  EINA_FALSE /**< Return value to remove a callback */
+ECORE_CALLBACK_RENEW   EINA_TRUE /**< Return value to keep a callback */
+
+Event return values
+===================
+ECORE_CALLBACK_PASS_ON EINA_TRUE /**< Return value to pass event to next 
handler */
+ECORE_CALLBACK_DONE    EINA_FALSE /**< Return value to stop event handling */
+
+
+.. _Ecore_Pos_Map:
+
+Position mappings for the animation
+===================================
+
+.. data:: ECORE_POS_MAP_LINEAR
+
+    Linear 0.0 -> 1.0
+
+.. data:: ECORE_POS_MAP_ACCELERATE
+
+    Start slow then speed up
+
+.. data:: ECORE_POS_MAP_DECELERATE
+
+    Start fast then slow down
+
+.. data:: ECORE_POS_MAP_SINUSOIDAL
+
+    Start slow, speed up then slow down at end
+
+.. data:: ECORE_POS_MAP_ACCELERATE_FACTOR
+
+    Start slow then speed up, v1 being a power factor, 0.0 being linear, 1.0 
being normal accelerate, 2.0 being much more pronounced accelerate (squared), 
3.0 being cubed, etc.
+
+.. data:: ECORE_POS_MAP_DECELERATE_FACTOR
+
+    Start fast then slow down, v1 being a power factor, 0.0 being linear, 1.0 
being normal decelerate, 2.0 being much more pronounced decelerate (squared), 
3.0 being cubed, etc.
+
+.. data:: ECORE_POS_MAP_SINUSOIDAL_FACTOR
+
+    Start slow, speed up then slow down at end, v1 being a power factor, 0.0 
being linear, 1.0 being normal sinusoidal, 2.0 being much more pronounced 
sinusoidal (squared), 3.0 being cubed, etc.
+
+.. data:: ECORE_POS_MAP_DIVISOR_INTERP
+
+    Start at gradient * v1, interpolated via power of v2 curve
+
+.. data:: ECORE_POS_MAP_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
+
+.. data:: ECORE_POS_MAP_SPRING
+
+    Start at 0.0 then "wobble" like a spring rest position 1.0, and wobble v2 
times, with decay factor of v1
+
+
+.. _Ecore_Animator_Source:
+
+Timing sources for animators
+============================
+
+.. data:: ECORE_ANIMATOR_SOURCE_TIMER
+
+    The default system clock/timer based animator that ticks every "frametime" 
seconds
+
+.. data:: ECORE_ANIMATOR_SOURCE_CUSTOM
+
+    A custom animator trigger that you need to call ecore_animator_trigger() 
to make it tick
+
+
+"""
+
 import traceback
 from efl.eo cimport Eo, PY_REFCOUNT, _ctouni
 from cpython cimport Py_INCREF, Py_DECREF
+cimport efl.ecore.enums as enums
 
-
-ECORE_CALLBACK_CANCEL = 0
-ECORE_CALLBACK_RENEW = 1
+ECORE_CALLBACK_CANCEL = enums.ECORE_CALLBACK_CANCEL
+ECORE_CALLBACK_RENEW = enums.ECORE_CALLBACK_RENEW
 
 # Ecore_Fd_Handler_Flags:
-ECORE_FD_READ = 1
-ECORE_FD_WRITE = 2
-ECORE_FD_ERROR = 4
+ECORE_FD_READ = enums.ECORE_FD_READ
+ECORE_FD_WRITE = enums.ECORE_FD_WRITE
+ECORE_FD_ERROR = enums.ECORE_FD_ERROR
 ECORE_FD_ALL = 7
 
-
 # Ecore_Exe_Flags:
-ECORE_EXE_PIPE_READ = 1
-ECORE_EXE_PIPE_WRITE = 2
-ECORE_EXE_PIPE_ERROR = 4
-ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8
-ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16
-ECORE_EXE_PIPE_AUTO = 32
-ECORE_EXE_RESPAWN = 64
-ECORE_EXE_USE_SH = 128
-ECORE_EXE_NOT_LEADER = 256
-ECORE_EXE_TERM_WITH_PARENT = 512
+ECORE_EXE_PIPE_READ = enums.ECORE_EXE_PIPE_READ
+ECORE_EXE_PIPE_WRITE = enums.ECORE_EXE_PIPE_WRITE
+ECORE_EXE_PIPE_ERROR = enums.ECORE_EXE_PIPE_ERROR
+ECORE_EXE_PIPE_READ_LINE_BUFFERED = enums.ECORE_EXE_PIPE_READ_LINE_BUFFERED
+ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = enums.ECORE_EXE_PIPE_ERROR_LINE_BUFFERED
+ECORE_EXE_PIPE_AUTO = enums.ECORE_EXE_PIPE_AUTO
+ECORE_EXE_RESPAWN = enums.ECORE_EXE_RESPAWN
+ECORE_EXE_USE_SH = enums.ECORE_EXE_USE_SH
+ECORE_EXE_NOT_LEADER = enums.ECORE_EXE_NOT_LEADER
+ECORE_EXE_TERM_WITH_PARENT = enums.ECORE_EXE_TERM_WITH_PARENT
 
 ECORE_EXE_PRIORITY_INHERIT = 9999
 
@@ -79,15 +225,15 @@ def init():
 
         global _event_type_mapping
         _event_type_mapping = {
-            ECORE_EVENT_SIGNAL_USER: EventSignalUser,
-            ECORE_EVENT_SIGNAL_HUP: EventSignalHup,
-            ECORE_EVENT_SIGNAL_EXIT: EventSignalExit,
-            ECORE_EVENT_SIGNAL_POWER: EventSignalPower,
-            ECORE_EVENT_SIGNAL_REALTIME: EventSignalRealtime,
-            ECORE_EXE_EVENT_ADD: EventExeAdd,
-            ECORE_EXE_EVENT_DEL: EventExeDel,
-            ECORE_EXE_EVENT_DATA: EventExeData,
-            ECORE_EXE_EVENT_ERROR: EventExeData,
+            enums.ECORE_EVENT_SIGNAL_USER: EventSignalUser,
+            enums.ECORE_EVENT_SIGNAL_HUP: EventSignalHup,
+            enums.ECORE_EVENT_SIGNAL_EXIT: EventSignalExit,
+            enums.ECORE_EVENT_SIGNAL_POWER: EventSignalPower,
+            enums.ECORE_EVENT_SIGNAL_REALTIME: EventSignalRealtime,
+            enums.ECORE_EXE_EVENT_ADD: EventExeAdd,
+            enums.ECORE_EXE_EVENT_DEL: EventExeDel,
+            enums.ECORE_EXE_EVENT_DATA: EventExeData,
+            enums.ECORE_EXE_EVENT_ERROR: EventExeData,
             }
 
     ecore_file_init()
diff --git a/efl/ecore/efl.ecore_events.pxi b/efl/ecore/efl.ecore_events.pxi
index 687e298..79b03a1 100644
--- a/efl/ecore/efl.ecore_events.pxi
+++ b/efl/ecore/efl.ecore_events.pxi
@@ -166,7 +166,7 @@ cdef class EventSignalUser2(EventSignalUser):
 
 cdef class EventHandlerSignalUser(EventHandler):
     def __init__(self, func, *args, **kargs):
-        EventHandler.__init__(self, ECORE_EVENT_SIGNAL_USER,
+        EventHandler.__init__(self, enums.ECORE_EVENT_SIGNAL_USER,
                               func, *args, **kargs)
 
     cdef Eina_Bool _exec(self, void *event) except 2:
@@ -198,7 +198,7 @@ cdef class EventSignalHup(Event):
 
 
 def on_signal_hup(func, *args, **kargs):
-    return EventHandler(ECORE_EVENT_SIGNAL_HUP, func, *args, **kargs)
+    return EventHandler(enums.ECORE_EVENT_SIGNAL_HUP, func, *args, **kargs)
 
 
 cdef class EventSignalExit(Event):
@@ -245,7 +245,7 @@ cdef class EventSignalTerminate(EventSignalExit):
 
 cdef class EventHandlerSignalExit(EventHandler):
     def __init__(self, func, *args, **kargs):
-        EventHandler.__init__(self, ECORE_EVENT_SIGNAL_EXIT,
+        EventHandler.__init__(self, enums.ECORE_EVENT_SIGNAL_EXIT,
                               func, *args, **kargs)
 
     cdef Eina_Bool _exec(self, void *event) except 2:
@@ -279,7 +279,7 @@ cdef class EventSignalPower(Event):
 
 
 def on_signal_power(func, *args, **kargs):
-    return EventHandler(ECORE_EVENT_SIGNAL_POWER, func, *args, **kargs)
+    return EventHandler(enums.ECORE_EVENT_SIGNAL_POWER, func, *args, **kargs)
 
 
 cdef class EventSignalRealtime(Event):
@@ -297,7 +297,7 @@ cdef class EventSignalRealtime(Event):
 
 
 def on_signal_realtime(func, *args, **kargs):
-    return EventHandler(ECORE_EVENT_SIGNAL_REALTIME, func, *args, **kargs)
+    return EventHandler(enums.ECORE_EVENT_SIGNAL_REALTIME, func, *args, 
**kargs)
 
 
 cdef class CustomEvent(Event):
diff --git a/efl/ecore/efl.ecore_exe.pxi b/efl/ecore/efl.ecore_exe.pxi
index 17d4ab4..c724e30 100644
--- a/efl/ecore/efl.ecore_exe.pxi
+++ b/efl/ecore/efl.ecore_exe.pxi
@@ -25,47 +25,50 @@ cdef extern from "Python.h":
 
 cdef exe_flags2str(int value):
     flags = []
-    if value & ECORE_EXE_PIPE_READ:
+    if value & enums.ECORE_EXE_PIPE_READ:
         flags.append("PIPE_READ")
-    if value & ECORE_EXE_PIPE_WRITE:
+    if value & enums.ECORE_EXE_PIPE_WRITE:
         flags.append("PIPE_WRITE")
-    if value & ECORE_EXE_PIPE_ERROR:
+    if value & enums.ECORE_EXE_PIPE_ERROR:
         flags.append("PIPE_ERROR")
-    if value & ECORE_EXE_PIPE_READ_LINE_BUFFERED:
+    if value & enums.ECORE_EXE_PIPE_READ_LINE_BUFFERED:
         flags.append("PIPE_READ_LINE_BUFFERED")
-    if value & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED:
+    if value & enums.ECORE_EXE_PIPE_ERROR_LINE_BUFFERED:
         flags.append("PIPE_ERROR_LINE_BUFFERED")
-    if value & ECORE_EXE_PIPE_AUTO:
+    if value & enums.ECORE_EXE_PIPE_AUTO:
         flags.append("PIPE_AUTO")
-    if value & ECORE_EXE_RESPAWN:
+    if value & enums.ECORE_EXE_RESPAWN:
         flags.append("RESPAWN")
-    if value & ECORE_EXE_USE_SH:
+    if value & enums.ECORE_EXE_USE_SH:
         flags.append("USE_SH")
-    if value & ECORE_EXE_NOT_LEADER:
+    if value & enums.ECORE_EXE_NOT_LEADER:
         flags.append("NOT_LEADER")
     return ", ".join(flags)
 
 
 cdef Eina_Bool _exe_event_filter_cb(void *data, int type, void *event) with 
gil:
-    cdef ExeEventFilter self = <ExeEventFilter>data
-    cdef Ecore_Exe_Event_Add *e_add
-    cdef Ecore_Exe_Event_Del *e_del
-    cdef Ecore_Exe_Event_Data *e_data
-    cdef Event e
+    cdef:
+        ExeEventFilter self = <ExeEventFilter>data
+        Ecore_Exe_Event_Add *e_add
+        Ecore_Exe_Event_Del *e_del
+        Ecore_Exe_Event_Data *e_data
+        Event e
+        list cbs
+        tuple cb
 
     try:
         assert self.event_type == type, "event is not what we asked? 
impossible"
-        if type == ECORE_EXE_EVENT_ADD:
+        if type == enums.ECORE_EXE_EVENT_ADD:
             e_add = <Ecore_Exe_Event_Add *>event
             if e_add.exe != self.exe:
                 return 1
             e = EventExeAdd()
-        elif type == ECORE_EXE_EVENT_DEL:
+        elif type == enums.ECORE_EXE_EVENT_DEL:
             e_del = <Ecore_Exe_Event_Del *>event
             if e_del.exe != self.exe:
                 return 1
             e = EventExeDel()
-        elif type == ECORE_EXE_EVENT_DATA or type == ECORE_EXE_EVENT_ERROR:
+        elif type == enums.ECORE_EXE_EVENT_DATA or type == 
enums.ECORE_EXE_EVENT_ERROR:
             e_data = <Ecore_Exe_Event_Data *>event
             if e_data.exe != self.exe:
                 return 1
@@ -76,10 +79,10 @@ cdef Eina_Bool _exe_event_filter_cb(void *data, int type, 
void *event) with gil:
         r = e._set_obj(event)
         assert r != -1, "exe is not known?! impossible!"
 
-        cb = tuple(self.callbacks) # copy, so we can change self.callbacks
-        for func, args, kargs in cb:
+        cbs = self.callbacks[:] # copy, so we can change self.callbacks
+        for cb in cbs:
             try:
-                func(self.owner, e, *args, **kargs)
+                cb[0](self.owner, e, *cb[1], **cb[2])
             except:
                 traceback.print_exc()
 
@@ -91,9 +94,6 @@ cdef Eina_Bool _exe_event_filter_cb(void *data, int type, 
void *event) with gil:
 
 cdef class ExeEventFilter:
     def __cinit__(self, *a, **ka):
-        self.exe = NULL
-        self.handler = NULL
-        self.owner = None
         self.event_type = -1
         self.callbacks = []
 
@@ -104,7 +104,7 @@ cdef class ExeEventFilter:
 
         self.exe = NULL
         self.owner = None
-        self.event_type = None
+        self.event_type = -1
         self.callbacks = None
 
     def __init__(self, Exe exe not None, int event_type):
@@ -409,7 +409,9 @@ cdef class Exe(object):
         :return: success or failure.
         :rtype: bool
         """
-        cdef Py_buffer buf_view
+        cdef:
+            Py_buffer buf_view
+            bint ret
 
         if isinstance(buf, (str, unicode)):
             buf = PyUnicode_AsUTF8String(buf)
@@ -423,7 +425,7 @@ cdef class Exe(object):
                 "given size (%d) is larger than buffer size (%d)." %
                 (size, buf_view.len))
 
-        ret = bool(ecore_exe_send(self.exe, <const_void *>buf_view.buf, 
buf_view.len))
+        ret = ecore_exe_send(self.exe, <const_void *>buf_view.buf, 
buf_view.len)
         PyBuffer_Release(&buf_view)
         return ret
 
@@ -449,9 +451,8 @@ cdef class Exe(object):
         ecore_exe_auto_limits_set(self.exe, start_bytes, end_bytes,
                                   start_lines, end_lines)
 
-    def event_data_get(self, int flags):
-        pass
-        # TODO:
+    # TODO:
+    #def event_data_get(self, int flags):
         #Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, 
Ecore_Exe_Flags flags)
         #void ecore_exe_event_data_free(Ecore_Exe_Event_Data *data)
 
@@ -645,10 +646,10 @@ cdef class Exe(object):
         :see: on_exe_add_event_add()
 
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_ADD)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_ADD)
         if filter is None:
-            filter = ExeEventFilter(self, ECORE_EXE_EVENT_ADD)
-            self.__callbacks[ECORE_EXE_EVENT_ADD] = filter
+            filter = ExeEventFilter(self, enums.ECORE_EXE_EVENT_ADD)
+            self.__callbacks[enums.ECORE_EXE_EVENT_ADD] = filter
         filter.callback_add(func, args, kargs)
 
     def on_add_event_del(self, func, *args, **kargs):
@@ -659,7 +660,7 @@ cdef class Exe(object):
         :raise ValueError: if parameters don't match an already
                            registered callback.
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_ADD)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_ADD)
         if filter is None:
             raise ValueError("callback not registered %s, args=%s, kargs=%s" %
                              (func, args, kargs))
@@ -681,10 +682,10 @@ cdef class Exe(object):
         :see: on_del_event_del()
         :see: on_exe_del_event_add()
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_DEL)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_DEL)
         if filter is None:
-            filter = ExeEventFilter(self, ECORE_EXE_EVENT_DEL)
-            self.__callbacks[ECORE_EXE_EVENT_DEL] = filter
+            filter = ExeEventFilter(self, enums.ECORE_EXE_EVENT_DEL)
+            self.__callbacks[enums.ECORE_EXE_EVENT_DEL] = filter
         filter.callback_add(func, args, kargs)
 
     def on_del_event_del(self, func, *args, **kargs):
@@ -695,7 +696,7 @@ cdef class Exe(object):
         :raise ValueError: if parameters don't match an already
                            registered callback.
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_DEL)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_DEL)
         if filter is None:
             raise ValueError("callback not registered %s, args=%s, kargs=%s" %
                              (func, args, kargs))
@@ -717,10 +718,10 @@ cdef class Exe(object):
         :see: on_data_event_del()
         :see: on_exe_data_event_add()
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_DATA)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_DATA)
         if filter is None:
-            filter = ExeEventFilter(self, ECORE_EXE_EVENT_DATA)
-            self.__callbacks[ECORE_EXE_EVENT_DATA] = filter
+            filter = ExeEventFilter(self, enums.ECORE_EXE_EVENT_DATA)
+            self.__callbacks[enums.ECORE_EXE_EVENT_DATA] = filter
         filter.callback_add(func, args, kargs)
 
     def on_data_event_del(self, func, *args, **kargs):
@@ -731,7 +732,7 @@ cdef class Exe(object):
         :raise ValueError: if parameters don't match an already
                            registered callback.
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_DATA)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_DATA)
         if filter is None:
             raise ValueError("callback not registered %s, args=%s, kargs=%s" %
                              (func, args, kargs))
@@ -753,10 +754,10 @@ cdef class Exe(object):
         :see: on_error_event_del()
         :see: on_exe_error_event_add()
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_ERROR)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_ERROR)
         if filter is None:
-            filter = ExeEventFilter(self, ECORE_EXE_EVENT_ERROR)
-            self.__callbacks[ECORE_EXE_EVENT_ERROR] = filter
+            filter = ExeEventFilter(self, enums.ECORE_EXE_EVENT_ERROR)
+            self.__callbacks[enums.ECORE_EXE_EVENT_ERROR] = filter
         filter.callback_add(func, args, kargs)
 
     def on_error_event_del(self, func, *args, **kargs):
@@ -767,7 +768,7 @@ cdef class Exe(object):
         :raise ValueError: if parameters don't match an already
                            registered callback.
         """
-        filter = self.__callbacks.get(ECORE_EXE_EVENT_ERROR)
+        filter = self.__callbacks.get(enums.ECORE_EXE_EVENT_ERROR)
         if filter is None:
             raise ValueError("callback not registered %s, args=%s, kargs=%s" %
                              (func, args, kargs))
@@ -910,7 +911,7 @@ def on_exe_add_event_add(func, *args, **kargs):
        :see: EventHandler
        :see: EventHandlerExe
     """
-    return EventHandlerExe(ECORE_EXE_EVENT_ADD, func, *args, **kargs)
+    return EventHandlerExe(enums.ECORE_EXE_EVENT_ADD, func, *args, **kargs)
 
 
 def on_exe_del_event_add(func, *args, **kargs):
@@ -919,7 +920,7 @@ def on_exe_del_event_add(func, *args, **kargs):
        :see: EventHandler
        :see: EventHandlerExe
     """
-    return EventHandlerExe(ECORE_EXE_EVENT_DEL, func, *args, **kargs)
+    return EventHandlerExe(enums.ECORE_EXE_EVENT_DEL, func, *args, **kargs)
 
 
 def on_exe_data_event_add(func, *args, **kargs):
@@ -928,7 +929,7 @@ def on_exe_data_event_add(func, *args, **kargs):
        :see: EventHandler
        :see: EventHandlerExe
     """
-    return EventHandlerExe(ECORE_EXE_EVENT_DATA, func, *args, **kargs)
+    return EventHandlerExe(enums.ECORE_EXE_EVENT_DATA, func, *args, **kargs)
 
 
 def on_exe_error_event_add(func, *args, **kargs):
@@ -937,4 +938,4 @@ def on_exe_error_event_add(func, *args, **kargs):
        :see: L{EventHandler}
        :see: L{EventHandlerExe}
     """
-    return EventHandlerExe(ECORE_EXE_EVENT_ERROR, func, *args, **kargs)
+    return EventHandlerExe(enums.ECORE_EXE_EVENT_ERROR, func, *args, **kargs)
diff --git a/include/efl.ecore.enums.pxd b/include/efl.ecore.enums.pxd
new file mode 100644
index 0000000..86268d9
--- /dev/null
+++ b/include/efl.ecore.enums.pxd
@@ -0,0 +1,54 @@
+cdef extern from "Ecore.h":
+    enum:
+        ECORE_EVENT_SIGNAL_USER
+        ECORE_EVENT_SIGNAL_HUP
+        ECORE_EVENT_SIGNAL_EXIT
+        ECORE_EVENT_SIGNAL_POWER
+        ECORE_EVENT_SIGNAL_REALTIME
+
+    int ECORE_EXE_EVENT_ADD
+    int ECORE_EXE_EVENT_DEL
+    int ECORE_EXE_EVENT_DATA
+    int ECORE_EXE_EVENT_ERROR
+
+    enum:
+        ECORE_CALLBACK_CANCEL
+        ECORE_CALLBACK_RENEW
+
+    enum:
+        ECORE_CALLBACK_PASS_ON
+        ECORE_CALLBACK_DONE
+
+    ctypedef enum Ecore_Fd_Handler_Flags:
+        ECORE_FD_READ
+        ECORE_FD_WRITE
+        ECORE_FD_ERROR
+
+    ctypedef enum Ecore_Exe_Flags:
+        ECORE_EXE_NONE
+        ECORE_EXE_PIPE_READ
+        ECORE_EXE_PIPE_WRITE
+        ECORE_EXE_PIPE_ERROR
+        ECORE_EXE_PIPE_READ_LINE_BUFFERED
+        ECORE_EXE_PIPE_ERROR_LINE_BUFFERED
+        ECORE_EXE_PIPE_AUTO
+        ECORE_EXE_RESPAWN
+        ECORE_EXE_USE_SH
+        ECORE_EXE_NOT_LEADER
+        ECORE_EXE_TERM_WITH_PARENT
+
+    ctypedef enum Ecore_Pos_Map:
+        ECORE_POS_MAP_LINEAR
+        ECORE_POS_MAP_ACCELERATE
+        ECORE_POS_MAP_DECELERATE
+        ECORE_POS_MAP_SINUSOIDAL
+        ECORE_POS_MAP_ACCELERATE_FACTOR
+        ECORE_POS_MAP_DECELERATE_FACTOR
+        ECORE_POS_MAP_SINUSOIDAL_FACTOR
+        ECORE_POS_MAP_DIVISOR_INTERP
+        ECORE_POS_MAP_BOUNCE
+        ECORE_POS_MAP_SPRING
+
+    ctypedef enum Ecore_Animator_Source:
+        ECORE_ANIMATOR_SOURCE_TIMER
+        ECORE_ANIMATOR_SOURCE_CUSTOM
diff --git a/include/efl.ecore.pxd b/include/efl.ecore.pxd
index eafff25..3d92871 100644
--- a/include/efl.ecore.pxd
+++ b/include/efl.ecore.pxd
@@ -18,7 +18,7 @@
 from efl cimport *
 from efl.c_eo cimport Eo as cEo
 from efl.eo cimport Eo
-
+from efl.ecore.enums cimport Ecore_Fd_Handler_Flags, Ecore_Exe_Flags
 
 
 cdef extern from "Ecore.h":
@@ -72,27 +72,6 @@ cdef extern from "Ecore.h":
     ctypedef struct Ecore_Exe
     ctypedef Ecore_Exe const_Ecore_Exe "const Ecore_Exe"
 
-    int ECORE_EVENT_SIGNAL_USER
-    int ECORE_EVENT_SIGNAL_HUP
-    int ECORE_EVENT_SIGNAL_EXIT
-    int ECORE_EVENT_SIGNAL_POWER
-    int ECORE_EVENT_SIGNAL_REALTIME
-
-    int ECORE_EXE_EVENT_ADD
-    int ECORE_EXE_EVENT_DEL
-    int ECORE_EXE_EVENT_DATA
-    int ECORE_EXE_EVENT_ERROR
-
-
-    ####################################################################
-    # Enumerations
-    #
-    ctypedef enum Ecore_Fd_Handler_Flags:
-        pass
-
-    ctypedef enum Ecore_Exe_Flags:
-        pass
-
     ####################################################################
     # Other typedefs
     #
@@ -254,7 +233,7 @@ cdef class ExeEventFilter(object):
     cdef Ecore_Exe *exe
     cdef Ecore_Event_Handler *handler
     cdef readonly object owner
-    cdef readonly object event_type
+    cdef readonly int event_type
     cdef object callbacks
 
 

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to