summaryrefslogtreecommitdiff
path: root/efl/elementary/systray.pxi
blob: 4407eccb09d723b38372505df56dedaad38762b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# Copyright (C) 2007-2015 various contributors (see AUTHORS)
#
# This file is part of Python-EFL.
#
# Python-EFL is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Python-EFL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL.  If not, see <http://www.gnu.org/licenses/>.

include "systray_cdef.pxi"

cdef class Systray(Eo):

    """

    This is the class that actually implements the widget.

    """

    def __init__(self, Eo parent not None, *args, **kwargs):
        cdef cEo *obj
        eo_add(&obj, elm_systray_class_get(), parent.obj)
        self._set_obj(obj)
        self._set_properties_from_keyword_args(kwargs)

    property id:
        """The id of the Status Notifier Item.

        :type: string

        """
        def __set__(self, value):
            if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
            elm_obj_systray_id_set(
                self.obj, <const char *>value if value is not None else NULL
                )

        def __get__(self):
            return _ctouni(elm_obj_systray_id_get(self.obj))

    def id_set(self, value):
        if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
        elm_obj_systray_id_set(
            self.obj, <const char *>value if value is not None else NULL
            )

    def id_get(self):
        return _ctouni(elm_obj_systray_id_get(self.obj))

    property category:
        """

        The category of the Status Notifier Item.

        :type: :ref:`Elm_Systray_Category`

        """
        def __set__(self, Elm_Systray_Category value):
            elm_obj_systray_category_set(self.obj, value)

        def __get__(self):
            return <Elm_Systray_Category>elm_obj_systray_category_get(self.obj)

    def category_set(self, Elm_Systray_Category value):
        elm_obj_systray_category_set(self.obj, value)

    def category_get(self):
        return <Elm_Systray_Category>elm_obj_systray_category_get(self.obj)

    property icon_theme_path:
        """The path to the theme where the icons can be found.

        Set this value to "" to use the default path.

        :type: string
        """
        def __set__(self, value):
            if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
            elm_obj_systray_icon_theme_path_set(
                self.obj, <const char *>value if value is not None else NULL
                )

        def __get__(self):
            return _ctouni(elm_obj_systray_icon_theme_path_get(self.obj))

    def icon_theme_path_set(self, value):
        if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
        elm_obj_systray_icon_theme_path_set(
            self.obj, <const char *>value if value is not None else NULL
            )

    def icon_theme_path_get(self):
        return _ctouni(elm_obj_systray_icon_theme_path_get(self.obj))

    property menu:
        """The D-Bus Menu to be shown when the Status Notifier Item is activated by the user.

        :type: :class:`~efl.elementary.menu.Menu`
        """
        def __set__(self, Eo value):
            elm_obj_systray_menu_set(self.obj, value.obj)

        def __get__(self):
            return object_from_instance(elm_obj_systray_menu_get(self.obj))

    def menu_set(self, Eo value):
        elm_obj_systray_menu_set(self.obj, value.obj)

    def menu_get(self):
        return object_from_instance(elm_obj_systray_menu_get(self.obj))

    property att_icon_name:
        """The name of the attention icon to be used by the Status Notifier Item.

        :type: string
        """
        def __set__(self, value):
            if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
            elm_obj_systray_att_icon_name_set(
                self.obj, <const char *>value if value is not None else NULL
                )

        def __get__(self):
            return _ctouni(elm_obj_systray_att_icon_name_get(self.obj))

    def att_icon_name_set(self, value):
        if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
        elm_obj_systray_att_icon_name_set(
            self.obj, <const char *>value if value is not None else NULL
            )

    def att_icon_name_get(self):
        return _ctouni(elm_obj_systray_att_icon_name_get(self.obj))

    property status:
        """The status of the Status Notifier Item.

        :type: :ref:`Elm_Systray_Status`
        """
        def __set__(self, Elm_Systray_Status value):
            elm_obj_systray_status_set(self.obj, value)

        def __get__(self):
            return elm_obj_systray_status_get(self.obj)

    def status_set(self, Elm_Systray_Status value):
        elm_obj_systray_status_set(self.obj, value)

    def status_get(self):
        return elm_obj_systray_status_get(self.obj)

    property icon_name:
        """The name of the icon to be used by the Status Notifier Item.

        :type: string
        """
        def __set__(self, value):
            if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
            elm_obj_systray_icon_name_set(
                self.obj, <const char *>value if value is not None else NULL
                )

        def __get__(self):
            return _ctouni(elm_obj_systray_icon_name_get(self.obj))

    def icon_name_set(self, value):
        if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
        elm_obj_systray_icon_name_set(
            self.obj, <const char *>value if value is not None else NULL
            )

    def icon_name_get(self):
        return _ctouni(elm_obj_systray_icon_name_get(self.obj))

    property title:
        """The title of the Status Notifier Item.

        :type: string
        """
        def __set__(self, value):
            if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
            elm_obj_systray_title_set(
                self.obj, <const char *>value if value is not None else NULL
                )

        def __get__(self):
            return _ctouni(elm_obj_systray_title_get(self.obj))

    def title_set(self, value):
        if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
        elm_obj_systray_title_set(
            self.obj, <const char *>value if value is not None else NULL
            )

    def title_get(self):
        return _ctouni(elm_obj_systray_title_get(self.obj))

    def register(self):
        """Register this Status Notifier Item in the System Tray Watcher.

        This function should only be called after the event
        ``ELM_EVENT_SYSTRAY_READY``, for which you can set a callback with
        :func:`on_systray_ready`, is emitted.

        """
        return elm_obj_systray_register(self.obj)


def on_systray_ready(func, *args, **kwargs):
    """Use this to set a handler for the systray ready event."""
    return EventHandler(ELM_EVENT_SYSTRAY_READY, func, *args, **kwargs)