summaryrefslogtreecommitdiff
path: root/efl/edje/efl.edje_object.pxi
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2013-04-02 11:42:26 +0200
committerdavemds <dave@gurumeditation.it>2013-04-02 11:42:26 +0200
commitd4d58b990bcccf446301dcb2171a2161f1918a10 (patch)
treed3ca3d6d0a5a5f587de2e418186efcfc307949bb /efl/edje/efl.edje_object.pxi
parent847f36086741f91b3cbff4f4152421045e090312 (diff)
Python-EFL: edje, remove all the fruni/cfruni usage
Diffstat (limited to '')
-rw-r--r--efl/edje/efl.edje_object.pxi245
1 files changed, 177 insertions, 68 deletions
diff --git a/efl/edje/efl.edje_object.pxi b/efl/edje/efl.edje_object.pxi
index 1706435..f80fc8f 100644
--- a/efl/edje/efl.edje_object.pxi
+++ b/efl/edje/efl.edje_object.pxi
@@ -192,7 +192,9 @@ cdef class Edje(Object):
192 *data* section inside the *group* that defines this object. 192 *data* section inside the *group* that defines this object.
193 193
194 """ 194 """
195 return _ctouni(edje_object_data_get(self.obj, _cfruni(key))) 195 if isinstance(key, unicode): key = key.encode("UTF-8")
196 return _ctouni(edje_object_data_get(self.obj,
197 <const_char *>key if key is not None else NULL))
196 198
197 def file_set(self, file, group): 199 def file_set(self, file, group):
198 """Set the file (.edj) and the group to load the Edje object from. 200 """Set the file (.edj) and the group to load the Edje object from.
@@ -203,9 +205,12 @@ cdef class Edje(Object):
203 :raise EdjeLoadError: if error occurred during load. 205 :raise EdjeLoadError: if error occurred during load.
204 206
205 """ 207 """
206 if edje_object_file_set(self.obj, _cfruni(file), _cfruni(group)) == 0: 208 if isinstance(file, unicode): file = file.encode("UTF-8")
207 raise EdjeLoadError(edje_object_load_error_get(self.obj), 209 if isinstance(group, unicode): group = group.encode("UTF-8")
208 _cfruni(file), _cfruni(group)) 210 if edje_object_file_set(self.obj,
211 <const_char *>file if file is not None else NULL,
212 <const_char *>group if group is not None else NULL) == 0:
213 raise EdjeLoadError(edje_object_load_error_get(self.obj), file, group)
209 214
210 def file_get(self): 215 def file_get(self):
211 """Get the file and group used to load the object. 216 """Get the file and group used to load the object.
@@ -291,10 +296,11 @@ cdef class Edje(Object):
291 :parm a3: 296 :parm a3:
292 297
293 """ 298 """
294 edje_object_color_class_set(self.obj, _cfruni(color_class), 299 if isinstance(color_class, unicode):
295 r, g, b, a, 300 color_class = color_class.encode("UTF-8")
296 r2, g2, b2, a2, 301 edje_object_color_class_set(self.obj,
297 r3, g3, b3, a3) 302 <const_char *>color_class if color_class is not None else NULL,
303 r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
298 304
299 def color_class_get(self, color_class): 305 def color_class_get(self, color_class):
300 """Get a specific color class. 306 """Get a specific color class.
@@ -307,15 +313,19 @@ cdef class Edje(Object):
307 cdef int r, g, b, a 313 cdef int r, g, b, a
308 cdef int r2, g2, b2, a2 314 cdef int r2, g2, b2, a2
309 cdef int r3, g3, b3, a3 315 cdef int r3, g3, b3, a3
310 edje_object_color_class_get(self.obj, _cfruni(color_class), 316 if isinstance(color_class, unicode):
311 &r, &g, &b, &a, 317 color_class = color_class.encode("UTF-8")
312 &r2, &g2, &b2, &a2, 318 edje_object_color_class_get(self.obj,
313 &r3, &g3, &b3, &a3) 319 <const_char *>color_class if color_class is not None else NULL,
320 &r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)
314 return (r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3) 321 return (r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
315 322
316 def color_class_del(self, color_class): 323 def color_class_del(self, color_class):
317 "Delete a specific color class." 324 "Delete a specific color class."
318 edje_object_color_class_del(self.obj, _cfruni(color_class)) 325 if isinstance(color_class, unicode):
326 color_class = color_class.encode("UTF-8")
327 edje_object_color_class_del(self.obj,
328 <const_char *>color_class if color_class is not None else NULL)
319 329
320 def text_class_set(self, text_class, font, int size): 330 def text_class_set(self, text_class, font, int size):
321 """Set text class. 331 """Set text class.
@@ -324,8 +334,14 @@ cdef class Edje(Object):
324 :param font: the font name 334 :param font: the font name
325 :param size: the font size 335 :param size: the font size
326 """ 336 """
327 edje_object_text_class_set(self.obj, _cfruni(text_class), 337 if isinstance(text_class, unicode):
328 _cfruni(font), size) 338 text_class = text_class.encode("UTF-8")
339 if isinstance(font, unicode):
340 font = font.encode("UTF-8")
341 edje_object_text_class_set(self.obj,
342 <const_char *>text_class if text_class is not None else NULL,
343 <const_char *>font if font is not None else NULL,
344 size)
329 345
330 def size_min_get(self): 346 def size_min_get(self):
331 ":rtype: tuple of int" 347 ":rtype: tuple of int"
@@ -364,7 +380,9 @@ cdef class Edje(Object):
364 380
365 def part_exists(self, part): 381 def part_exists(self, part):
366 ":rtype: bool" 382 ":rtype: bool"
367 return bool(edje_object_part_exists(self.obj, _cfruni(part))) 383 if isinstance(part, unicode): part = part.encode("UTF-8")
384 return bool(edje_object_part_exists(self.obj,
385 <const_char *>part if part is not None else NULL))
368 386
369 def part_object_get(self, part): 387 def part_object_get(self, part):
370 """ 388 """
@@ -378,25 +396,36 @@ cdef class Edje(Object):
378 396
379 """ 397 """
380 cdef Evas_Object *obj 398 cdef Evas_Object *obj
381 obj = <Evas_Object*>edje_object_part_object_get(self.obj, _cfruni(part)) 399 if isinstance(part, unicode): part = part.encode("UTF-8")
400 obj = <Evas_Object*>edje_object_part_object_get(self.obj,
401 <const_char *>part if part is not None else NULL)
382 return object_from_instance(obj) 402 return object_from_instance(obj)
383 403
384 def part_geometry_get(self, part): 404 def part_geometry_get(self, part):
385 ":rtype: tuple of int" 405 ":rtype: tuple of int"
386 cdef int x, y, w, h 406 cdef int x, y, w, h
387 edje_object_part_geometry_get(self.obj, _cfruni(part), &x, &y, &w, &h) 407 if isinstance(part, unicode): part = part.encode("UTF-8")
408 edje_object_part_geometry_get(self.obj,
409 <const_char *>part if part is not None else NULL,
410 &x, &y, &w, &h)
388 return (x, y, w, h) 411 return (x, y, w, h)
389 412
390 def part_size_get(self, part): 413 def part_size_get(self, part):
391 ":rtype: tuple of int" 414 ":rtype: tuple of int"
392 cdef int w, h 415 cdef int w, h
393 edje_object_part_geometry_get(self.obj, _cfruni(part), NULL, NULL, &w, &h) 416 if isinstance(part, unicode): part = part.encode("UTF-8")
417 edje_object_part_geometry_get(self.obj,
418 <const_char *>part if part is not None else NULL,
419 NULL, NULL, &w, &h)
394 return (w, h) 420 return (w, h)
395 421
396 def part_pos_get(self, part): 422 def part_pos_get(self, part):
397 ":rtype: tuple of int" 423 ":rtype: tuple of int"
398 cdef int x, y 424 cdef int x, y
399 edje_object_part_geometry_get(self.obj, _cfruni(part), &x, &y, NULL, NULL) 425 if isinstance(part, unicode): part = part.encode("UTF-8")
426 edje_object_part_geometry_get(self.obj,
427 <const_char *>part if part is not None else NULL,
428 &x, &y, NULL, NULL)
400 return (x, y) 429 return (x, y)
401 430
402 def text_change_cb_set(self, func, *args, **kargs): 431 def text_change_cb_set(self, func, *args, **kargs):
@@ -425,7 +454,11 @@ cdef class Edje(Object):
425 :param text: the new text to set 454 :param text: the new text to set
426 455
427 """ 456 """
428 edje_object_part_text_set(self.obj, _cfruni(part), _cfruni(text)) 457 if isinstance(part, unicode): part = part.encode("UTF-8")
458 if isinstance(text, unicode): text = text.encode("UTF-8")
459 edje_object_part_text_set(self.obj,
460 <const_char *>part if part is not None else NULL,
461 <const_char *>text if text is not None else NULL)
429 462
430 def part_text_get(self, part): 463 def part_text_get(self, part):
431 """Get the text of a given part. 464 """Get the text of a given part.
@@ -435,16 +468,22 @@ cdef class Edje(Object):
435 468
436 """ 469 """
437 cdef const_char *s 470 cdef const_char *s
438 return _ctouni(edje_object_part_text_get(self.obj, _cfruni(part))) 471 if isinstance(part, unicode): part = part.encode("UTF-8")
472 return _ctouni(edje_object_part_text_get(self.obj,
473 <const_char *>part if part is not None else NULL))
439 474
440 475
441 def part_text_select_all(self, part): 476 def part_text_select_all(self, part):
442 "Select all the text of the given TEXT or TEXTBLOCK part" 477 "Select all the text of the given TEXT or TEXTBLOCK part"
443 edje_object_part_text_select_all(self.obj, _cfruni(part)) 478 if isinstance(part, unicode): part = part.encode("UTF-8")
479 edje_object_part_text_select_all(self.obj,
480 <const_char *>part if part is not None else NULL)
444 481
445 def part_text_select_none(self, part): 482 def part_text_select_none(self, part):
446 "Deselect all the text of the given TEXT or TEXTBLOCK part" 483 "Deselect all the text of the given TEXT or TEXTBLOCK part"
447 edje_object_part_text_select_none(self.obj, _cfruni(part)) 484 if isinstance(part, unicode): part = part.encode("UTF-8")
485 edje_object_part_text_select_none(self.obj,
486 <const_char *>part if part is not None else NULL)
448 487
449 def part_text_unescaped_set(self, part, text_to_escape): 488 def part_text_unescaped_set(self, part, text_to_escape):
450 """Automatically escapes text if using TEXTBLOCK. 489 """Automatically escapes text if using TEXTBLOCK.
@@ -456,8 +495,12 @@ cdef class Edje(Object):
456 :see: part_text_set() 495 :see: part_text_set()
457 :see: part_text_unescaped_get() 496 :see: part_text_unescaped_get()
458 """ 497 """
459 edje_object_part_text_unescaped_set(self.obj, _cfruni(part), 498 if isinstance(part, unicode): part = part.encode("UTF-8")
460 _cfruni(text_to_escape)) 499 if isinstance(text_to_escape, unicode):
500 text_to_escape = text_to_escape.encode("UTF-8")
501 edje_object_part_text_unescaped_set(self.obj,
502 <const_char *>part if part is not None else NULL,
503 <const_char *>text_to_escape if text_to_escape is not None else NULL)
461 504
462 def part_text_unescaped_get(self, part): 505 def part_text_unescaped_get(self, part):
463 """Automatically removes escape from text if using TEXTBLOCK. 506 """Automatically removes escape from text if using TEXTBLOCK.
@@ -469,7 +512,9 @@ cdef class Edje(Object):
469 :see: part_text_unescaped_set() 512 :see: part_text_unescaped_set()
470 """ 513 """
471 cdef char *s 514 cdef char *s
472 s = edje_object_part_text_unescaped_get(self.obj, _cfruni(part)) 515 if isinstance(part, unicode): part = part.encode("UTF-8")
516 s = edje_object_part_text_unescaped_get(self.obj,
517 <const_char *>part if part is not None else NULL)
473 if s == NULL: 518 if s == NULL:
474 return None 519 return None
475 else: 520 else:
@@ -493,7 +538,9 @@ cdef class Edje(Object):
493 :type obj: efl.evas.Object 538 :type obj: efl.evas.Object
494 539
495 """ 540 """
496 edje_object_part_swallow(self.obj, _cfruni(part), obj.obj) 541 if isinstance(part, unicode): part = part.encode("UTF-8")
542 edje_object_part_swallow(self.obj,
543 <const_char *>part if part is not None else NULL, obj.obj)
497 544
498 def part_unswallow(self, Object obj): 545 def part_unswallow(self, Object obj):
499 "Unswallow the given object from the edje" 546 "Unswallow the given object from the edje"
@@ -501,13 +548,15 @@ cdef class Edje(Object):
501 548
502 def part_swallow_get(self, part): 549 def part_swallow_get(self, part):
503 ":rtype: efl.evas.Object" 550 ":rtype: efl.evas.Object"
551 if isinstance(part, unicode): part = part.encode("UTF-8")
504 return object_from_instance(edje_object_part_swallow_get( 552 return object_from_instance(edje_object_part_swallow_get(
505 self.obj, _cfruni(part))) 553 self.obj, <const_char *>part if part is not None else NULL))
506 554
507 def part_external_object_get(self, part): 555 def part_external_object_get(self, part):
508 ":rtype: efl.evas.Object" 556 ":rtype: efl.evas.Object"
557 if isinstance(part, unicode): part = part.encode("UTF-8")
509 return object_from_instance(edje_object_part_external_object_get( 558 return object_from_instance(edje_object_part_external_object_get(
510 self.obj, _cfruni(part))) 559 self.obj, <const_char *>part if part is not None else NULL))
511 560
512 def part_external_param_set(self, part, param, value): 561 def part_external_param_set(self, part, param, value):
513 """Set a parameter of the external part. 562 """Set a parameter of the external part.
@@ -620,7 +669,9 @@ cdef class Edje(Object):
620 :param obj: the efl.evas.Object to append 669 :param obj: the efl.evas.Object to append
621 :rtype: bool 670 :rtype: bool
622 """ 671 """
623 return bool(edje_object_part_box_append(self.obj, _cfruni(part), obj.obj)) 672 if isinstance(part, unicode): part = part.encode("UTF-8")
673 return bool(edje_object_part_box_append(self.obj,
674 <const_char *>part if part is not None else NULL, obj.obj))
624 675
625 def part_box_prepend(self, part, Object obj): 676 def part_box_prepend(self, part, Object obj):
626 """Prepend an item to a BOX part. 677 """Prepend an item to a BOX part.
@@ -633,7 +684,9 @@ cdef class Edje(Object):
633 :param obj: the efl.evas.Object to append 684 :param obj: the efl.evas.Object to append
634 :rtype: bool 685 :rtype: bool
635 """ 686 """
636 return bool(edje_object_part_box_prepend(self.obj, _cfruni(part), obj.obj)) 687 if isinstance(part, unicode): part = part.encode("UTF-8")
688 return bool(edje_object_part_box_prepend(self.obj,
689 <const_char *>part if part is not None else NULL, obj.obj))
637 690
638 def part_box_insert_at(self, part, Object obj, 691 def part_box_insert_at(self, part, Object obj,
639 unsigned int pos): 692 unsigned int pos):
@@ -644,8 +697,9 @@ cdef class Edje(Object):
644 :param pos: the position to append the object 697 :param pos: the position to append the object
645 :rtype: bool 698 :rtype: bool
646 """ 699 """
647 return bool(edje_object_part_box_insert_at(self.obj, _cfruni(part), 700 if isinstance(part, unicode): part = part.encode("UTF-8")
648 obj.obj, pos)) 701 return bool(edje_object_part_box_insert_at(self.obj,
702 <const_char *>part if part is not None else NULL, obj.obj, pos))
649 703
650 def part_box_insert_before(self, part, Object obj, Object reference): 704 def part_box_insert_before(self, part, Object obj, Object reference):
651 """Inserts an item in a BOX part before the reference object. 705 """Inserts an item in a BOX part before the reference object.
@@ -655,8 +709,10 @@ cdef class Edje(Object):
655 :param reference: the efl.evas.Object used as reference 709 :param reference: the efl.evas.Object used as reference
656 :rtype: bool 710 :rtype: bool
657 """ 711 """
658 return bool(edje_object_part_box_insert_before(self.obj, _cfruni(part), 712 if isinstance(part, unicode): part = part.encode("UTF-8")
659 obj.obj, reference.obj)) 713 return bool(edje_object_part_box_insert_before(self.obj,
714 <const_char *>part if part is not None else NULL,
715 obj.obj, reference.obj))
660 716
661 def part_box_remove(self, part, Object obj): 717 def part_box_remove(self, part, Object obj):
662 """Removes the object given from a BOX part. 718 """Removes the object given from a BOX part.
@@ -670,8 +726,9 @@ cdef class Edje(Object):
670 :rtype: efl.evas.Object or *None* 726 :rtype: efl.evas.Object or *None*
671 727
672 """ 728 """
729 if isinstance(part, unicode): part = part.encode("UTF-8")
673 return object_from_instance(edje_object_part_box_remove(self.obj, 730 return object_from_instance(edje_object_part_box_remove(self.obj,
674 _cfruni(part), obj.obj)) 731 <const_char *>part if part is not None else NULL, obj.obj))
675 732
676 def part_box_remove_at(self, part, unsigned int pos): 733 def part_box_remove_at(self, part, unsigned int pos):
677 """Removes the object at the given position in a BOX part. 734 """Removes the object at the given position in a BOX part.
@@ -684,8 +741,9 @@ cdef class Edje(Object):
684 :return: the removed object 741 :return: the removed object
685 :rtype: efl.evas.Object or None 742 :rtype: efl.evas.Object or None
686 """ 743 """
744 if isinstance(part, unicode): part = part.encode("UTF-8")
687 return object_from_instance(edje_object_part_box_remove_at(self.obj, 745 return object_from_instance(edje_object_part_box_remove_at(self.obj,
688 _cfruni(part), pos)) 746 <const_char *>part if part is not None else NULL, pos))
689 747
690 def part_box_remove_all(self, part, int clear): 748 def part_box_remove_all(self, part, int clear):
691 """Removes all objects from a BOX part. 749 """Removes all objects from a BOX part.
@@ -697,8 +755,9 @@ cdef class Edje(Object):
697 755
698 :rtype: bool 756 :rtype: bool
699 """ 757 """
758 if isinstance(part, unicode): part = part.encode("UTF-8")
700 return bool(edje_object_part_box_remove_all(self.obj, 759 return bool(edje_object_part_box_remove_all(self.obj,
701 _cfruni(part), clear)) 760 <const_char *>part if part is not None else NULL, clear))
702 761
703 def part_table_pack(self, part, Object child, short col, short row, short colspan, short rowspan): 762 def part_table_pack(self, part, Object child, short col, short row, short colspan, short rowspan):
704 """Pack an object inside a TABLE part. 763 """Pack an object inside a TABLE part.
@@ -712,8 +771,10 @@ cdef class Edje(Object):
712 771
713 :rtype: bool 772 :rtype: bool
714 """ 773 """
715 return bool(edje_object_part_table_pack(self.obj, _cfruni(part), 774 if isinstance(part, unicode): part = part.encode("UTF-8")
716 child.obj, col, row, colspan, rowspan)) 775 return bool(edje_object_part_table_pack(self.obj,
776 <const_char *>part if part is not None else NULL,
777 child.obj, col, row, colspan, rowspan))
717 778
718 def part_table_unpack(self, part, Object child): 779 def part_table_unpack(self, part, Object child):
719 """Remove an object from a TABLE part. 780 """Remove an object from a TABLE part.
@@ -723,8 +784,10 @@ cdef class Edje(Object):
723 784
724 :rtype: bool 785 :rtype: bool
725 """ 786 """
726 return bool(edje_object_part_table_unpack(self.obj, _cfruni(part), 787 if isinstance(part, unicode): part = part.encode("UTF-8")
727 child.obj)) 788 return bool(edje_object_part_table_unpack(self.obj,
789 <const_char *>part if part is not None else NULL,
790 child.obj))
728 791
729 def part_table_col_row_size_get(self, part): 792 def part_table_col_row_size_get(self, part):
730 """Returns the size in columns/rows of the TABLE part. 793 """Returns the size in columns/rows of the TABLE part.
@@ -734,7 +797,9 @@ cdef class Edje(Object):
734 :rtype: tuple of int 797 :rtype: tuple of int
735 """ 798 """
736 cdef int c, r 799 cdef int c, r
737 edje_object_part_table_col_row_size_get(self.obj, _cfruni(part), &c, &r) 800 if isinstance(part, unicode): part = part.encode("UTF-8")
801 edje_object_part_table_col_row_size_get(self.obj,
802 <const_char *>part if part is not None else NULL, &c, &r)
738 return (c, r) 803 return (c, r)
739 804
740 def part_table_clear(self, part, int clear): 805 def part_table_clear(self, part, int clear):
@@ -747,7 +812,9 @@ cdef class Edje(Object):
747 812
748 :rtype: bool 813 :rtype: bool
749 """ 814 """
750 return bool(edje_object_part_table_clear(self.obj, _cfruni(part), clear)) 815 if isinstance(part, unicode): part = part.encode("UTF-8")
816 return bool(edje_object_part_table_clear(self.obj,
817 <const_char *>part if part is not None else NULL, clear))
751 818
752 def part_table_child_get(self, part, int row, int column): 819 def part_table_child_get(self, part, int row, int column):
753 """Retrieve a child from a table. 820 """Retrieve a child from a table.
@@ -759,31 +826,40 @@ cdef class Edje(Object):
759 :return: the object ath the given position 826 :return: the object ath the given position
760 :rtype: efl.evas.Object 827 :rtype: efl.evas.Object
761 """ 828 """
829 if isinstance(part, unicode): part = part.encode("UTF-8")
762 return object_from_instance(edje_object_part_table_child_get(self.obj, 830 return object_from_instance(edje_object_part_table_child_get(self.obj,
763 _cfruni(part), row, column)) 831 <const_char *>part if part is not None else NULL, row, column))
764 832
765 def part_state_get(self, part): 833 def part_state_get(self, part):
766 ":rtype: (name, value)" 834 ":rtype: (name, value)"
767 cdef double sv 835 cdef double sv
768 cdef const_char *sn 836 cdef const_char *sn
769 sn = edje_object_part_state_get(self.obj, _cfruni(part), &sv) 837 if isinstance(part, unicode): part = part.encode("UTF-8")
838 sn = edje_object_part_state_get(self.obj,
839 <const_char *>part if part is not None else NULL, &sv)
770 return (_ctouni(sn), sv) 840 return (_ctouni(sn), sv)
771 841
772 def part_drag_dir_get(self, part): 842 def part_drag_dir_get(self, part):
773 ":rtype: int" 843 ":rtype: int"
774 return edje_object_part_drag_dir_get(self.obj, _cfruni(part)) 844 if isinstance(part, unicode): part = part.encode("UTF-8")
845 return edje_object_part_drag_dir_get(self.obj,
846 <const_char *>part if part is not None else NULL)
775 847
776 def part_drag_value_set(self, part, double dx, double dy): 848 def part_drag_value_set(self, part, double dx, double dy):
777 """Set the drag value of part 849 """Set the drag value of part
778 :param dx: 850 :param dx:
779 :param dy: 851 :param dy:
780 """ 852 """
781 edje_object_part_drag_value_set(self.obj, _cfruni(part), dx, dy) 853 if isinstance(part, unicode): part = part.encode("UTF-8")
854 edje_object_part_drag_value_set(self.obj,
855 <const_char *>part if part is not None else NULL, dx, dy)
782 856
783 def part_drag_value_get(self, part): 857 def part_drag_value_get(self, part):
784 ":rtype: tuple of float" 858 ":rtype: tuple of float"
785 cdef double dx, dy 859 cdef double dx, dy
786 edje_object_part_drag_value_get(self.obj, _cfruni(part), &dx, &dy) 860 if isinstance(part, unicode): part = part.encode("UTF-8")
861 edje_object_part_drag_value_get(self.obj,
862 <const_char *>part if part is not None else NULL, &dx, &dy)
787 return (dx, dy) 863 return (dx, dy)
788 864
789 def part_drag_size_set(self, part, double dw, double dh): 865 def part_drag_size_set(self, part, double dw, double dh):
@@ -791,12 +867,16 @@ cdef class Edje(Object):
791 :param dw: 867 :param dw:
792 :param dh: 868 :param dh:
793 """ 869 """
794 edje_object_part_drag_size_set(self.obj, _cfruni(part), dw, dh) 870 if isinstance(part, unicode): part = part.encode("UTF-8")
871 edje_object_part_drag_size_set(self.obj,
872 <const_char *>part if part is not None else NULL, dw, dh)
795 873
796 def part_drag_size_get(self, part): 874 def part_drag_size_get(self, part):
797 ":rtype: tuple of float" 875 ":rtype: tuple of float"
798 cdef double dw, dh 876 cdef double dw, dh
799 edje_object_part_drag_size_get(self.obj, _cfruni(part), &dw, &dh) 877 if isinstance(part, unicode): part = part.encode("UTF-8")
878 edje_object_part_drag_size_get(self.obj,
879 <const_char *>part if part is not None else NULL, &dw, &dh)
800 return (dw, dh) 880 return (dw, dh)
801 881
802 def part_drag_step_set(self, part, double dx, double dy): 882 def part_drag_step_set(self, part, double dx, double dy):
@@ -804,28 +884,40 @@ cdef class Edje(Object):
804 :param dx: 884 :param dx:
805 :param dy: 885 :param dy:
806 """ 886 """
807 edje_object_part_drag_step_set(self.obj, _cfruni(part), dx, dy) 887 if isinstance(part, unicode): part = part.encode("UTF-8")
888 edje_object_part_drag_step_set(self.obj,
889 <const_char *>part if part is not None else NULL, dx, dy)
808 890
809 def part_drag_step_get(self, part): 891 def part_drag_step_get(self, part):
810 ":rtype: tuple of float" 892 ":rtype: tuple of float"
811 cdef double dx, dy 893 cdef double dx, dy
812 edje_object_part_drag_step_get(self.obj, _cfruni(part), &dx, &dy) 894 if isinstance(part, unicode): part = part.encode("UTF-8")
895 edje_object_part_drag_step_get(self.obj,
896 <const_char *>part if part is not None else NULL, &dx, &dy)
813 return (dx, dy) 897 return (dx, dy)
814 898
815 def part_drag_step(self, part, double dx, double dy): 899 def part_drag_step(self, part, double dx, double dy):
816 edje_object_part_drag_step(self.obj, _cfruni(part), dx, dy) 900 if isinstance(part, unicode): part = part.encode("UTF-8")
901 edje_object_part_drag_step(self.obj,
902 <const_char *>part if part is not None else NULL, dx, dy)
817 903
818 def part_drag_page_set(self, part, double dx, double dy): 904 def part_drag_page_set(self, part, double dx, double dy):
819 edje_object_part_drag_page_set(self.obj, _cfruni(part), dx, dy) 905 if isinstance(part, unicode): part = part.encode("UTF-8")
906 edje_object_part_drag_page_set(self.obj,
907 <const_char *>part if part is not None else NULL, dx, dy)
820 908
821 def part_drag_page_get(self, part): 909 def part_drag_page_get(self, part):
822 "@rtype: tuple of float" 910 "@rtype: tuple of float"
823 cdef double dx, dy 911 cdef double dx, dy
824 edje_object_part_drag_page_get(self.obj, _cfruni(part), &dx, &dy) 912 if isinstance(part, unicode): part = part.encode("UTF-8")
913 edje_object_part_drag_page_get(self.obj,
914 <const_char *>part if part is not None else NULL, &dx, &dy)
825 return (dx, dy) 915 return (dx, dy)
826 916
827 def part_drag_page(self, part, double dx, double dy): 917 def part_drag_page(self, part, double dx, double dy):
828 edje_object_part_drag_page(self.obj, _cfruni(part), dx, dy) 918 if isinstance(part, unicode): part = part.encode("UTF-8")
919 edje_object_part_drag_page(self.obj,
920 <const_char *>part if part is not None else NULL, dx, dy)
829 921
830 cdef void message_send_int(self, int id, int data): 922 cdef void message_send_int(self, int id, int data):
831 cdef Edje_Message_Int m 923 cdef Edje_Message_Int m
@@ -839,7 +931,8 @@ cdef class Edje(Object):
839 931
840 cdef void message_send_str(self, int id, data): 932 cdef void message_send_str(self, int id, data):
841 cdef Edje_Message_String m 933 cdef Edje_Message_String m
842 m.str = _fruni(data) 934 if isinstance(data, unicode): data = data.encode("UTF-8")
935 m.str = <char *>data if data is not None else NULL
843 edje_object_message_send(self.obj, EDJE_MESSAGE_STRING, id, <void*>&m) 936 edje_object_message_send(self.obj, EDJE_MESSAGE_STRING, id, <void*>&m)
844 937
845 cdef void message_send_str_set(self, int id, data): 938 cdef void message_send_str_set(self, int id, data):
@@ -862,14 +955,16 @@ cdef class Edje(Object):
862 955
863 cdef void message_send_str_int(self, int id, s, int i): 956 cdef void message_send_str_int(self, int id, s, int i):
864 cdef Edje_Message_String_Int m 957 cdef Edje_Message_String_Int m
865 m.str = _fruni(s) 958 if isinstance(s, unicode): s = s.encode("UTF-8")
959 m.str = <char *>s if s is not None else NULL
866 m.val = i 960 m.val = i
867 edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_INT, id, 961 edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_INT, id,
868 <void*>&m) 962 <void*>&m)
869 963
870 cdef void message_send_str_float(self, int id, s, float f): 964 cdef void message_send_str_float(self, int id, s, float f):
871 cdef Edje_Message_String_Float m 965 cdef Edje_Message_String_Float m
872 m.str = _fruni(s) 966 if isinstance(s, unicode): s = s.encode("UTF-8")
967 m.str = <char *>s if s is not None else NULL
873 m.val = f 968 m.val = f
874 edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_FLOAT, id, 969 edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_FLOAT, id,
875 <void*>&m) 970 <void*>&m)
@@ -882,7 +977,8 @@ cdef class Edje(Object):
882 m = <Edje_Message_String_Int_Set*>PyMem_Malloc( 977 m = <Edje_Message_String_Int_Set*>PyMem_Malloc(
883 sizeof(Edje_Message_String_Int_Set) + (count - 1) * sizeof(int)) 978 sizeof(Edje_Message_String_Int_Set) + (count - 1) * sizeof(int))
884 979
885 m.str = _fruni(s) 980 if isinstance(s, unicode): s = s.encode("UTF-8")
981 m.str = <char *>s if s is not None else NULL
886 m.count = count 982 m.count = count
887 i = 0 983 i = 0
888 for f in data: 984 for f in data:
@@ -902,7 +998,8 @@ cdef class Edje(Object):
902 sizeof(Edje_Message_String_Float_Set) + 998 sizeof(Edje_Message_String_Float_Set) +
903 (count - 1) * sizeof(double)) 999 (count - 1) * sizeof(double))
904 1000
905 m.str = _fruni(s) 1001 if isinstance(s, unicode): s = s.encode("UTF-8")
1002 m.str = <char *>s if s is not None else NULL
906 m.count = count 1003 m.count = count
907 i = 0 1004 i = 0
908 for f in data: 1005 for f in data:
@@ -1061,8 +1158,12 @@ cdef class Edje(Object):
1061 d = self._signal_callbacks.setdefault(emission, {}) 1158 d = self._signal_callbacks.setdefault(emission, {})
1062 lst = d.setdefault(source, []) 1159 lst = d.setdefault(source, [])
1063 if not lst: 1160 if not lst:
1064 edje_object_signal_callback_add(self.obj, _cfruni(emission), 1161 if isinstance(emission, unicode): emission = emission.encode("UTF-8")
1065 _cfruni(source), signal_cb, <void*>lst) 1162 if isinstance(source, unicode): source = source.encode("UTF-8")
1163 edje_object_signal_callback_add(self.obj,
1164 <const_char *>emission if emission is not None else NULL,
1165 <const_char *>source if source is not None else NULL,
1166 signal_cb, <void*>lst)
1066 lst.append((func, args, kargs)) 1167 lst.append((func, args, kargs))
1067 1168
1068 def signal_callback_del(self, emission, source, func): 1169 def signal_callback_del(self, emission, source, func):
@@ -1090,12 +1191,20 @@ cdef class Edje(Object):
1090 d.pop(source) 1191 d.pop(source)
1091 if not d: 1192 if not d:
1092 self._signal_callbacks.pop(emission) 1193 self._signal_callbacks.pop(emission)
1093 edje_object_signal_callback_del(self.obj, _cfruni(emission), 1194 if isinstance(emission, unicode): emission = emission.encode("UTF-8")
1094 _cfruni(source), signal_cb) 1195 if isinstance(source, unicode): source = source.encode("UTF-8")
1196 edje_object_signal_callback_del(self.obj,
1197 <const_char *>emission if emission is not None else NULL,
1198 <const_char *>source if source is not None else NULL,
1199 signal_cb)
1095 1200
1096 def signal_emit(self, emission, source): 1201 def signal_emit(self, emission, source):
1097 "Emit signal with ``emission`` and ``source``" 1202 "Emit signal with ``emission`` and ``source``"
1098 edje_object_signal_emit(self.obj, _cfruni(emission), _cfruni(source)) 1203 if isinstance(emission, unicode): emission = emission.encode("UTF-8")
1204 if isinstance(source, unicode): source = source.encode("UTF-8")
1205 edje_object_signal_emit(self.obj,
1206 <const_char *>emission if emission is not None else NULL,
1207 <const_char *>source if source is not None else NULL)
1099 1208
1100 1209
1101_object_mapping_register("edje", Edje) 1210_object_mapping_register("edje", Edje)