diff options
author | Kai Huuhko <kai.huuhko@gmail.com> | 2015-03-13 13:10:22 +0200 |
---|---|---|
committer | Kai Huuhko <kai.huuhko@gmail.com> | 2015-03-13 13:10:22 +0200 |
commit | ea2d5bd689226dc2a8c5cb2d0ca28ec0913bffa7 (patch) | |
tree | 0836fadff8dec85f48d4cc5d74f8c9196f388787 | |
parent | 3120e56250e2ec87b74c0c01f8a53234fa8610b7 (diff) |
Evas.SmartObject: Optimize Smart calls
-rw-r--r-- | efl/evas/efl.evas_object_smart.pxi | 145 |
1 files changed, 75 insertions, 70 deletions
diff --git a/efl/evas/efl.evas_object_smart.pxi b/efl/evas/efl.evas_object_smart.pxi index 998a6a2..460f3b7 100644 --- a/efl/evas/efl.evas_object_smart.pxi +++ b/efl/evas/efl.evas_object_smart.pxi | |||
@@ -30,7 +30,7 @@ cdef void _smart_object_delete(Evas_Object *o) with gil: | |||
30 | cdef: | 30 | cdef: |
31 | void *tmp | 31 | void *tmp |
32 | Smart cls | 32 | Smart cls |
33 | Eo obj | 33 | SmartObject obj |
34 | 34 | ||
35 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 35 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
36 | if tmp == NULL: | 36 | if tmp == NULL: |
@@ -38,12 +38,15 @@ cdef void _smart_object_delete(Evas_Object *o) with gil: | |||
38 | return | 38 | return |
39 | cls = <Smart>tmp | 39 | cls = <Smart>tmp |
40 | 40 | ||
41 | if "delete" not in cls.__class__.__dict__: | ||
42 | return | ||
43 | |||
41 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) | 44 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) |
42 | if tmp == NULL: | 45 | if tmp == NULL: |
43 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 46 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
44 | obj = None | 47 | obj = None |
45 | else: | 48 | else: |
46 | obj = <Eo>tmp | 49 | obj = <SmartObject>tmp |
47 | 50 | ||
48 | try: | 51 | try: |
49 | cls.delete(obj) | 52 | cls.delete(obj) |
@@ -55,7 +58,7 @@ cdef void _smart_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y) with gi | |||
55 | cdef: | 58 | cdef: |
56 | void *tmp | 59 | void *tmp |
57 | Smart cls | 60 | Smart cls |
58 | Eo obj | 61 | SmartObject obj |
59 | 62 | ||
60 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 63 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
61 | if tmp == NULL: | 64 | if tmp == NULL: |
@@ -63,25 +66,27 @@ cdef void _smart_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y) with gi | |||
63 | return | 66 | return |
64 | cls = <Smart>tmp | 67 | cls = <Smart>tmp |
65 | 68 | ||
69 | if "move" not in cls.__class__.__dict__: | ||
70 | return | ||
71 | |||
66 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) | 72 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) |
67 | if tmp == NULL: | 73 | if tmp == NULL: |
68 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 74 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
69 | obj = None | 75 | obj = None |
70 | else: | 76 | else: |
71 | obj = <Eo>tmp | 77 | obj = <SmartObject>tmp |
72 | 78 | ||
73 | if cls.move is not None: | 79 | try: |
74 | try: | 80 | cls.move(obj, x, y) |
75 | cls.move(obj, x, y) | 81 | except Exception: |
76 | except Exception: | 82 | traceback.print_exc() |
77 | traceback.print_exc() | ||
78 | 83 | ||
79 | 84 | ||
80 | cdef void _smart_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h) with gil: | 85 | cdef void _smart_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h) with gil: |
81 | cdef: | 86 | cdef: |
82 | void *tmp | 87 | void *tmp |
83 | Smart cls | 88 | Smart cls |
84 | Eo obj | 89 | SmartObject obj |
85 | 90 | ||
86 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 91 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
87 | if tmp == NULL: | 92 | if tmp == NULL: |
@@ -94,20 +99,19 @@ cdef void _smart_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h) with | |||
94 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 99 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
95 | obj = None | 100 | obj = None |
96 | else: | 101 | else: |
97 | obj = <Eo>tmp | 102 | obj = <SmartObject>tmp |
98 | 103 | ||
99 | if cls.resize is not None: | 104 | try: |
100 | try: | 105 | cls.resize(obj, w, h) |
101 | cls.resize(obj, w, h) | 106 | except Exception: |
102 | except Exception: | 107 | traceback.print_exc() |
103 | traceback.print_exc() | ||
104 | 108 | ||
105 | 109 | ||
106 | cdef void _smart_object_show(Evas_Object *o) with gil: | 110 | cdef void _smart_object_show(Evas_Object *o) with gil: |
107 | cdef: | 111 | cdef: |
108 | void *tmp | 112 | void *tmp |
109 | Smart cls | 113 | Smart cls |
110 | Eo obj | 114 | SmartObject obj |
111 | 115 | ||
112 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 116 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
113 | if tmp == NULL: | 117 | if tmp == NULL: |
@@ -120,20 +124,19 @@ cdef void _smart_object_show(Evas_Object *o) with gil: | |||
120 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 124 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
121 | obj = None | 125 | obj = None |
122 | else: | 126 | else: |
123 | obj = <Eo>tmp | 127 | obj = <SmartObject>tmp |
124 | 128 | ||
125 | if cls.show is not None: | 129 | try: |
126 | try: | 130 | cls.show(obj) |
127 | cls.show(obj) | 131 | except Exception: |
128 | except Exception: | 132 | traceback.print_exc() |
129 | traceback.print_exc() | ||
130 | 133 | ||
131 | 134 | ||
132 | cdef void _smart_object_hide(Evas_Object *o) with gil: | 135 | cdef void _smart_object_hide(Evas_Object *o) with gil: |
133 | cdef: | 136 | cdef: |
134 | void *tmp | 137 | void *tmp |
135 | Smart cls | 138 | Smart cls |
136 | Eo obj | 139 | SmartObject obj |
137 | 140 | ||
138 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 141 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
139 | if tmp == NULL: | 142 | if tmp == NULL: |
@@ -146,20 +149,19 @@ cdef void _smart_object_hide(Evas_Object *o) with gil: | |||
146 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 149 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
147 | obj = None | 150 | obj = None |
148 | else: | 151 | else: |
149 | obj = <Eo>tmp | 152 | obj = <SmartObject>tmp |
150 | 153 | ||
151 | if cls.hide is not None: | 154 | try: |
152 | try: | 155 | cls.hide(obj) |
153 | cls.hide(obj) | 156 | except Exception: |
154 | except Exception: | 157 | traceback.print_exc() |
155 | traceback.print_exc() | ||
156 | 158 | ||
157 | 159 | ||
158 | cdef void _smart_object_color_set(Evas_Object *o, int r, int g, int b, int a) with gil: | 160 | cdef void _smart_object_color_set(Evas_Object *o, int r, int g, int b, int a) with gil: |
159 | cdef: | 161 | cdef: |
160 | void *tmp | 162 | void *tmp |
161 | Smart cls | 163 | Smart cls |
162 | Eo obj | 164 | SmartObject obj |
163 | 165 | ||
164 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 166 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
165 | if tmp == NULL: | 167 | if tmp == NULL: |
@@ -172,20 +174,19 @@ cdef void _smart_object_color_set(Evas_Object *o, int r, int g, int b, int a) wi | |||
172 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 174 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
173 | obj = None | 175 | obj = None |
174 | else: | 176 | else: |
175 | obj = <Eo>tmp | 177 | obj = <SmartObject>tmp |
176 | 178 | ||
177 | if cls.color_set is not None: | 179 | try: |
178 | try: | 180 | cls.color_set(obj, r, g, b, a) |
179 | cls.color_set(obj, r, g, b, a) | 181 | except Exception: |
180 | except Exception: | 182 | traceback.print_exc() |
181 | traceback.print_exc() | ||
182 | 183 | ||
183 | 184 | ||
184 | cdef void _smart_object_clip_set(Evas_Object *o, Evas_Object *clip) with gil: | 185 | cdef void _smart_object_clip_set(Evas_Object *o, Evas_Object *clip) with gil: |
185 | cdef: | 186 | cdef: |
186 | void *tmp | 187 | void *tmp |
187 | Smart cls | 188 | Smart cls |
188 | Eo obj | 189 | SmartObject obj |
189 | Object other | 190 | Object other |
190 | 191 | ||
191 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 192 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
@@ -199,22 +200,21 @@ cdef void _smart_object_clip_set(Evas_Object *o, Evas_Object *clip) with gil: | |||
199 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 200 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
200 | obj = None | 201 | obj = None |
201 | else: | 202 | else: |
202 | obj = <Eo>tmp | 203 | obj = <SmartObject>tmp |
203 | 204 | ||
204 | other = object_from_instance(clip) | 205 | other = object_from_instance(clip) |
205 | 206 | ||
206 | if cls.clip_set is not None: | 207 | try: |
207 | try: | 208 | cls.clip_set(obj, other) |
208 | cls.clip_set(obj, other) | 209 | except Exception: |
209 | except Exception: | 210 | traceback.print_exc() |
210 | traceback.print_exc() | ||
211 | 211 | ||
212 | 212 | ||
213 | cdef void _smart_object_clip_unset(Evas_Object *o) with gil: | 213 | cdef void _smart_object_clip_unset(Evas_Object *o) with gil: |
214 | cdef: | 214 | cdef: |
215 | void *tmp | 215 | void *tmp |
216 | Smart cls | 216 | Smart cls |
217 | Eo obj | 217 | SmartObject obj |
218 | 218 | ||
219 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 219 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
220 | if tmp == NULL: | 220 | if tmp == NULL: |
@@ -227,20 +227,19 @@ cdef void _smart_object_clip_unset(Evas_Object *o) with gil: | |||
227 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 227 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
228 | obj = None | 228 | obj = None |
229 | else: | 229 | else: |
230 | obj = <Eo>tmp | 230 | obj = <SmartObject>tmp |
231 | 231 | ||
232 | if cls.clip_unset is not None: | 232 | try: |
233 | try: | 233 | cls.clip_unset(obj) |
234 | cls.clip_unset(obj) | 234 | except Exception: |
235 | except Exception: | 235 | traceback.print_exc() |
236 | traceback.print_exc() | ||
237 | 236 | ||
238 | 237 | ||
239 | cdef void _smart_object_calculate(Evas_Object *o) with gil: | 238 | cdef void _smart_object_calculate(Evas_Object *o) with gil: |
240 | cdef: | 239 | cdef: |
241 | void *tmp | 240 | void *tmp |
242 | Smart cls | 241 | Smart cls |
243 | Eo obj | 242 | SmartObject obj |
244 | 243 | ||
245 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 244 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
246 | if tmp == NULL: | 245 | if tmp == NULL: |
@@ -248,25 +247,27 @@ cdef void _smart_object_calculate(Evas_Object *o) with gil: | |||
248 | return | 247 | return |
249 | cls = <Smart>tmp | 248 | cls = <Smart>tmp |
250 | 249 | ||
250 | if "calculate" not in cls.__class__.__dict__: | ||
251 | return | ||
252 | |||
251 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) | 253 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) |
252 | if tmp == NULL: | 254 | if tmp == NULL: |
253 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 255 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
254 | obj = None | 256 | obj = None |
255 | else: | 257 | else: |
256 | obj = <Eo>tmp | 258 | obj = <SmartObject>tmp |
257 | 259 | ||
258 | if cls.calculate is not None: | 260 | try: |
259 | try: | 261 | cls.calculate(obj) |
260 | cls.calculate(obj) | 262 | except Exception: |
261 | except Exception: | 263 | traceback.print_exc() |
262 | traceback.print_exc() | ||
263 | 264 | ||
264 | 265 | ||
265 | cdef void _smart_object_member_add(Evas_Object *o, Evas_Object *clip) with gil: | 266 | cdef void _smart_object_member_add(Evas_Object *o, Evas_Object *clip) with gil: |
266 | cdef: | 267 | cdef: |
267 | void *tmp | 268 | void *tmp |
268 | Smart cls | 269 | Smart cls |
269 | Eo obj | 270 | SmartObject obj |
270 | Object other | 271 | Object other |
271 | 272 | ||
272 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) | 273 | tmp = evas_smart_data_get(evas_object_smart_smart_get(o)) |
@@ -275,20 +276,22 @@ cdef void _smart_object_member_add(Evas_Object *o, Evas_Object *clip) with gil: | |||
275 | return | 276 | return |
276 | cls = <Smart>tmp | 277 | cls = <Smart>tmp |
277 | 278 | ||
279 | if "member_add" not in cls.__class__.__dict__: | ||
280 | return | ||
281 | |||
278 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) | 282 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) |
279 | if tmp == NULL: | 283 | if tmp == NULL: |
280 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 284 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
281 | obj = None | 285 | obj = None |
282 | else: | 286 | else: |
283 | obj = <Eo>tmp | 287 | obj = <SmartObject>tmp |
284 | 288 | ||
285 | other = object_from_instance(clip) | 289 | other = object_from_instance(clip) |
286 | 290 | ||
287 | if cls.member_add is not None: | 291 | try: |
288 | try: | 292 | cls.member_add(obj, other) |
289 | cls.member_add(obj, other) | 293 | except Exception: |
290 | except Exception: | 294 | traceback.print_exc() |
291 | traceback.print_exc() | ||
292 | 295 | ||
293 | 296 | ||
294 | cdef void _smart_object_member_del(Evas_Object *o, Evas_Object *clip) with gil: | 297 | cdef void _smart_object_member_del(Evas_Object *o, Evas_Object *clip) with gil: |
@@ -304,6 +307,9 @@ cdef void _smart_object_member_del(Evas_Object *o, Evas_Object *clip) with gil: | |||
304 | return | 307 | return |
305 | cls = <Smart>tmp | 308 | cls = <Smart>tmp |
306 | 309 | ||
310 | if "member_del" not in cls.__class__.__dict__: | ||
311 | return | ||
312 | |||
307 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) | 313 | eo_do_ret(o, tmp, eo_key_data_get("python-eo")) |
308 | if tmp == NULL: | 314 | if tmp == NULL: |
309 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) | 315 | EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL) |
@@ -313,11 +319,10 @@ cdef void _smart_object_member_del(Evas_Object *o, Evas_Object *clip) with gil: | |||
313 | 319 | ||
314 | other = object_from_instance(clip) | 320 | other = object_from_instance(clip) |
315 | 321 | ||
316 | if cls.member_del is not None: | 322 | try: |
317 | try: | 323 | cls.member_del(obj, other) |
318 | cls.member_del(obj, other) | 324 | except Exception: |
319 | except Exception: | 325 | traceback.print_exc() |
320 | traceback.print_exc() | ||
321 | 326 | ||
322 | 327 | ||
323 | cdef class _SmartCb: | 328 | cdef class _SmartCb: |