summaryrefslogtreecommitdiff
path: root/efl
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-04-14 21:41:38 +0200
committerdavemds <dave@gurumeditation.it>2014-04-14 21:41:38 +0200
commitcc02387266c0561be0ed47df294b01472c6bad61 (patch)
tree5d095b62d0168b63415da9d3bc21fff784ebc3e5 /efl
parent6408f8d318ef2258fd35d0dfd134ff113ea2bb7a (diff)
Adjust the bindings to work with Eo2
Diffstat (limited to 'efl')
-rw-r--r--efl/eo/efl.eo.pyx46
1 files changed, 19 insertions, 27 deletions
diff --git a/efl/eo/efl.eo.pyx b/efl/eo/efl.eo.pyx
index 6f8f27f..74d1eb6 100644
--- a/efl/eo/efl.eo.pyx
+++ b/efl/eo/efl.eo.pyx
@@ -22,13 +22,12 @@ from efl.eina cimport Eina_Bool, \
22 Eina_Hash, eina_hash_string_superfast_new, eina_hash_add, eina_hash_del, \ 22 Eina_Hash, eina_hash_string_superfast_new, eina_hash_add, eina_hash_del, \
23 eina_hash_find, EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO 23 eina_hash_find, EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO
24from efl.c_eo cimport Eo as cEo, eo_init, eo_shutdown, eo_del, eo_do, \ 24from efl.c_eo cimport Eo as cEo, eo_init, eo_shutdown, eo_del, eo_do, \
25 eo_class_name_get, eo_class_get, eo_base_data_set, eo_base_data_get, \ 25 eo_class_name_get, eo_class_get, eo_base_class_get,\
26 eo_base_data_del, eo_event_callback_add, eo_event_callback_del, \ 26 eo_key_data_set, eo_key_data_get, eo_key_data_del, \
27 Eo_Event_Description, \ 27 eo_event_callback_add, eo_event_callback_del, EO_EV_DEL, \
28 eo_parent_get, EO_EV_DEL, EO_BASE_BASE_ID, eo_base_class_get, \ 28 eo_parent_get, eo_parent_set, Eo_Event_Description, \
29 eo_event_freeze, eo_event_thaw, eo_event_freeze_get, \ 29 eo_event_freeze, eo_event_thaw, eo_event_freeze_get, \
30 eo_event_global_freeze, eo_event_global_thaw, eo_event_global_freeze_get, \ 30 eo_event_global_freeze, eo_event_global_thaw, eo_event_global_freeze_get
31 eo_parent_set
32 31
33cimport efl.eo.enums as enums 32cimport efl.eo.enums as enums
34 33
@@ -55,23 +54,17 @@ init()
55 54
56def event_global_freeze_get(): 55def event_global_freeze_get():
57 cdef int fcount 56 cdef int fcount
58 eo_do( 57 fcount = <int>eo_do(<const cEo *>eo_base_class_get(),
59 <const cEo *>eo_base_class_get(), 58 eo_event_global_freeze_get())
60 eo_event_global_freeze_get(&fcount),
61 )
62 return fcount 59 return fcount
63 60
64def event_global_freeze(): 61def event_global_freeze():
65 eo_do( 62 eo_do(<const cEo *>eo_base_class_get(),
66 <const cEo *>eo_base_class_get(), 63 eo_event_global_freeze())
67 eo_event_global_freeze(),
68 )
69 64
70def event_global_thaw(): 65def event_global_thaw():
71 eo_do( 66 eo_do(<const cEo *>eo_base_class_get(),
72 <const cEo *>eo_base_class_get(), 67 eo_event_global_thaw())
73 eo_event_global_thaw()
74 )
75 68
76###################################################################### 69######################################################################
77 70
@@ -114,7 +107,7 @@ cdef object object_from_instance(cEo *obj):
114 if obj == NULL: 107 if obj == NULL:
115 return None 108 return None
116 109
117 eo_do(obj, eo_base_data_get("python-eo", &data)) 110 data = eo_do(obj, eo_key_data_get("python-eo"))
118 if data != NULL: 111 if data != NULL:
119 EINA_LOG_DOM_DBG(PY_EFL_EO_LOG_DOMAIN, 112 EINA_LOG_DOM_DBG(PY_EFL_EO_LOG_DOMAIN,
120 "Returning a Python object instance for Eo of type %s.", cls_name) 113 "Returning a Python object instance for Eo of type %s.", cls_name)
@@ -180,7 +173,8 @@ EO_CALLBACK_CONTINUE = enums.EO_CALLBACK_CONTINUE
180 173
181 174
182cdef Eina_Bool _eo_event_del_cb(void *data, cEo *obj, 175cdef Eina_Bool _eo_event_del_cb(void *data, cEo *obj,
183 const Eo_Event_Description *desc, void *event_info) with gil: 176 const Eo_Event_Description *desc,
177 void *event_info) with gil:
184 cdef: 178 cdef:
185 Eo self = <Eo>data 179 Eo self = <Eo>data
186 const char *cls_name = eo_class_name_get(eo_class_get(obj)) 180 const char *cls_name = eo_class_name_get(eo_class_get(obj))
@@ -189,7 +183,7 @@ cdef Eina_Bool _eo_event_del_cb(void *data, cEo *obj,
189 183
190 eo_do(self.obj, 184 eo_do(self.obj,
191 eo_event_callback_del(EO_EV_DEL, _eo_event_del_cb, <const void *>self)) 185 eo_event_callback_del(EO_EV_DEL, _eo_event_del_cb, <const void *>self))
192 eo_do(self.obj, eo_base_data_del("python-eo")) 186 eo_do(self.obj, eo_key_data_del("python-eo"))
193 self.obj = NULL 187 self.obj = NULL
194 Py_DECREF(self) 188 Py_DECREF(self)
195 189
@@ -215,7 +209,7 @@ cdef class Eo(object):
215 def __repr__(self): 209 def __repr__(self):
216 cdef cEo *parent = NULL 210 cdef cEo *parent = NULL
217 if self.obj != NULL: 211 if self.obj != NULL:
218 eo_do(self.obj, eo_parent_get(&parent)) 212 parent = <cEo *>eo_do(self.obj, eo_parent_get())
219 return ("<%s object (Eo) at %#x (obj=%#x, parent=%#x, refcount=%d)>") % ( 213 return ("<%s object (Eo) at %#x (obj=%#x, parent=%#x, refcount=%d)>") % (
220 type(self).__name__, 214 type(self).__name__,
221 <uintptr_t><void *>self, 215 <uintptr_t><void *>self,
@@ -231,7 +225,7 @@ cdef class Eo(object):
231 assert obj != NULL, "Cannot set a NULL object" 225 assert obj != NULL, "Cannot set a NULL object"
232 226
233 self.obj = obj 227 self.obj = obj
234 eo_do(self.obj, eo_base_data_set("python-eo", <void *>self, NULL)) 228 eo_do(self.obj, eo_key_data_set("python-eo", <void *>self, NULL))
235 eo_do(self.obj, 229 eo_do(self.obj,
236 eo_event_callback_add(EO_EV_DEL, _eo_event_del_cb, <const void *>self)) 230 eo_event_callback_add(EO_EV_DEL, _eo_event_del_cb, <const void *>self))
237 Py_INCREF(self) 231 Py_INCREF(self)
@@ -282,8 +276,7 @@ cdef class Eo(object):
282 :rtype: :class:`Eo` 276 :rtype: :class:`Eo`
283 277
284 """ 278 """
285 cdef cEo *parent = NULL 279 cdef cEo *parent = <cEo *>eo_do(self.obj, eo_parent_get())
286 eo_do(self.obj, eo_parent_get(&parent))
287 return object_from_instance(parent) 280 return object_from_instance(parent)
288 281
289 def event_freeze(self): 282 def event_freeze(self):
@@ -301,6 +294,5 @@ cdef class Eo(object):
301 :rtype: int 294 :rtype: int
302 295
303 """ 296 """
304 cdef int fcount 297 cdef int fcount = <int>eo_do(self.obj, eo_event_freeze_get())
305 eo_do(self.obj, eo_event_freeze_get(&fcount))
306 return fcount 298 return fcount