summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-11-19 18:37:37 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-11-19 18:37:37 +0200
commit251ef36f33c6032c965431de1b6e559e9ab790cf (patch)
tree42b4be1c070bc9bfc2eae42f85a2863d37a3d92a
parenta4593ce77b81ad8f813c5a3007330fa9645804eb (diff)
Added _insatnce_set3() func; No it's possible to call eo_add_custom from __init__, and pass created object to func to set connection between C and Py objects
Signed-off-by: Yakov Goldberg <yakov.g@samsung.com>
-rw-r--r--eo_py/eodefault.pxd2
-rw-r--r--eo_py/eodefault.pyx26
2 files changed, 13 insertions, 15 deletions
diff --git a/eo_py/eodefault.pxd b/eo_py/eodefault.pxd
index 7eb09d6..8978cea 100644
--- a/eo_py/eodefault.pxd
+++ b/eo_py/eodefault.pxd
@@ -80,7 +80,7 @@ cdef class EoDefault:
80 cdef object name 80 cdef object name
81 cdef int print_func_name(self, f_name) 81 cdef int print_func_name(self, f_name)
82 cdef int _eo_instance_set(self, Eo *eo) 82 cdef int _eo_instance_set(self, Eo *eo)
83 cpdef _eo_instance_set2(self, klass, EoDefault parent) 83 cpdef _eo_instance_set2(self, unsigned long long klass, EoDefault parent)
84 84
85cdef Eo* _eo_instance_get(EoDefault pyobj) 85cdef Eo* _eo_instance_get(EoDefault pyobj)
86cdef Eina_Bool _object_callback(void *data, Eo *o, Eo_Event_Description *desc, void *event_info) 86cdef Eina_Bool _object_callback(void *data, Eo *o, Eo_Event_Description *desc, void *event_info)
diff --git a/eo_py/eodefault.pyx b/eo_py/eodefault.pyx
index 12194d8..530fe19 100644
--- a/eo_py/eodefault.pyx
+++ b/eo_py/eodefault.pyx
@@ -112,28 +112,26 @@ cdef class EoDefault:
112 112
113 def name_get(self): 113 def name_get(self):
114 return self.name 114 return self.name
115 115 #this func can be called only from this (c-styled)module
116 cdef int _eo_instance_set(self, Eo *eo): 116 cdef int _eo_instance_set(self, Eo *eo):
117 assert self.eo == NULL, "Object must be clean" 117 assert self.eo == NULL, "Object must be clean"
118 self.eo = eo 118 self.eo = eo
119 self.name = self.__class__.__name__ 119 self.name = self.__class__.__name__
120 120
121 cpdef _eo_instance_set2(self, _kl, EoDefault p): 121 # this func is main routine to add new object
122 kl = <long>_kl 122 # using default constructor
123 cdef Eo_Class *kl2 = <Eo_Class*>kl 123 # and connect C and Py objects
124 cdef Eo *o = eodefault.eo_add(kl2, eodefault._eo_instance_get(p)) 124 cpdef _eo_instance_set2(self, unsigned long long _kl, EoDefault p):
125 cdef Eo_Class *kl = <Eo_Class*>_kl
126 cdef Eo *o = eodefault.eo_add(kl, eodefault._eo_instance_get(p))
125 self._eo_instance_set(o) 127 self._eo_instance_set(o)
126 self._data_set(EoDefault.PY_EO_NAME, self) 128 self._data_set(EoDefault.PY_EO_NAME, self)
127 129
128 #function added to start support custom constructors 130 # this func can be called outside(this c-styled module), because receives Eo* as long.
129 def _eo_instance_set3(self, _kl, EoDefault p, *args): 131 # it was added to be able to call eo_add_custom with different params
130 kl = <long>_kl 132 # and connect C and Py objects after it
131 cdef Eo_Class *kl2 = <Eo_Class*>kl 133 def _eo_instance_set3(self, unsigned long long _eo):
132 cdef Eo_Op _p0 = <Eo_Op>args[0] 134 cdef Eo *o = <Eo*>_eo
133 cdef char *_p1 = <char*>args[1]
134 cdef int _p2 = <int>args[2]
135 print "_eo_instance_set3",_p0, _p1, _p2
136 cdef Eo *o = eodefault.eo_add_custom(kl2, eodefault._eo_instance_get(p), _p0, _p1, _p2)
137 self._eo_instance_set(o) 135 self._eo_instance_set(o)
138 self._data_set(EoDefault.PY_EO_NAME, self) 136 self._data_set(EoDefault.PY_EO_NAME, self)
139 137