summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-05-27 21:55:12 +0200
committerdavemds <dave@gurumeditation.it>2014-05-27 21:55:12 +0200
commited7ba205831a05b9fe855b92356ad572e47eeb06 (patch)
tree80630d42a53fccec79a8cd4b48fe45037ccfe49b
parentcfc20537e920b91e6211a44bc101a90f513d5a3d (diff)
New Configuration.color_class_* functions and props.
-rw-r--r--efl/elementary/configuration.pxd20
-rw-r--r--efl/elementary/configuration.pyx114
2 files changed, 134 insertions, 0 deletions
diff --git a/efl/elementary/configuration.pxd b/efl/elementary/configuration.pxd
index 01143b2..009110e 100644
--- a/efl/elementary/configuration.pxd
+++ b/efl/elementary/configuration.pxd
@@ -12,6 +12,19 @@ cdef extern from "Elementary.h":
12 const char *name 12 const char *name
13 const char *desc 13 const char *desc
14 14
15 ctypedef struct Elm_Color_Class:
16 const char *name
17 const char *desc
18
19
20 ctypedef struct _Elm_Color_Overlay_Color:
21 int r, g, b, a
22
23 ctypedef struct Elm_Color_Overlay:
24 const char *color_class
25 _Elm_Color_Overlay_Color color, outline, shadow
26
27
15 Eina_Bool elm_config_save() 28 Eina_Bool elm_config_save()
16 void elm_config_reload() 29 void elm_config_reload()
17 void elm_config_all_flush() 30 void elm_config_all_flush()
@@ -84,6 +97,13 @@ cdef extern from "Elementary.h":
84 const char * elm_config_accel_preference_get() 97 const char * elm_config_accel_preference_get()
85 void elm_config_accel_preference_set(const char *pref) 98 void elm_config_accel_preference_set(const char *pref)
86 99
100 Eina_List * elm_config_color_classes_list_get()
101 void elm_config_color_classes_list_free(Eina_List *list)
102 const Eina_List * elm_config_color_overlay_list_get()
103 void elm_config_color_overlay_set(const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3)
104 void elm_config_color_overlay_unset(const char *color_class)
105 void elm_config_color_overlay_apply()
106
87 Eina_List * elm_config_text_classes_list_get() 107 Eina_List * elm_config_text_classes_list_get()
88 void elm_config_text_classes_list_free(Eina_List *list) 108 void elm_config_text_classes_list_free(Eina_List *list)
89 Eina_List * elm_config_font_overlay_list_get() 109 Eina_List * elm_config_font_overlay_list_get()
diff --git a/efl/elementary/configuration.pyx b/efl/elementary/configuration.pyx
index 55e05ad..284137f 100644
--- a/efl/elementary/configuration.pyx
+++ b/efl/elementary/configuration.pyx
@@ -688,6 +688,120 @@ cdef class Configuration(object):
688 <const char *>a2 if a2 is not None else NULL, 688 <const char *>a2 if a2 is not None else NULL,
689 size) 689 size)
690 690
691 property color_classes_list:
692 """Get Elementary's list of supported color classes.
693
694 :type: list of tuples (color_class_name, color_class_description)
695
696 .. versionadded:: 1.10
697
698 """
699 def __get__(self):
700 cdef:
701 Eina_List *lst = elm_config_color_classes_list_get()
702 Eina_List *itr = lst
703 Elm_Color_Class *data
704 const char *name
705 const char *desc
706
707 ret = []
708 while itr:
709 data = <Elm_Color_Class *>itr.data
710 if data != NULL:
711 name = data.name
712 desc = data.desc
713 ret.append((_ctouni(name), _ctouni(desc)))
714 itr = itr.next
715 elm_config_color_classes_list_free(lst)
716 return ret
717
718 property color_overlay_list:
719 """Get Elementary's list of color overlays
720
721 Return the overlays setted using color_overlay_set()
722
723 :type: list of tuples (color_class, (r, g, b, a), (r2, g2, b2, a2), (r3, g3, b3, a3))
724
725 .. versionadded:: 1.10
726
727 """
728 def __get__(self):
729 cdef:
730 Eina_List *lst = elm_config_color_overlay_list_get()
731 Elm_Color_Overlay *ov
732 const char *color_class
733
734 ret = []
735 while lst:
736 ov = <Elm_Color_Overlay *>lst.data
737 if ov != NULL:
738 color_class = ov.color_class
739 ret.append((
740 _ctouni(color_class),
741 (ov.color.r, ov.color.g, ov.color.b, ov.color.a),
742 (ov.outline.r, ov.outline.g, ov.outline.b, ov.outline.a),
743 (ov.shadow.r, ov.shadow.g, ov.shadow.b, ov.shadow.a)
744 ))
745
746 lst = lst.next
747 return ret
748
749 def color_overlay_set(self, cc, int r, int g, int b, int a,
750 int r2, int g2, int b2, int a2,
751 int r3, int g3, int b3, int a3):
752 """Set a color overlay for a given Elementary color class.
753
754 The first color is the object, the second is the text outline, and
755 the third is the text shadow. (Note that the second two only apply
756 to text parts).
757
758 Setting color emits a signal "color_class,set" with source being
759 the given color class in all edje objects.
760
761 :param cc: The color class name
762 :param r: Object Red value
763 :param g: Object Green value
764 :param b: Object Blue value
765 :param a: Object Alpha value
766 :param r2: Outline Red value
767 :param g2: Outline Green value
768 :param b2: Outline Blue value
769 :param a2: Outline Alpha value
770 :param r3: Shadow Red value
771 :param g3: Shadow Green value
772 :param b3: Shadow Blue value
773 :param a3: Shadow Alpha value
774
775 .. versionadded:: 1.10
776
777 """
778 if isinstance(cc, unicode): cc = PyUnicode_AsUTF8String(cc)
779 elm_config_color_overlay_set(<const char *>cc,
780 r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
781
782 def color_overlay_unset(self, cc):
783 """Unset a color overlay for a given Elementary color class.
784
785 This will bring back color elements belonging to color_class back
786 to their default color settings.
787
788 :param cc: The color class name
789
790 .. versionadded:: 1.10
791
792 """
793 if isinstance(cc, unicode): cc = PyUnicode_AsUTF8String(cc)
794 elm_config_color_overlay_unset(cc)
795
796 def color_overlay_apply(self):
797 """Apply the changes made with color_overlay_set() and
798 color_overlay_unset() on the current Elementary window.
799
800 .. versionadded:: 1.10
801
802 """
803 elm_config_color_overlay_apply()
804
691 # TODO: 805 # TODO:
692 # property access: 806 # property access:
693 # """Access mode 807 # """Access mode