summaryrefslogtreecommitdiff
path: root/efl/edje
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2013-04-14 13:08:15 +0200
committerdavemds <dave@gurumeditation.it>2013-04-14 13:08:15 +0200
commit9d85805b13151206df7f285109f71ba272e445a9 (patch)
tree201cb495c8ceeae9b431ceb4d81c8cbf8945652f /efl/edje
parent9c8405ee0ccd5153807b9adf96297ee1994ee8fc (diff)
Python-EFL: Implemented EdjeEdit API, with full unit tests.
Some stuff is not working on the C side, the unit test is full of FIXME and TODO. The biggest problem is the PartState that do not work at all, I will give a short look at this, but I'm not so much intrested atm...If you want/need to help please let me know.
Diffstat (limited to 'efl/edje')
-rw-r--r--efl/edje/efl.edje_edit.pyx495
-rw-r--r--efl/edje/efl.edje_edit_group.pxi56
-rw-r--r--efl/edje/efl.edje_edit_part.pxi331
-rw-r--r--efl/edje/efl.edje_edit_part_state.pxi851
-rw-r--r--efl/edje/efl.edje_edit_program.pxi260
5 files changed, 1993 insertions, 0 deletions
diff --git a/efl/edje/efl.edje_edit.pyx b/efl/edje/efl.edje_edit.pyx
new file mode 100644
index 0000000..224f12a
--- /dev/null
+++ b/efl/edje/efl.edje_edit.pyx
@@ -0,0 +1,495 @@
1# Copyright (C) 2007-2013 various contributors (see AUTHORS)
2#
3# This file is part of Python-EFL.
4#
5# Python-EFL is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# Python-EFL is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17
18from efl.eo cimport _touni, _ctouni, convert_eina_list_strings_to_python_list
19from efl.edje cimport Edje_Part_Type
20from efl.edje import EDJE_PART_TYPE_EXTERNAL
21
22
23# Edje_Edit_Image_Comp
24EDJE_EDIT_IMAGE_COMP_RAW = 0
25EDJE_EDIT_IMAGE_COMP_USER = 1
26EDJE_EDIT_IMAGE_COMP_COMP = 2
27EDJE_EDIT_IMAGE_COMP_LOSSY = 3
28
29
30cdef class EdjeEdit(Edje):
31
32 def __init__(self, Canvas canvas not None, **kargs):
33 self._set_obj(edje_edit_object_add(canvas.obj))
34 self._set_common_params(**kargs)
35
36 # General
37 def compiler_get(self):
38 cdef const_char *s = edje_edit_compiler_get(self.obj)
39 r = _ctouni(s)
40 if s != NULL:
41 edje_edit_string_free(s)
42 return r
43
44 def save(self):
45 return bool(edje_edit_save(self.obj))
46
47 def save_all(self):
48 return bool(edje_edit_save_all(self.obj))
49
50 def print_internal_status(self):
51 edje_edit_print_internal_status(self.obj)
52
53 # Group
54 property current_group:
55 def __get__(self):
56 return Group(self)
57
58 def group_add(self, name):
59 if isinstance(name, unicode): name = name.encode("UTF-8")
60 return bool(edje_edit_group_add(self.obj,
61 <const_char *>name if name is not None else NULL))
62
63 def group_del(self, name):
64 if isinstance(name, unicode): name = name.encode("UTF-8")
65 return bool(edje_edit_group_del(self.obj,
66 <const_char *>name if name is not None else NULL))
67
68 def group_exist(self, name):
69 if isinstance(name, unicode): name = name.encode("UTF-8")
70 return bool(edje_edit_group_exist(self.obj,
71 <const_char *>name if name is not None else NULL))
72
73 # Data
74 property data:
75 def __get__(self):
76 cdef:
77 Eina_List *lst
78 list ret
79 lst = edje_edit_data_list_get(self.obj)
80 ret = convert_eina_list_strings_to_python_list(lst)
81 edje_edit_string_list_free(lst)
82 return ret
83
84 def data_get(self, name):
85 if isinstance(name, unicode): name = name.encode("UTF-8")
86 cdef const_char *val = edje_edit_data_value_get(self.obj,
87 <const_char *>name if name is not None else NULL)
88 r = _ctouni(val)
89 edje_edit_string_free(val)
90 return r
91
92 def data_set(self, name, value):
93 if isinstance(name, unicode): name = name.encode("UTF-8")
94 if isinstance(value, unicode): value = value.encode("UTF-8")
95
96 return bool(edje_edit_data_value_set(self.obj,
97 <const_char *>name if name is not None else NULL,
98 <const_char *>value if value is not None else NULL))
99
100 def data_add(self, name, value):
101 if isinstance(name, unicode): name = name.encode("UTF-8")
102 if isinstance(value, unicode): value = value.encode("UTF-8")
103 return bool(edje_edit_data_add(self.obj,
104 <const_char *>name if name is not None else NULL,
105 <const_char *>value if value is not None else NULL))
106
107 def data_rename(self, old, new):
108 if isinstance(old, unicode): old = old.encode("UTF-8")
109 if isinstance(new, unicode): new = new.encode("UTF-8")
110 return bool(edje_edit_data_name_set(self.obj,
111 <const_char *>old if old is not None else NULL,
112 <const_char *>new if new is not None else NULL))
113
114 def data_del(self, name):
115 if isinstance(name, unicode): name = name.encode("UTF-8")
116 return bool(edje_edit_data_del(self.obj,
117 <const_char *>name if name is not None else NULL))
118
119 # Group Data
120 property group_data:
121 def __get__(self):
122 cdef:
123 Eina_List *lst
124 list ret
125 lst = edje_edit_group_data_list_get(self.obj)
126 ret = convert_eina_list_strings_to_python_list(lst)
127 edje_edit_string_list_free(lst)
128 return ret
129
130 def group_data_get(self, name):
131 cdef const_char *val
132 if isinstance(name, unicode): name = name.encode("UTF-8")
133 val = edje_edit_group_data_value_get(self.obj,
134 <const_char *>name if name is not None else NULL)
135 r = _ctouni(val)
136 edje_edit_string_free(val)
137 return r
138
139 def group_data_set(self, name, value):
140 if isinstance(name, unicode): name = name.encode("UTF-8")
141 if isinstance(value, unicode): value = value.encode("UTF-8")
142 return bool(edje_edit_group_data_value_set(self.obj,
143 <const_char *>name if name is not None else NULL,
144 <const_char *>value if value is not None else NULL))
145
146 def group_data_add(self, name, value):
147 if isinstance(name, unicode): name = name.encode("UTF-8")
148 if isinstance(value, unicode): value = value.encode("UTF-8")
149 return bool(edje_edit_group_data_add(self.obj,
150 <const_char *>name if name is not None else NULL,
151 <const_char *>value if value is not None else NULL))
152
153 def group_data_rename(self, old, new):
154 if isinstance(old, unicode): old = old.encode("UTF-8")
155 if isinstance(new, unicode): new = new.encode("UTF-8")
156 return bool(edje_edit_group_data_name_set(self.obj,
157 <const_char *>old if old is not None else NULL,
158 <const_char *>new if new is not None else NULL))
159
160 def group_data_del(self, name):
161 if isinstance(name, unicode): name = name.encode("UTF-8")
162 return bool(edje_edit_group_data_del(self.obj,
163 <const_char *>name if name is not None else NULL))
164
165 # Text Style
166 property text_styles:
167 def __get__(self):
168 cdef Eina_List *lst
169 lst = edje_edit_styles_list_get(self.obj)
170 ret = convert_eina_list_strings_to_python_list(lst)
171 edje_edit_string_list_free(lst)
172 return ret
173
174 def text_style_get(self, name):
175 return Text_Style(self, name)
176
177 def text_style_add(self, name):
178 if isinstance(name, unicode): name = name.encode("UTF-8")
179 return bool(edje_edit_style_add(self.obj,
180 <const_char *>name if name is not None else NULL))
181
182 def text_style_del(self, name):
183 if isinstance(name, unicode): name = name.encode("UTF-8")
184 edje_edit_style_del(self.obj,
185 <const_char *>name if name is not None else NULL)
186 return True
187
188 # Color Classes
189 property color_classes:
190 def __get__(self):
191 cdef Eina_List *lst
192 lst = edje_edit_color_classes_list_get(self.obj)
193 ret = convert_eina_list_strings_to_python_list(lst)
194 edje_edit_string_list_free(lst)
195 return ret
196
197 def color_class_get(self, name):
198 return Color_Class(self, name)
199
200 def color_class_add(self, name):
201 if isinstance(name, unicode): name = name.encode("UTF-8")
202 return bool(edje_edit_color_class_add(self.obj,
203 <const_char *>name if name is not None else NULL))
204
205 def color_class_del(self, name):
206 if isinstance(name, unicode): name = name.encode("UTF-8")
207 return bool(edje_edit_color_class_del(self.obj,
208 <const_char *>name if name is not None else NULL))
209
210 # Externals
211 property externals:
212 def __get__(self):
213 cdef Eina_List *lst
214 lst = edje_edit_externals_list_get(self.obj)
215 ret = convert_eina_list_strings_to_python_list(lst)
216 edje_edit_string_list_free(lst)
217 return ret
218
219 def external_add(self, name):
220 if isinstance(name, unicode): name = name.encode("UTF-8")
221 return bool(edje_edit_external_add(self.obj,
222 <const_char *>name if name is not None else NULL))
223
224 def external_del(self, name):
225 if isinstance(name, unicode): name = name.encode("UTF-8")
226 return bool(edje_edit_external_del(self.obj,
227 <const_char *>name if name is not None else NULL))
228
229 # Fonts
230 property fonts:
231 def __get__(self):
232 cdef Eina_List *lst
233 lst = edje_edit_fonts_list_get(self.obj)
234 ret = convert_eina_list_strings_to_python_list(lst)
235 edje_edit_string_list_free(lst)
236 return ret
237
238 def font_add(self, font, alias=None):
239 if isinstance(font, unicode): font = font.encode("UTF-8")
240 if isinstance(alias, unicode): alias = alias.encode("UTF-8")
241 return bool(edje_edit_font_add(self.obj,
242 <const_char *>font if font is not None else NULL,
243 <const_char *>alias if alias is not None else NULL))
244
245 def font_del(self, alias):
246 if isinstance(alias, unicode): alias = alias.encode("UTF-8")
247 return bool(edje_edit_font_del(self.obj,
248 <const_char *>alias if alias is not None else NULL))
249
250 # Parts
251 property parts:
252 def __get__(self):
253 cdef Eina_List *lst
254 lst = edje_edit_parts_list_get(self.obj)
255 ret = convert_eina_list_strings_to_python_list(lst)
256 edje_edit_string_list_free(lst)
257 return ret
258
259 def part_get(self, name):
260 if self.part_exist(name):
261 return Part(self, name)
262 return None
263
264 def part_add(self, name, int type, char *source=""):
265 if isinstance(name, unicode): name = name.encode("UTF-8")
266 if type != EDJE_PART_TYPE_EXTERNAL:
267 return bool(edje_edit_part_add(self.obj,
268 <const_char *>name if name is not None else NULL,
269 <Edje_Part_Type>type))
270 else:
271 return bool(edje_edit_part_external_add(self.obj, name, source))
272
273 def part_del(self, name):
274 if isinstance(name, unicode): name = name.encode("UTF-8")
275 return bool(edje_edit_part_del(self.obj,
276 <const_char *>name if name is not None else NULL))
277
278 def part_exist(self, name):
279 if isinstance(name, unicode): name = name.encode("UTF-8")
280 return bool(edje_edit_part_exist(self.obj,
281 <const_char *>name if name is not None else NULL))
282
283 # Images
284 property images:
285 def __get__(self):
286 cdef Eina_List *lst
287 lst = edje_edit_images_list_get(self.obj)
288 ret = convert_eina_list_strings_to_python_list(lst)
289 edje_edit_string_list_free(lst)
290 return ret
291
292 def image_id_get(self, image):
293 if isinstance(image, unicode): image = image.encode("UTF-8")
294 return edje_edit_image_id_get(self.obj,
295 <const_char *>image if image is not None else NULL)
296
297 def image_add(self, path):
298 if isinstance(path, unicode): path = path.encode("UTF-8")
299 return bool(edje_edit_image_add(self.obj,
300 <const_char *>path if path is not None else NULL))
301
302 def image_del(self, image):
303 if isinstance(image, unicode): image = image.encode("UTF-8")
304 return bool(edje_edit_image_del(self.obj,
305 <const_char *>image if image is not None else NULL))
306
307 # Programs
308 property programs:
309 def __get__(self):
310 cdef Eina_List *lst
311 lst = edje_edit_programs_list_get(self.obj)
312 ret = convert_eina_list_strings_to_python_list(lst)
313 edje_edit_string_list_free(lst)
314 return ret
315
316 def program_get(self, name):
317 if isinstance(name, unicode): name = name.encode("UTF-8")
318 if self.program_exist(name):
319 return Program(self, name)
320 return None
321
322 def program_add(self, name):
323 if isinstance(name, unicode): name = name.encode("UTF-8")
324 return bool(edje_edit_program_add(self.obj,
325 <const_char *>name if name is not None else NULL))
326
327 def program_del(self, name):
328 if isinstance(name, unicode): name = name.encode("UTF-8")
329 return bool(edje_edit_program_del(self.obj,
330 <const_char *>name if name is not None else NULL))
331
332 def program_exist(self, name):
333 if isinstance(name, unicode): name = name.encode("UTF-8")
334 return bool(edje_edit_program_exist(self.obj,
335 <const_char *>name if name is not None else NULL))
336 """
337 property error:
338 def __get__(self):
339 last_error = c_evas.eina_error_get()
340 if last_error:
341 return c_evas.eina_error_msg_get(last_error)
342
343 return None
344 """
345
346 # Scripts
347 property script:
348 def __get__(self):
349 cdef char *code
350 code = edje_edit_script_get(self.obj)
351 ret = _touni(code)
352 free(code)
353 return ret
354
355 def __set__(self, code):
356 if isinstance(code, unicode): code = code.encode("UTF-8")
357 edje_edit_script_set(self.obj,
358 <char *>code if code is not None else NULL)
359
360 def __del__(self):
361 edje_edit_script_set(self.obj, NULL)
362
363 def script_compile(self):
364 return bool(edje_edit_script_compile(self.obj))
365
366 property script_errors:
367 def __get__(self):
368 cdef const_Eina_List *lst
369 cdef Edje_Edit_Script_Error *se
370 ret = []
371 lst = edje_edit_script_error_list_get(self.obj)
372 while lst:
373 se = <Edje_Edit_Script_Error*>lst.data
374 if se.program_name != NULL:
375 pr = se.program_name
376 else:
377 pr = ''
378 err = (pr, _ctouni(se.error_str))
379 ret.append(err)
380 lst = lst.next
381 return ret
382
383
384cdef class Text_Style(object):
385 cdef EdjeEdit edje
386 cdef object name
387
388 def __init__(self, EdjeEdit e, name):
389 if isinstance(name, unicode): name = name.encode("UTF-8")
390 self.edje = e
391 self.name = name
392
393 property tags:
394 def __get__(self):
395 cdef Eina_List *lst
396 lst = edje_edit_style_tags_list_get(self.edje.obj,
397 <const_char *>self.name if self.name is not None else NULL)
398 ret = convert_eina_list_strings_to_python_list(lst)
399 edje_edit_string_list_free(lst)
400 return ret
401
402 def tag_get(self, name):
403 return Text_Style_Tag(self, name)
404
405 def tag_add(self, name):
406 if isinstance(name, unicode): name = name.encode("UTF-8")
407 return bool(edje_edit_style_tag_add(self.edje.obj, self.name,
408 <const_char *>name if name is not None else NULL))
409
410 def tag_del(self, name):
411 if isinstance(name, unicode): name = name.encode("UTF-8")
412 edje_edit_style_tag_del(self.edje.obj, self.name,
413 <const_char *>name if name is not None else NULL)
414 return True
415
416
417cdef class Text_Style_Tag(object):
418 cdef Text_Style text_style
419 cdef object name
420
421 def __init__(self, Text_Style text_style, name):
422 if isinstance(name, unicode): name = name.encode("UTF-8")
423 self.text_style = text_style
424 self.name = name
425
426 property value:
427 def __get__(self):
428 cdef const_char *val
429 val = edje_edit_style_tag_value_get(self.text_style.edje.obj,
430 self.text_style.name,
431 <const_char *>self.name if self.name is not None else NULL)
432 ret = _ctouni(val)
433 edje_edit_string_free(val)
434 return ret
435 def __set__(self, value):
436 if isinstance(value, unicode): value = value.encode("UTF-8")
437 edje_edit_style_tag_value_set(self.text_style.edje.obj,
438 self.text_style.name, self.name,
439 <const_char *>value if value is not None else NULL)
440
441 def rename(self, newname):
442 if isinstance(newname, unicode): newname = newname.encode("UTF-8")
443 edje_edit_style_tag_name_set(self.text_style.edje.obj,
444 self.text_style.name,
445 <const_char *>self.name if self.name is not None else NULL,
446 <const_char *>newname if newname is not None else NULL)
447 self.name = <const_char *>newname if newname is not None else NULL
448 return True
449
450
451cdef class Color_Class(object):
452 cdef EdjeEdit edje
453 cdef object name
454
455 def __init__(self, EdjeEdit e, name):
456 if isinstance(name, unicode): name = name.encode("UTF-8")
457 self.edje = e
458 self.name = name
459
460 property name:
461 def __get__(self):
462 return self.name.decode('UTF-8', 'strict')
463
464 def __set__(self, newname):
465 self.rename(newname)
466
467 def rename(self, newname):
468 cdef Eina_Bool ret
469 if isinstance(newname, unicode): newname = newname.encode("UTF-8")
470 ret = edje_edit_color_class_name_set(self.edje.obj,
471 <const_char *>self.name if self.name is not None else NULL,
472 <const_char *>newname if newname is not None else NULL)
473 if ret == 0:
474 return False
475 self.name = newname
476 return True
477
478 def colors_get(self):
479 cdef int r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3
480 edje_edit_color_class_colors_get(self.edje.obj, self.name,
481 &r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)
482 return ((r, g, b, a), (r2, g2, b2, a2), (r3, g3, b3, a3))
483
484 def colors_set(self, int r, int g, int b, int a,
485 int r2, int g2, int b2, int a2,
486 int r3, int g3, int b3, int a3):
487 edje_edit_color_class_colors_set(self.edje.obj, self.name,
488 r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
489
490
491include "efl.edje_edit_group.pxi"
492include "efl.edje_edit_part.pxi"
493include "efl.edje_edit_part_state.pxi"
494include "efl.edje_edit_program.pxi"
495
diff --git a/efl/edje/efl.edje_edit_group.pxi b/efl/edje/efl.edje_edit_group.pxi
new file mode 100644
index 0000000..60eb4b0
--- /dev/null
+++ b/efl/edje/efl.edje_edit_group.pxi
@@ -0,0 +1,56 @@
1# Copyright (C) 2007-2013 various contributors (see AUTHORS)
2#
3# This file is part of Python-EFL.
4#
5# Python-EFL is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# Python-EFL is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17
18
19cdef class Group(object):
20 cdef EdjeEdit edje
21
22 def __init__(self, EdjeEdit e):
23 self.edje = e
24
25 def delete(self):
26 return False
27
28 property w_min: # TODO rename to min_w !!
29 def __get__(self):
30 return edje_edit_group_min_w_get(self.edje.obj)
31 def __set__(self, value):
32 edje_edit_group_min_w_set(self.edje.obj, value)
33
34 property w_max: # TODO rename to max_w !!
35 def __get__(self):
36 return edje_edit_group_max_w_get(self.edje.obj)
37 def __set__(self, value):
38 edje_edit_group_max_w_set(self.edje.obj, value)
39
40 property h_min: # TODO rename to min_h !!
41 def __get__(self):
42 return edje_edit_group_min_h_get(self.edje.obj)
43 def __set__(self, value):
44 edje_edit_group_min_h_set(self.edje.obj, value)
45
46 property h_max: # TODO rename to max_h !!
47 def __get__(self):
48 return edje_edit_group_max_h_get(self.edje.obj)
49 def __set__(self, value):
50 edje_edit_group_max_h_set(self.edje.obj, value)
51
52 def rename(self, name):
53 if isinstance(name, unicode): name = name.encode("UTF-8")
54 return bool(edje_edit_group_name_set(self.edje.obj,
55 <const_char *>name if name is not None else NULL))
56
diff --git a/efl/edje/efl.edje_edit_part.pxi b/efl/edje/efl.edje_edit_part.pxi
new file mode 100644
index 0000000..8332cfb
--- /dev/null
+++ b/efl/edje/efl.edje_edit_part.pxi
@@ -0,0 +1,331 @@
1# Copyright (C) 2007-2013 various contributors (see AUTHORS)
2#
3# This file is part of Python-EFL.
4#
5# Python-EFL is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# Python-EFL is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17
18
19cdef class Part(object):
20 cdef EdjeEdit edje
21 cdef object name
22
23 def __init__(self, EdjeEdit e, name):
24 if isinstance(name, unicode): name = name.encode("UTF-8")
25 self.edje = e
26 self.name = name
27
28 property name:
29 def __get__(self):
30 return self.name.decode('UTF-8', 'strict')
31 def __set__(self, name):
32 self.rename(name)
33
34 def rename(self, newname):
35 cdef Eina_Bool ret
36 if isinstance(newname, unicode): newname = newname.encode("UTF-8")
37 ret = edje_edit_part_name_set(self.edje.obj,
38 <const_char *>self.name if self.name is not None else NULL,
39 <const_char *>newname if newname is not None else NULL)
40 if ret == 0:
41 return False
42 self.name = newname
43 return True
44
45 def above_get(self):
46 cdef:
47 const_char *part
48 object ret
49 part = edje_edit_part_above_get(self.edje.obj,
50 <const_char *>self.name if self.name is not None else NULL)
51 ret = _ctouni(part)
52 edje_edit_string_free(part)
53 return ret
54
55 def below_get(self):
56 cdef:
57 const_char *part
58 object ret
59 part = edje_edit_part_below_get(self.edje.obj,
60 <const_char *>self.name if self.name is not None else NULL)
61 ret = _ctouni(part)
62 edje_edit_string_free(part)
63 return ret
64
65 def restack_below(self):
66 return bool(edje_edit_part_restack_below(self.edje.obj,
67 <const_char *>self.name if self.name is not None else NULL))
68
69 def restack_above(self):
70 return bool(edje_edit_part_restack_above(self.edje.obj,
71 <const_char *>self.name if self.name is not None else NULL))
72
73 property type:
74 def __get__(self):
75 return edje_edit_part_type_get(self.edje.obj,
76 <const_char *>self.name if self.name is not None else NULL)
77
78
79 property states:
80 def __get__(self):
81 cdef Eina_List *lst
82 lst = edje_edit_part_states_list_get(self.edje.obj,
83 <const_char *>self.name if self.name is not None else NULL)
84 ret = convert_eina_list_strings_to_python_list(lst)
85 edje_edit_string_list_free(lst)
86 return ret
87
88 def state_get(self, sname, double value=0.0):
89 if self.state_exist(sname, value):
90 return State(self, sname, value)
91
92 def state_add(self, sname, double value=0.0):
93 if isinstance(sname, unicode): sname = sname.encode("UTF-8")
94 return bool(edje_edit_state_add(self.edje.obj,
95 <const_char *>self.name if self.name is not None else NULL,
96 <const_char *>sname if sname is not None else NULL,
97 value))
98
99 def state_del(self, sname, double value=0.0):
100 if isinstance(sname, unicode): sname = sname.encode("UTF-8")
101 return bool(edje_edit_state_del(self.edje.obj,
102 <const_char *>self.name if self.name is not None else NULL,
103 <const_char *>sname if sname is not None else NULL,
104 value))
105
106 def state_exist(self, sname, double value=0.0):
107 if isinstance(sname, unicode): sname = sname.encode("UTF-8")
108 return bool(edje_edit_state_exist(self.edje.obj,
109 <const_char *>self.name if self.name is not None else NULL,
110 <const_char *>sname if sname is not None else NULL,
111 value))
112
113 def state_copy(self, sfrom, double vfrom, sto, double vto):
114 if isinstance(sfrom, unicode): sfrom = sfrom.encode("UTF-8")
115 if isinstance(sto, unicode): sto = sto.encode("UTF-8")
116 return bool(edje_edit_state_copy(self.edje.obj,
117 <const_char *>self.name if self.name is not None else NULL,
118 <const_char *>sfrom if sfrom is not None else NULL, vfrom,
119 <const_char *>sto if sto is not None else NULL, vto))
120
121 def state_selected_get(self):
122 cdef const_char *sel
123 cdef double val
124 sel = edje_edit_part_selected_state_get(self.edje.obj,
125 <const_char *>self.name if self.name is not None else NULL, &val)
126 if sel == NULL: return None
127 r = _ctouni(sel)
128 v = val
129 edje_edit_string_free(sel)
130 return (r, v)
131
132 def state_selected_set(self, state, double value=0.0):
133 if isinstance(state, unicode): state = state.encode("UTF-8")
134 edje_edit_part_selected_state_set(self.edje.obj,
135 <const_char *>self.name if self.name is not None else NULL,
136 <const_char *>state if state is not None else NULL,
137 value)
138
139 property clip_to:
140 def __get__(self):
141 cdef const_char *clipper
142 clipper = edje_edit_part_clip_to_get(self.edje.obj,
143 <const_char *>self.name if self.name is not None else NULL)
144 ret = _ctouni(clipper)
145 edje_edit_string_free(clipper)
146 return ret
147
148 def __set__(self, clipper):
149 if isinstance(clipper, unicode): clipper = clipper.encode("UTF-8")
150 edje_edit_part_clip_to_set(self.edje.obj,
151 <const_char *>self.name if self.name is not None else NULL,
152 <const_char *>clipper if clipper is not None else NULL)
153
154 def __del__(self):
155 edje_edit_part_clip_to_set(self.edje.obj,
156 <const_char *>self.name if self.name is not None else NULL,
157 NULL)
158
159 property source:
160 def __get__(self):
161 cdef const_char *source
162 source = edje_edit_part_source_get(self.edje.obj,
163 <const_char *>self.name if self.name is not None else NULL)
164 ret = _ctouni(source)
165 edje_edit_string_free(source)
166 return ret
167
168 def __set__(self, source):
169 if isinstance(source, unicode): source = source.encode("UTF-8")
170 edje_edit_part_source_set(self.edje.obj,
171 <const_char *>self.name if self.name is not None else NULL,
172 <const_char *>source if source is not None else NULL)
173
174 def __del__(self):
175 edje_edit_part_source_set(self.edje.obj,
176 <const_char *>self.name if self.name is not None else NULL,
177 NULL)
178
179 property mouse_events:
180 def __get__(self):
181 return bool(edje_edit_part_mouse_events_get(self.edje.obj,
182 <const_char *>self.name if self.name is not None else NULL))
183
184 def __set__(self, me):
185 edje_edit_part_mouse_events_set(self.edje.obj,
186 <const_char *>self.name if self.name is not None else NULL,
187 1 if me else 0)
188
189 property repeat_events:
190 def __get__(self):
191 return bool(edje_edit_part_repeat_events_get(self.edje.obj,
192 <const_char *>self.name if self.name is not None else NULL))
193
194 def __set__(self, re):
195 edje_edit_part_repeat_events_set(self.edje.obj,
196 <const_char *>self.name if self.name is not None else NULL,
197 1 if re else 0)
198
199 property effect:
200 def __get__(self):
201 return edje_edit_part_effect_get(self.edje.obj,
202 <const_char *>self.name if self.name is not None else NULL)
203
204 def __set__(self, effect):
205 edje_edit_part_effect_set(self.edje.obj,
206 <const_char *>self.name if self.name is not None else NULL,
207 effect)
208
209 property ignore_flags:
210 def __get__(self):
211 return edje_edit_part_ignore_flags_get(self.edje.obj,
212 <const_char *>self.name if self.name is not None else NULL)
213
214 def __set__(self, flags):
215 edje_edit_part_ignore_flags_set(self.edje.obj,
216 <const_char *>self.name if self.name is not None else NULL,
217 flags)
218
219 property scale:
220 def __get__(self):
221 return bool(edje_edit_part_scale_get(self.edje.obj,
222 <const_char *>self.name if self.name is not None else NULL))
223
224 def __set__(self, scale):
225 edje_edit_part_scale_set(self.edje.obj,
226 <const_char *>self.name if self.name is not None else NULL,
227 1 if scale else 0)
228
229 property drag:
230 def __get__(self):
231 cdef int x, y
232 x = edje_edit_part_drag_x_get(self.edje.obj,
233 <const_char *>self.name if self.name is not None else NULL)
234 y = edje_edit_part_drag_y_get(self.edje.obj,
235 <const_char *>self.name if self.name is not None else NULL)
236 return (x, y)
237
238 def __set__(self, val):
239 x, y = val
240 edje_edit_part_drag_x_set(self.edje.obj,
241 <const_char *>self.name if self.name is not None else NULL, x)
242 edje_edit_part_drag_y_set(self.edje.obj,
243 <const_char *>self.name if self.name is not None else NULL, y)
244
245 property drag_step:
246 def __get__(self):
247 cdef int x, y
248 x = edje_edit_part_drag_step_x_get(self.edje.obj,
249 <const_char *>self.name if self.name is not None else NULL)
250 y = edje_edit_part_drag_step_y_get(self.edje.obj,
251 <const_char *>self.name if self.name is not None else NULL)
252 return (x, y)
253
254 def __set__(self, val):
255 x, y = val
256 edje_edit_part_drag_step_x_set(self.edje.obj,
257 <const_char *>self.name if self.name is not None else NULL, x)
258 edje_edit_part_drag_step_y_set(self.edje.obj,
259 <const_char *>self.name if self.name is not None else NULL, y)
260
261 property drag_count:
262 def __get__(self):
263 cdef int x, y
264 x = edje_edit_part_drag_count_x_get(self.edje.obj,
265 <const_char *>self.name if self.name is not None else NULL)
266 y = edje_edit_part_drag_count_y_get(self.edje.obj,
267 <const_char *>self.name if self.name is not None else NULL)
268 return (x, y)
269
270 def __set__(self, val):
271 x, y = val
272 edje_edit_part_drag_count_x_set(self.edje.obj,
273 <const_char *>self.name if self.name is not None else NULL, x)
274 edje_edit_part_drag_count_y_set(self.edje.obj,
275 <const_char *>self.name if self.name is not None else NULL, y)
276
277 property drag_confine:
278 def __get__(self):
279 cdef const_char *confine
280 confine = edje_edit_part_drag_confine_get(self.edje.obj,
281 <const_char *>self.name if self.name is not None else NULL)
282 ret = _ctouni(confine)
283 edje_edit_string_free(confine)
284 return ret
285
286 def __set__(self, confine):
287 if isinstance(confine, unicode): confine = confine.encode("UTF-8")
288 edje_edit_part_drag_confine_set(self.edje.obj,
289 <const_char *>self.name if self.name is not None else NULL,
290 <const_char *>confine if confine is not None else NULL)
291
292 property drag_event:
293 def __get__(self):
294 cdef const_char *event
295 event = edje_edit_part_drag_event_get(self.edje.obj,
296 <const_char *>self.name if self.name is not None else NULL)
297 ret = _ctouni(event)
298 edje_edit_string_free(event)
299 return ret
300
301 def __set__(self, event):
302 if isinstance(event, unicode): event = event.encode("UTF-8")
303 edje_edit_part_drag_event_set(self.edje.obj,
304 <const_char *>self.name if self.name is not None else NULL,
305 <const_char *>event if event is not None else NULL)
306
307 property api:
308 def __get__(self):
309 cdef:
310 const_char *name
311 const_char *description
312 name = edje_edit_part_api_name_get(self.edje.obj,
313 <const_char *>self.name if self.name is not None else NULL)
314 description = edje_edit_part_api_description_get(self.edje.obj,
315 <const_char *>self.name if self.name is not None else NULL)
316 n, d = _ctouni(name), _ctouni(description)
317 edje_edit_string_free(name)
318 edje_edit_string_free(description)
319 return (n, d)
320
321 def __set__(self, value):
322 cdef object name, desc
323 name, desc = value
324 if isinstance(name, unicode): name = name.encode("UTF-8")
325 if isinstance(desc, unicode): desc = desc.encode("UTF-8")
326 edje_edit_part_api_name_set(self.edje.obj,
327 <const_char *>self.name if self.name is not None else NULL,
328 <const_char *>name if name is not None else NULL)
329 edje_edit_part_api_description_set(self.edje.obj,
330 <const_char *>self.name if self.name is not None else NULL,
331 <const_char *>desc if desc is not None else NULL)
diff --git a/efl/edje/efl.edje_edit_part_state.pxi b/efl/edje/efl.edje_edit_part_state.pxi
new file mode 100644
index 0000000..8c4b69d
--- /dev/null
+++ b/efl/edje/efl.edje_edit_part_state.pxi
@@ -0,0 +1,851 @@
1# Copyright (C) 2007-2013 various contributors (see AUTHORS)
2#
3# This file is part of Python-EFL.
4#
5# Python-EFL is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# Python-EFL is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17
18
19cdef class State:
20 cdef EdjeEdit edje
21 cdef object part
22 cdef object name
23 cdef object part_obj
24 cdef object value
25
26 def __init__(self, Part part, name, double value=0.0):
27 if isinstance(name, unicode): name = name.encode("UTF-8")
28 self.part_obj = part
29 self.edje = part.edje
30 self.part = part.name
31 self.name = name
32 self.value = value
33
34 property name:
35 def __get__(self):
36 return self.name
37
38 property value:
39 def __get__(self):
40 return self.value
41
42 def part_get(self):
43 return self.part_obj
44
45 def name_set(self, new_name, new_value=None):
46 if new_value == None:
47 new_value = self.value
48 return bool(edje_edit_state_name_set(self.edje.obj, self.part,
49 self.name, self.value, new_name,
50 new_value))
51 """
52 def copy_from(self, from_state, from_value=0.0):
53 return bool(edje_edit_state_copy(self.edje.obj, self.part,
54 from_state, from_value, self.name,
55 self.value))
56 """
57 def rel1_to_get(self):
58 cdef const_char *tx, *ty
59 tx = edje_edit_state_rel1_to_x_get(self.edje.obj, self.part, self.name,
60 self.value)
61 ty = edje_edit_state_rel1_to_y_get(self.edje.obj, self.part, self.name,
62 self.value)
63 if tx != NULL:
64 x = tx
65 edje_edit_string_free(tx)
66 else:
67 x = None
68
69 if ty != NULL:
70 y = ty
71 edje_edit_string_free(ty)
72 else:
73 y = None
74
75 return (x, y)
76 """
77 def rel1_to_set(self, x, y):
78 if x:
79 edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
80 self.value, x)
81 else:
82 edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
83 self.value, NULL)
84 if y:
85 edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
86 self.value, y)
87 else:
88 edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
89 self.value, NULL)
90 # remove when fixed in edje_edit
91 edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
92 self.value)
93
94 property rel1_to:
95 def __get__(self):
96 return self.rel1_to_get()
97 def __set__(self, rel1_to):
98 self.rel1_to_set(*rel1_to)
99
100 def rel1_to_x_set(self, x):
101 if x:
102 edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
103 self.value, x)
104 else:
105 edje_edit_state_rel1_to_x_set(self.edje.obj, self.part, self.name,
106 self.value, NULL)
107 # remove when fixed in edje_edit
108 edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
109 self.value)
110
111 def rel1_to_y_set(self, y):
112 if y:
113 edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
114 self.value, y)
115 else:
116 edje_edit_state_rel1_to_y_set(self.edje.obj, self.part, self.name,
117 self.value, NULL)
118 # remove when fixed in edje_edit
119 edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
120 self.value)
121
122 def rel1_relative_get(self):
123 cdef double x, y
124 x = edje_edit_state_rel1_relative_x_get(self.edje.obj, self.part,
125 self.name, self.value)
126 y = edje_edit_state_rel1_relative_y_get(self.edje.obj, self.part,
127 self.name, self.value)
128 return (x, y)
129
130 def rel1_relative_set(self, double x, double y):
131 edje_edit_state_rel1_relative_x_set(self.edje.obj, self.part, self.name,
132 self.value, x)
133 edje_edit_state_rel1_relative_y_set(self.edje.obj, self.part, self.name,
134 self.value, y)
135
136 property rel1_relative:
137 def __get__(self):
138 return self.rel1_relative_get()
139 def __set__(self, value):
140 self.rel1_relative_set(*value)
141
142 def rel1_relative_x_set(self, double x):
143 edje_edit_state_rel1_relative_x_set(self.edje.obj, self.part, self.name,
144 self.value, x)
145
146 def rel1_relative_y_set(self, double y):
147 edje_edit_state_rel1_relative_y_set(self.edje.obj, self.part, self.name,
148 self.value, y)
149
150 def rel1_offset_get(self):
151 cdef int x, y
152 x = edje_edit_state_rel1_offset_x_get(self.edje.obj, self.part,
153 self.name, self.value)
154 y = edje_edit_state_rel1_offset_y_get(self.edje.obj, self.part,
155 self.name, self.value)
156 return (x, y)
157
158 def rel1_offset_set(self, int x, int y):
159 edje_edit_state_rel1_offset_x_set(self.edje.obj, self.part, self.name,
160 self.value, x)
161 edje_edit_state_rel1_offset_y_set(self.edje.obj, self.part, self.name,
162 self.value, y)
163
164 property rel1_offset:
165 def __get__(self):
166 return self.rel1_offset_get()
167 def __set__(self, value):
168 self.rel1_offset_set(*value)
169
170 def rel1_offset_x_set(self, int x):
171 edje_edit_state_rel1_offset_x_set(self.edje.obj, self.part, self.name,
172 self.value, x)
173
174 def rel1_offset_y_set(self, int y):
175 edje_edit_state_rel1_offset_y_set(self.edje.obj, self.part, self.name,
176 self.value, y)
177
178 def rel2_to_get(self):
179 cdef const_char_ptr tx, ty
180 tx = edje_edit_state_rel2_to_x_get(self.edje.obj, self.part, self.name,
181 self.value)
182 ty = edje_edit_state_rel2_to_y_get(self.edje.obj, self.part, self.name,
183 self.value)
184 if tx != NULL:
185 x = tx
186 edje_edit_string_free(tx)
187 else:
188 x = None
189
190 if ty != NULL:
191 y = ty
192 edje_edit_string_free(ty)
193 else:
194 y = None
195
196 return (x, y)
197
198 def rel2_to_set(self, x, y):
199 if x:
200 edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
201 self.value, x)
202 else:
203 edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
204 self.value, NULL)
205 if y:
206 edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
207 self.value, y)
208 else:
209 edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
210 self.value, NULL)
211 # remove when fixed in edje_edit
212 edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
213 self.value)
214
215 property rel2_to:
216 def __get__(self):
217 return self.rel2_to_get()
218 def __set__(self, rel2_to):
219 self.rel2_to_set(*rel2_to)
220
221 def rel2_to_x_set(self, x):
222 if x:
223 edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
224 self.value, x)
225 else:
226 edje_edit_state_rel2_to_x_set(self.edje.obj, self.part, self.name,
227 self.value, NULL)
228 # remove when fixed in edje_edit
229 edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
230 self.value)
231 def rel2_to_y_set(self, y):
232 if y:
233 edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
234 self.value, y)
235 else:
236 edje_edit_state_rel2_to_y_set(self.edje.obj, self.part, self.name,
237 self.value, NULL)
238 # remove when fixed in edje_edit
239 edje_edit_part_selected_state_set(self.edje.obj, self.part, self.name,
240 self.value)
241
242 def rel2_relative_get(self):
243 cdef double x, y
244 x = edje_edit_state_rel2_relative_x_get(self.edje.obj, self.part,
245 self.name, self.value)
246 y = edje_edit_state_rel2_relative_y_get(self.edje.obj, self.part,
247 self.name, self.value)
248 return (x, y)
249
250 def rel2_relative_set(self, double x, double y):
251 edje_edit_state_rel2_relative_x_set(self.edje.obj, self.part, self.name,
252 self.value, x)
253 edje_edit_state_rel2_relative_y_set(self.edje.obj, self.part, self.name,
254 self.value, y)
255
256 property rel2_relative:
257 def __get__(self):
258 return self.rel2_relative_get()
259 def __set__(self, value):
260 self.rel2_relative_set(*value)
261
262 def rel2_relative_x_set(self, double x):
263 edje_edit_state_rel2_relative_x_set(self.edje.obj, self.part, self.name,
264 self.value, x)
265 def rel2_relative_y_set(self, double y):
266 edje_edit_state_rel2_relative_y_set(self.edje.obj, self.part, self.name,
267 self.value, y)
268
269 def rel2_offset_get(self):
270 cdef int x, y
271 x = edje_edit_state_rel2_offset_x_get(self.edje.obj, self.part,
272 self.name, self.value)
273 y = edje_edit_state_rel2_offset_y_get(self.edje.obj, self.part,
274 self.name, self.value)
275 return (x, y)
276
277 def rel2_offset_set(self, int x, int y):
278 edje_edit_state_rel2_offset_x_set(self.edje.obj, self.part, self.name,
279 self.value, x)
280 edje_edit_state_rel2_offset_y_set(self.edje.obj, self.part, self.name,
281 self.value, y)
282
283 property rel2_offset:
284 def __get__(self):
285 return self.rel2_offset_get()
286 def __set__(self, value):
287 self.rel2_offset_set(*value)
288
289 def rel2_offset_x_set(self, int x):
290 edje_edit_state_rel2_offset_x_set(self.edje.obj, self.part, self.name,
291 self.value, x)
292 def rel2_offset_y_set(self, int y):
293 edje_edit_state_rel2_offset_y_set(self.edje.obj, self.part, self.name,
294 self.value, y)
295
296 def color_get(self):
297 cdef int r, g, b, a
298 edje_edit_state_color_get(self.edje.obj, self.part, self.name,
299 self.value, &r, &g, &b, &a)
300 return (r, g, b, a)
301
302 def color_set(self, int r, int g, int b, int a):
303 edje_edit_state_color_set(self.edje.obj, self.part, self.name,
304 self.value, r, g, b, a)
305
306 property color:
307 def __get__(self):
308 return self.color_get()
309 def __set__(self, color):
310 self.color_set(*color)
311
312 def color2_get(self):
313 cdef int r, g, b, a
314 edje_edit_state_color2_get(self.edje.obj, self.part, self.name,
315 self.value, &r, &g, &b, &a)
316 return (r, g, b, a)
317
318 def color2_set(self, int r, int g, int b, int a):
319 edje_edit_state_color2_set(self.edje.obj, self.part, self.name,
320 self.value, r, g, b, a)
321
322 property color2:
323 def __get__(self):
324 return self.color2_get()
325 def __set__(self, color):
326 self.color2_set(*color)
327
328 def color3_get(self):
329 cdef int r, g, b, a
330 edje_edit_state_color3_get(self.edje.obj, self.part, self.name,
331 self.value, &r, &g, &b, &a)
332 return (r, g, b, a)
333
334 def color3_set(self, int r, int g, int b, int a):
335 edje_edit_state_color3_set(self.edje.obj, self.part, self.name,
336 self.value, r, g, b, a)
337
338 property color3:
339 def __get__(self):
340 return self.color3_get()
341 def __set__(self, color):
342 self.color3_set(*color)
343
344 def align_get(self):
345 cdef double x, y
346 x = edje_edit_state_align_x_get(self.edje.obj, self.part, self.name,
347 self.value)
348 y = edje_edit_state_align_y_get(self.edje.obj, self.part, self.name,
349 self.value)
350 return (x, y)
351
352 def align_set(self, double x, double y):
353 edje_edit_state_align_x_set(self.edje.obj, self.part, self.name,
354 self.value, x)
355 edje_edit_state_align_y_set(self.edje.obj, self.part, self.name,
356 self.value, y)
357
358 property align:
359 def __get__(self):
360 return self.align_get()
361 def __set__(self, align):
362 self.align_set(*align)
363
364 def min_get(self):
365 cdef int w, h
366 w = edje_edit_state_min_w_get(self.edje.obj, self.part, self.name,
367 self.value)
368 h = edje_edit_state_min_h_get(self.edje.obj, self.part, self.name,
369 self.value)
370 return (w, h)
371
372 def min_set(self, int w, int h):
373 edje_edit_state_min_w_set(self.edje.obj, self.part, self.name,
374 self.value, w)
375 edje_edit_state_min_h_set(self.edje.obj, self.part, self.name,
376 self.value, h)
377
378 property min:
379 def __get__(self):
380 return self.min_get()
381 def __set__(self, min):
382 self.min_set(*min)
383
384 def max_get(self):
385 cdef int w, h
386 w = edje_edit_state_max_w_get(self.edje.obj, self.part, self.name,
387 self.value)
388 h = edje_edit_state_max_h_get(self.edje.obj, self.part, self.name,
389 self.value)
390 return (w, h)
391
392 def max_set(self, int w, int h):
393 edje_edit_state_max_w_set(self.edje.obj, self.part, self.name,
394 self.value, w)
395 edje_edit_state_max_h_set(self.edje.obj, self.part, self.name,
396 self.value, h)
397
398 property max:
399 def __get__(self):
400 return self.max_get()
401 def __set__(self, max):
402 self.max_set(*max)
403
404 def aspect_min_get(self):
405 return edje_edit_state_aspect_min_get(self.edje.obj, self.part,
406 self.name, self.value)
407
408 def aspect_min_set(self, double a):
409 edje_edit_state_aspect_min_set(self.edje.obj, self.part, self.name,
410 self.value, a)
411
412 def aspect_max_get(self):
413 return edje_edit_state_aspect_max_get(self.edje.obj, self.part,
414 self.name, self.value)
415
416 def aspect_max_set(self, double a):
417 edje_edit_state_aspect_max_set(self.edje.obj, self.part, self.name,
418 self.value, a)
419
420 def aspect_pref_get(self):
421 return edje_edit_state_aspect_pref_get(self.edje.obj, self.part,
422 self.name, self.value)
423
424 def aspect_pref_set(self, char a):
425 edje_edit_state_aspect_pref_set(self.edje.obj, self.part, self.name,
426 self.value, a)
427
428 def fill_origin_relative_get(self):
429 cdef double x, y
430 x = edje_edit_state_fill_origin_relative_x_get(self.edje.obj, self.part,
431 self.name, self.value)
432 y = edje_edit_state_fill_origin_relative_y_get(self.edje.obj, self.part,
433 self.name, self.value)
434 return (x, y)
435
436 def fill_origin_relative_set(self, double x, double y):
437 edje_edit_state_fill_origin_relative_x_set(self.edje.obj, self.part,
438 self.name, self.value, x)
439 edje_edit_state_fill_origin_relative_y_set(self.edje.obj, self.part,
440 self.name, self.value, y)
441
442 def fill_origin_offset_get(self):
443 cdef int x, y
444 x = edje_edit_state_fill_origin_offset_x_get(self.edje.obj, self.part,
445 self.name, self.value)
446 y = edje_edit_state_fill_origin_offset_y_get(self.edje.obj, self.part,
447 self.name, self.value)
448 return (x, y)
449
450 def fill_origin_offset_set(self, x, y):
451 edje_edit_state_fill_origin_offset_x_set(self.edje.obj, self.part,
452 self.name, self.value, x)
453 edje_edit_state_fill_origin_offset_y_set(self.edje.obj, self.part,
454 self.name, self.value, y)
455
456 def fill_size_relative_get(self):
457 cdef double x, y
458 x = edje_edit_state_fill_size_relative_x_get(self.edje.obj, self.part,
459 self.name, self.value)
460 y = edje_edit_state_fill_size_relative_y_get(self.edje.obj, self.part,
461 self.name, self.value)
462 return (x, y)
463
464 def fill_size_relative_set(self, double x, double y):
465 edje_edit_state_fill_size_relative_x_set(self.edje.obj, self.part,
466 self.name, self.value, x)
467 edje_edit_state_fill_size_relative_y_set(self.edje.obj, self.part,
468 self.name, self.value, y)
469
470 def fill_size_offset_get(self):
471 cdef int x, y
472 x = edje_edit_state_fill_size_offset_x_get(self.edje.obj, self.part,
473 self.name, self.value)
474 y = edje_edit_state_fill_size_offset_y_get(self.edje.obj, self.part,
475 self.name, self.value)
476 return (x, y)
477
478 def fill_size_offset_set(self, x, y):
479 edje_edit_state_fill_size_offset_x_set(self.edje.obj, self.part,
480 self.name, self.value, x)
481 edje_edit_state_fill_size_offset_y_set(self.edje.obj, self.part,
482 self.name, self.value, y)
483
484 property visible:
485 def __get__(self):
486 return bool(edje_edit_state_visible_get(self.edje.obj, self.part,
487 self.name, self.value))
488 def __set__(self, v):
489 if v:
490 edje_edit_state_visible_set(self.edje.obj, self.part, self.name,
491 self.value, 1)
492 else:
493 edje_edit_state_visible_set(self.edje.obj, self.part, self.name, self.value, 0)
494
495 def color_class_get(self):
496 cdef const_char_ptr cc
497 cc = edje_edit_state_color_class_get(self.edje.obj, self.part,
498 self.name, self.value)
499 if cc == NULL:
500 return None
501 rcc = cc
502 edje_edit_string_free(cc)
503 return rcc
504
505 def color_class_set(self, cc):
506 if not cc:
507 edje_edit_state_color_class_set(self.edje.obj, self.part,
508 self.name, self.value, NULL)
509 else:
510 edje_edit_state_color_class_set(self.edje.obj, self.part,
511 self.name, self.value, cc)
512
513 def external_params_get(self):
514 cdef evas.c_evas.const_Eina_List *lst
515 ret = []
516 lst = edje_edit_state_external_params_list_get(self.edje.obj, self.part,
517 self.name, self.value)
518 while lst:
519 p = c_edje._ExternalParam_from_ptr(<long>lst.data)
520 if p is not None:
521 ret.append(p)
522 lst = lst.next
523 return ret
524
525 def external_param_get(self, param):
526 cdef c_edje.Edje_External_Param_Type type
527 cdef void *value
528 cdef const_char_ptr s
529
530 if not edje_edit_state_external_param_get(self.edje.obj, self.part,
531 self.name, self.value, param,
532 &type, &value):
533 return None
534 if type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_BOOL:
535 b = (<evas.c_evas.Eina_Bool *>value)[0]
536 return (type, bool(b))
537 elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_INT:
538 i = (<int *>value)[0]
539 return (type, i)
540 elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
541 d = (<double *>value)[0]
542 return (type, d)
543 elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_STRING:
544 s = <char *>value
545 if s == NULL:
546 return (type, None)
547 else:
548 return (type, s)
549 elif type == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
550 s = <char *>value
551 if s == NULL:
552 return (type, None)
553 else:
554 return (type, s)
555 return None
556
557 def external_param_set(self, param, value):
558 cdef const_char_ptr expected
559
560 if isinstance(value, bool):
561 return self.external_param_bool_set(param, value)
562 elif isinstance(value, (long, int)):
563 return self.external_param_int_set(param, value)
564 elif isinstance(value, float):
565 return self.external_param_double_set(param, value)
566 elif isinstance(value, str):
567 t = edje_object_part_external_param_type_get(
568 self.edje.obj, self.part, param)
569 if t == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_STRING:
570 return self.external_param_string_set(param, value)
571 elif t == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
572 return self.external_param_choice_set(param, value)
573
574 t = edje_object_part_external_param_type_get(
575 self.edje.obj, self.part, param)
576 if t >= edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_MAX:
577 raise TypeError("no external parameter %s" % (param,))
578 else:
579 expected = edje_external_param_type_str(t)
580 raise TypeError(
581 "invalid external parameter %s of (%s), expected %s" %
582 (param, type(value).__name__, expected))
583
584 def external_param_int_get(self, param):
585 cdef int value
586
587 if not edje_edit_state_external_param_int_get(self.edje.obj, self.part,
588 self.name, self.value,
589 param, &value):
590 return None
591 return value
592
593 def external_param_bool_get(self, param):
594 cdef evas.c_evas.Eina_Bool value
595
596 if not edje_edit_state_external_param_bool_get(
597 self.edje.obj, self.part, self.name, self.value, param, &value):
598 return None
599 return bool(value)
600
601 def external_param_double_get(self, param):
602 cdef double value
603
604 if not edje_edit_state_external_param_double_get(self.edje.obj, self.part,
605 self.name, self.value,
606 param, &value):
607 return None
608 return value
609
610 def external_param_string_get(self, param):
611 cdef const_char_ptr value
612
613 if not edje_edit_state_external_param_string_get(
614 self.edje.obj, self.part, self.name, self.value, param, &value):
615 return None
616 if value != NULL:
617 return value
618
619 def external_param_choice_get(self, param):
620 cdef const_char_ptr value
621
622 if not edje_edit_state_external_param_choice_get(
623 self.edje.obj, self.part, self.name, self.value, param, &value):
624 return None
625 if value != NULL:
626 return value
627
628 def external_param_int_set(self, param, value):
629 return bool(edje_edit_state_external_param_int_set(self.edje.obj,
630 self.part, self.name,
631 self.value, param,
632 value))
633
634 def external_param_bool_set(self, param, value):
635 return bool(edje_edit_state_external_param_bool_set(
636 self.edje.obj, self.part, self.name, self.value, param, value))
637
638 def external_param_double_set(self, param, value):
639 return bool(edje_edit_state_external_param_double_set(self.edje.obj,
640 self.part, self.name,
641 self.value,param,
642 value))
643
644 def external_param_string_set(self, param, value):
645 return bool(edje_edit_state_external_param_string_set(self.edje.obj,
646 self.part, self.name,
647 self.value, param,
648 value))
649
650 def external_param_choice_set(self, param, value):
651 return bool(edje_edit_state_external_param_choice_set(
652 self.edje.obj, self.part, self.name, self.value, param, value))
653
654 def text_get(self):
655 cdef const_char_ptr t
656 t = edje_edit_state_text_get(self.edje.obj, self.part, self.name,
657 self.value)
658 if t == NULL:
659 return None
660 r = t
661 edje_edit_string_free(t)
662 return r
663
664 def text_set(self, t):
665 edje_edit_state_text_set(self.edje.obj, self.part, self.name,
666 self.value, t)
667
668 property text:
669 def __get__(self):
670 return self.text_get()
671 def __set__(self, text):
672 self.text_set(text)
673
674 def font_get(self):
675 cdef const_char_ptr f
676 f = edje_edit_state_font_get(self.edje.obj, self.part, self.name,
677 self.value)
678 if f == NULL:
679 return None
680 r = f
681 edje_edit_string_free(f)
682 return r
683
684 def font_set(self, char *f):
685 edje_edit_state_font_set(self.edje.obj, self.part, self.name,
686 self.value, f)
687
688 property font:
689 def __get__(self):
690 return self.font_get()
691 def __set__(self, font):
692 self.font_set(font)
693
694 def text_size_get(self):
695 return edje_edit_state_text_size_get(self.edje.obj, self.part,
696 self.name, self.value)
697
698 def text_size_set(self, int s):
699 edje_edit_state_text_size_set(self.edje.obj, self.part, self.name,
700 self.value, s)
701
702 property text_size:
703 def __get__(self):
704 return self.text_size_get()
705 def __set__(self, value):
706 self.text_size_set(value)
707
708 def text_align_get(self):
709 cdef double x, y
710 x = edje_edit_state_text_align_x_get(self.edje.obj, self.part,
711 self.name, self.value)
712 y = edje_edit_state_text_align_y_get(self.edje.obj, self.part,
713 self.name, self.value)
714 return (x, y)
715
716 def text_align_set(self, double x, double y):
717 edje_edit_state_text_align_x_set(self.edje.obj, self.part, self.name,
718 self.value, x)
719 edje_edit_state_text_align_y_set(self.edje.obj, self.part, self.name,
720 self.value, y)
721
722 property text_align:
723 def __get__(self):
724 return self.text_align_get()
725 def __set__(self, align):
726 self.text_align_set(*align)
727
728 def text_elipsis_get(self):
729 return edje_edit_state_text_elipsis_get(self.edje.obj, self.part,
730 self.name, self.value)
731
732 def text_elipsis_set(self, double e):
733 edje_edit_state_text_elipsis_set(self.edje.obj, self.part, self.name,
734 self.value, e)
735
736 property text_elipsis:
737 def __get__(self):
738 return self.text_elipsis_get()
739 def __set__(self, value):
740 self.text_elipsis_set(value)
741
742 def text_fit_get(self):
743 x = bool(edje_edit_state_text_fit_x_get(self.edje.obj, self.part,
744 self.name, self.value))
745 y = bool(edje_edit_state_text_fit_y_get(self.edje.obj, self.part,
746 self.name, self.value))
747 return (x, y)
748
749 def text_fit_set(self, x, y):
750 if x:
751 edje_edit_state_text_fit_x_set(self.edje.obj, self.part, self.name,
752 self.value, 1)
753 else:
754 edje_edit_state_text_fit_x_set(self.edje.obj, self.part, self.name,
755 self.value, 0)
756 if y:
757 edje_edit_state_text_fit_y_set(self.edje.obj, self.part, self.name,
758 self.value, 1)
759 else:
760 edje_edit_state_text_fit_y_set(self.edje.obj, self.part, self.name,
761 self.value, 0)
762
763 property text_fit:
764 def __get__(self):
765 return self.text_fit_get()
766 def __set__(self, value):
767 self.text_fit_set(*value)
768
769 def image_get(self):
770 cdef const_char_ptr img
771 img = edje_edit_state_image_get(self.edje.obj, self.part, self.name,
772 self.value)
773 if img == NULL:
774 return None
775 r = img
776 edje_edit_string_free(img)
777 return r
778
779 def image_set(self, char *image):
780 if not image:
781 return
782
783 edje_edit_state_image_set(self.edje.obj, self.part, self.name,
784 self.value, image)
785
786 property image:
787 def __get__(self):
788 return self.image_get()
789 def __set__(self, image):
790 self.image_set(image)
791
792 def image_border_get(self):
793 cdef int l, r, t, b
794 edje_edit_state_image_border_get(self.edje.obj, self.part, self.name,
795 self.value, &l, &r, &t, &b)
796 return (l, r, t, b)
797
798 def image_border_set(self, int l, int r, int t, int b):
799 edje_edit_state_image_border_set(self.edje.obj, self.part, self.name,
800 self.value, l, r, t, b)
801
802 property image_border:
803 def __get__(self):
804 return self.image_border_get()
805 def __set__(self, value):
806 self.image_border_set(*value)
807
808 def image_border_fill_get(self):
809 cdef unsigned char r
810 r = edje_edit_state_image_border_fill_get(self.edje.obj, self.part,
811 self.name, self.value)
812 if r == 0:
813 return False
814 return True
815
816 def image_border_fill_set(self, fill):
817 if fill:
818 edje_edit_state_image_border_fill_set(self.edje.obj, self.part,
819 self.name, self.value, 1)
820 else:
821 edje_edit_state_image_border_fill_set(self.edje.obj, self.part,
822 self.name, self.value, 0)
823
824 property image_border_fill:
825 def __get__(self):
826 return self.image_border_fill_get()
827 def __set__(self, value):
828 self.image_border_fill_set(value)
829
830 property tweens:
831 def __get__(self):
832 "@rtype: list of str"
833 cdef evas.c_evas.Eina_List *lst, *itr
834 ret = []
835 lst = edje_edit_state_tweens_list_get(self.edje.obj, self.part,
836 self.name, self.value)
837 itr = lst
838 while itr:
839 ret.append(<char*>itr.data)
840 itr = itr.next
841 edje_edit_string_list_free(lst)
842 return ret
843
844 def tween_add(self, char *img):
845 return bool(edje_edit_state_tween_add(self.edje.obj, self.part,
846 self.name, self.value, img))
847
848 def tween_del(self, char *img):
849 return bool(edje_edit_state_tween_del(self.edje.obj, self.part,
850 self.name, self.value, img))
851 """
diff --git a/efl/edje/efl.edje_edit_program.pxi b/efl/edje/efl.edje_edit_program.pxi
new file mode 100644
index 0000000..acca7e4
--- /dev/null
+++ b/efl/edje/efl.edje_edit_program.pxi
@@ -0,0 +1,260 @@
1# Copyright (C) 2007-2013 various contributors (see AUTHORS)
2#
3# This file is part of Python-EFL.
4#
5# Python-EFL is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# Python-EFL is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17
18
19cdef class Program(object):
20 cdef EdjeEdit edje
21 cdef object name
22
23 def __init__(self, EdjeEdit e, name):
24 if isinstance(name, unicode): name = name.encode("UTF-8")
25 self.edje = e
26 self.name = name
27
28 property name:
29 def __get__(self):
30 return self.name.decode('UTF-8', 'strict')
31
32 def __set__(self, newname):
33 self.rename(newname)
34
35 def rename(self, newname):
36 cdef Eina_Bool ret
37 if isinstance(newname, unicode): newname = newname.encode("UTF-8")
38 ret = edje_edit_program_name_set(self.edje.obj,
39 <const_char *>self.name if self.name is not None else NULL,
40 <const_char *>newname if newname is not None else NULL)
41 if ret == 0:
42 return False
43 self.name = newname
44 return True
45
46 def edje_get(self):
47 return self.edje
48
49 def run(self):
50 return bool(edje_edit_program_run(self.edje.obj,
51 <const_char *>self.name if self.name is not None else NULL))
52
53 # XXX TODO: add (or better convert) all this to properties
54 # like is done in Part()
55 def source_get(self):
56 cdef const_char *s
57 s = edje_edit_program_source_get(self.edje.obj,
58 <const_char *>self.name if self.name is not None else NULL)
59 ret = _ctouni(s)
60 edje_edit_string_free(s)
61 return ret
62
63 def source_set(self, source):
64 if isinstance(source, unicode): source = source.encode("UTF-8")
65 return bool(edje_edit_program_source_set(self.edje.obj,
66 <const_char *>self.name if self.name is not None else NULL,
67 <const_char *>source if source is not None else NULL))
68
69 def signal_get(self):
70 cdef const_char *s
71 s = edje_edit_program_signal_get(self.edje.obj,
72 <const_char *>self.name if self.name is not None else NULL)
73 ret = _ctouni(s)
74 edje_edit_string_free(s)
75 return ret
76
77 def signal_set(self, signal):
78 if isinstance(signal, unicode): signal = signal.encode("UTF-8")
79 return bool(edje_edit_program_signal_set(self.edje.obj,
80 <const_char *>self.name if self.name is not None else NULL,
81 <const_char *>signal if signal is not None else NULL))
82
83 def in_from_get(self):
84 return edje_edit_program_in_from_get(self.edje.obj,
85 <const_char *>self.name if self.name is not None else NULL)
86
87 def in_from_set(self, double f):
88 return bool(edje_edit_program_in_from_set(self.edje.obj,
89 <const_char *>self.name if self.name is not None else NULL, f))
90
91 def in_range_get(self):
92 return edje_edit_program_in_range_get(self.edje.obj,
93 <const_char *>self.name if self.name is not None else NULL)
94
95 def in_range_set(self, double r):
96 return bool(edje_edit_program_in_range_set(self.edje.obj,
97 <const_char *>self.name if self.name is not None else NULL, r))
98
99 def action_get(self):
100 return edje_edit_program_action_get(self.edje.obj,
101 <const_char *>self.name if self.name is not None else NULL)
102
103 def action_set(self, action):
104 if isinstance(action, unicode): action = action.encode("UTF-8")
105 return bool(edje_edit_program_action_set(self.edje.obj,
106 <const_char *>self.name if self.name is not None else NULL,
107 action))
108
109 def targets_get(self):
110 cdef Eina_List *lst
111 lst = edje_edit_program_targets_get(self.edje.obj,
112 <const_char *>self.name if self.name is not None else NULL)
113 ret = convert_eina_list_strings_to_python_list(lst)
114 edje_edit_string_list_free(lst)
115 return ret
116
117 def target_add(self, target):
118 if isinstance(target, unicode): target = target.encode("UTF-8")
119 return bool(edje_edit_program_target_add(self.edje.obj,
120 <const_char *>self.name if self.name is not None else NULL,
121 <const_char *>target if target is not None else NULL))
122
123 def target_del(self, target):
124 if isinstance(target, unicode): target = target.encode("UTF-8")
125 return bool(edje_edit_program_target_del(self.edje.obj,
126 <const_char *>self.name if self.name is not None else NULL,
127 <const_char *>target if target is not None else NULL))
128
129 def targets_clear(self):
130 return bool(edje_edit_program_targets_clear(self.edje.obj,
131 <const_char *>self.name if self.name is not None else NULL))
132
133 def afters_get(self):
134 cdef Eina_List *lst
135 lst = edje_edit_program_afters_get(self.edje.obj, self.name)
136 ret = convert_eina_list_strings_to_python_list(lst)
137 edje_edit_string_list_free(lst)
138 return ret
139
140 def after_add(self, after):
141 if isinstance(after, unicode): after = after.encode("UTF-8")
142 return bool(edje_edit_program_after_add(self.edje.obj,
143 <const_char *>self.name if self.name is not None else NULL,
144 <const_char *>after if after is not None else NULL))
145
146 def after_del(self, after):
147 if isinstance(after, unicode): after = after.encode("UTF-8")
148 return bool(edje_edit_program_after_del(self.edje.obj,
149 <const_char *>self.name if self.name is not None else NULL,
150 <const_char *>after if after is not None else NULL))
151
152 def afters_clear(self):
153 return bool(edje_edit_program_afters_clear(self.edje.obj,
154 <const_char *>self.name if self.name is not None else NULL))
155
156 def state_get(self):
157 cdef const_char *s
158 s = edje_edit_program_state_get(self.edje.obj,
159 <const_char *>self.name if self.name is not None else NULL)
160 ret = _ctouni(s)
161 edje_edit_string_free(s)
162 return ret
163
164 def state_set(self, state):
165 if isinstance(state, unicode): state = state.encode("UTF-8")
166 return bool(edje_edit_program_state_set(self.edje.obj,
167 <const_char *>self.name if self.name is not None else NULL,
168 <const_char *>state if state is not None else NULL))
169
170 def value_get(self):
171 return edje_edit_program_value_get(self.edje.obj,
172 <const_char *>self.name if self.name is not None else NULL)
173
174 def value_set(self, double v):
175 return bool(edje_edit_program_value_set(self.edje.obj,
176 <const_char *>self.name if self.name is not None else NULL, v))
177
178 def state2_get(self):
179 cdef const_char *s
180 s = edje_edit_program_state2_get(self.edje.obj,
181 <const_char *>self.name if self.name is not None else NULL)
182 ret = _ctouni(s)
183 edje_edit_string_free(s)
184 return ret
185
186 def state2_set(self, state):
187 if isinstance(state, unicode): state = state.encode("UTF-8")
188 return bool(edje_edit_program_state2_set(self.edje.obj,
189 <const_char *>self.name if self.name is not None else NULL,
190 <const_char *>state if state is not None else NULL))
191
192 def value2_get(self):
193 return edje_edit_program_value2_get(self.edje.obj,
194 <const_char *>self.name if self.name is not None else NULL)
195
196 def value2_set(self, double v):
197 return bool(edje_edit_program_value2_set(self.edje.obj,
198 <const_char *>self.name if self.name is not None else NULL, v))
199
200 def transition_get(self):
201 return edje_edit_program_transition_get(self.edje.obj,
202 <const_char *>self.name if self.name is not None else NULL)
203
204 def transition_set(self, t):
205 return bool(edje_edit_program_transition_set(self.edje.obj,
206 <const_char *>self.name if self.name is not None else NULL, t))
207
208 def transition_time_get(self):
209 return edje_edit_program_transition_time_get(self.edje.obj,
210 <const_char *>self.name if self.name is not None else NULL)
211
212 def transition_time_set(self, double t):
213 return bool(edje_edit_program_transition_time_set(self.edje.obj,
214 <const_char *>self.name if self.name is not None else NULL, t))
215
216 property api:
217 def __get__(self):
218 cdef:
219 const_char *name
220 const_char *desc
221 name = edje_edit_program_api_name_get(self.edje.obj,
222 <const_char *>self.name if self.name is not None else NULL)
223 desc = edje_edit_program_api_description_get(self.edje.obj,
224 <const_char *>self.name if self.name is not None else NULL)
225 n, d = _ctouni(name), _ctouni(desc)
226 edje_edit_string_free(name)
227 edje_edit_string_free(desc)
228 return (n, d)
229
230 def __set__(self, value):
231 cdef object name, desc
232 name, desc = value
233 if isinstance(name, unicode): name = name.encode("UTF-8")
234 if isinstance(desc, unicode): desc = desc.encode("UTF-8")
235 edje_edit_program_api_name_set(self.edje.obj,
236 <const_char *>self.name if self.name is not None else NULL,
237 <const_char *>name if name is not None else NULL)
238 edje_edit_program_api_description_set(self.edje.obj,
239 <const_char *>self.name if self.name is not None else NULL,
240 <const_char *>desc if desc is not None else NULL)
241
242 property script:
243 def __get__(self):
244 cdef char *code
245 code = edje_edit_script_program_get(self.edje.obj,
246 <const_char *>self.name if self.name is not None else NULL)
247 ret = _touni(code)
248 free(code)
249 return ret
250
251 def __set__(self, code):
252 if isinstance(code, unicode): code = code.encode("UTF-8")
253 edje_edit_script_program_set(self.edje.obj,
254 <const_char *>self.name if self.name is not None else NULL,
255 <const_char *>code if code is not None else NULL)
256
257 def __del__(self):
258 edje_edit_script_program_set(self.edje.obj,
259 <const_char *>self.name if self.name is not None else NULL, NULL)
260