summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-07-16 14:12:32 +0200
committerDave Andreoli <dave@gurumeditation.it>2017-07-16 14:12:32 +0200
commit8ad73b3e698080ba5cad8a00bb57965572c6b473 (patch)
tree9dead1f0652025be7721a9ef2b03339ae2de7d20
parent5b9ba62e8f440009cd07da19f2276cfdb0415ddc (diff)
Ecore.Poller is no more an Eo object in C :(
-rw-r--r--efl/ecore/efl.ecore_poller.pxi37
-rw-r--r--include/efl.ecore.pxd4
2 files changed, 29 insertions, 12 deletions
diff --git a/efl/ecore/efl.ecore_poller.pxi b/efl/ecore/efl.ecore_poller.pxi
index 3a7fa15..617f94b 100644
--- a/efl/ecore/efl.ecore_poller.pxi
+++ b/efl/ecore/efl.ecore_poller.pxi
@@ -83,24 +83,39 @@ cdef class Poller(Eo):
83 self.func = func 83 self.func = func
84 self.args = args 84 self.args = args
85 self.kargs = kargs 85 self.kargs = kargs
86 self._set_obj(ecore_poller_add(pol_type, interval, _ecore_task_cb, <void *>self)) 86
87 # From efl 1.20 pollers are no more Eo objects in C, thus
88 # we cannot use Eo.obj and _set_obj() anymore :(
89 # self._set_obj(ecore_poller_add(pol_type, interval, _ecore_task_cb, <void *>self))
90 self.obj2 = ecore_poller_add(pol_type, interval, _ecore_task_cb, <void *>self)
91 Py_INCREF(self)
87 92
88 def __str__(self): 93 def __str__(self):
89 return "%s Poller(func=%s, args=%s, kargs=%s)" % (Eo.__str__(self), 94 return "Poller(func=%s, args=%s, kargs=%s)" % (
90 self.func, self.args, self.kargs) 95 self.func, self.args, self.kargs)
91 96
92 def __repr__(self): 97 def __repr__(self):
93 return "%s Poller(interval=%d, func=%s, args=%s, kargs=%s)" % (Eo.__repr__(self), 98 return "Poller(interval=%d, func=%s, args=%s, kargs=%s)" % (
94 self.interval if self.obj else -1, 99 self.interval if self.obj2 else -1,
95 self.func, self.args, self.kargs) 100 self.func, self.args, self.kargs)
96 101
97 cpdef bint _task_exec(self) except *: 102 cpdef bint _task_exec(self) except *:
98 return self.func(*self.args, **self.kargs) 103 return self.func(*self.args, **self.kargs)
99 104
105 def is_deleted(self):
106 """Check if the object has been deleted thus leaving the object shallow.
107
108 :return: True if the object has been deleted yet, False otherwise.
109 :rtype: bool
110
111 """
112 return bool(self.obj2 == NULL)
113
100 def delete(self): 114 def delete(self):
101 """ Stop callback emission and free internal resources. """ 115 """ Stop callback emission and free internal resources. """
102 ecore_poller_del(self.obj) 116 ecore_poller_del(self.obj2)
103 117 self.obj2 = NULL
118 Py_DECREF(self)
104 119
105 property interval: 120 property interval:
106 """ The interval (in ticks) between each call of the poller 121 """ The interval (in ticks) between each call of the poller
@@ -109,15 +124,15 @@ cdef class Poller(Eo):
109 124
110 """ 125 """
111 def __get__(self): 126 def __get__(self):
112 return ecore_poller_poller_interval_get(self.obj) 127 return ecore_poller_poller_interval_get(self.obj2)
113 128
114 def __set__(self, int t): 129 def __set__(self, int t):
115 ecore_poller_poller_interval_set(self.obj, t) 130 ecore_poller_poller_interval_set(self.obj2, t)
116 131
117 def interval_set(self, int t): 132 def interval_set(self, int t):
118 ecore_poller_poller_interval_set(self.obj, t) 133 ecore_poller_poller_interval_set(self.obj2, t)
119 def interval_get(self): 134 def interval_get(self):
120 return ecore_poller_poller_interval_get(self.obj) 135 return ecore_poller_poller_interval_get(self.obj2)
121 136
122 137
123def poller_add(int t, func, *args, **kargs): 138def poller_add(int t, func, *args, **kargs):
diff --git a/include/efl.ecore.pxd b/include/efl.ecore.pxd
index 7e0a02b..8a7c46e 100644
--- a/include/efl.ecore.pxd
+++ b/include/efl.ecore.pxd
@@ -30,7 +30,7 @@ cdef extern from "Ecore.h":
30 # 30 #
31 ctypedef cEo Ecore_Timer 31 ctypedef cEo Ecore_Timer
32 ctypedef struct Ecore_Animator 32 ctypedef struct Ecore_Animator
33 ctypedef cEo Ecore_Poller 33 ctypedef struct Ecore_Poller
34 ctypedef struct Ecore_Idler 34 ctypedef struct Ecore_Idler
35 ctypedef struct Ecore_Idle_Enterer 35 ctypedef struct Ecore_Idle_Enterer
36 ctypedef struct Ecore_Idle_Exiter 36 ctypedef struct Ecore_Idle_Exiter
@@ -220,6 +220,8 @@ cdef class Poller(Eo):
220 cdef readonly tuple args 220 cdef readonly tuple args
221 cdef readonly dict kargs 221 cdef readonly dict kargs
222 cpdef bint _task_exec(self) except * 222 cpdef bint _task_exec(self) except *
223 # we cannot use Eo.obj here because animators are no more eo objects in C
224 cdef Ecore_Poller *obj2
223 225
224 226
225cdef class Idler(Eo): 227cdef class Idler(Eo):