summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-04-24 15:59:11 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2015-04-24 15:59:11 +0300
commitbd88b8845e9a212b974e23e4a595d89f7b9d345b (patch)
treec91e0a56a35d6a54780719acc8049cfeb3236756
parent380d998cd2a46c76b32495039a19444589bf4372 (diff)
parent8f68e52eccb2706e0e8ab39199cd72a4f8f22b0e (diff)
Merge branch 'master' into elmfusion
Conflicts: efl/elementary/__init__.pyx efl/elementary/colorselector.pxi efl/elementary/multibuttonentry.pxi efl/elementary/need.pxi
-rw-r--r--doc/themes/efldoc/static/efl.css20
-rw-r--r--efl/elementary/__init__.pyx119
-rw-r--r--efl/elementary/colorselector.pxi14
-rw-r--r--efl/elementary/elementary_cdef.pxi16
-rw-r--r--efl/elementary/multibuttonentry.pxi13
-rw-r--r--efl/elementary/need.pxi110
-rw-r--r--efl/elementary/need_cdef.pxi23
-rw-r--r--examples/elementary/test_multibuttonentry.py14
8 files changed, 186 insertions, 143 deletions
diff --git a/doc/themes/efldoc/static/efl.css b/doc/themes/efldoc/static/efl.css
index 369fb22..68d6dd3 100644
--- a/doc/themes/efldoc/static/efl.css
+++ b/doc/themes/efldoc/static/efl.css
@@ -322,10 +322,10 @@ cite, code, tt {
322 letter-spacing: -0.02em; 322 letter-spacing: -0.02em;
323} 323}
324 324
325tt { 325code, tt {
326 background-color: rgb(51,51,51); /*#f2f2f2*/ 326 background-color: rgb(51,51,51); /*#f2f2f2*/
327 border: 1px solid rgb(32,32,32); /*#ddd*/ 327 border: 1px solid rgb(32,32,32); /*#ddd*/
328 border-radius: 2px; 328 border-radius: 3px;
329 color: white; /*#333*/ 329 color: white; /*#333*/
330 padding: 1px; 330 padding: 1px;
331} 331}
@@ -351,12 +351,12 @@ hr {
351 margin: 2em; 351 margin: 2em;
352} 352}
353 353
354a tt { 354a tt, a code{
355 border: 0; 355 border: 0;
356 color: rgb(200,200,170); 356 color: rgb(200,200,170);
357} 357}
358 358
359a tt:hover { 359a tt:hover, a code:hover{
360 color: rgb(230,230,200); 360 color: rgb(230,230,200);
361} 361}
362 362
@@ -406,8 +406,8 @@ table td, table th {
406div.admonition, div.warning { 406div.admonition, div.warning {
407 font-size: 0.9em; 407 font-size: 0.9em;
408 margin: 1em 0 1em 0; 408 margin: 1em 0 1em 0;
409 border: 1px solid rgb(32,32,32); /*#86989B*/ 409 border: 1px dashed rgb(32,32,32); /*#86989B*/
410 border-radius: 2px; 410 border-radius: 12px;
411 background-color: rgb(51,51,51); /*#f7f7f7*/ 411 background-color: rgb(51,51,51); /*#f7f7f7*/
412 padding: 0; 412 padding: 0;
413} 413}
@@ -429,7 +429,7 @@ div.warning p.admonition-title {
429} 429}
430 430
431div.warning { 431div.warning {
432 border: 1px solid rgb(101,16,16); /*#940000*/ 432 border-color: rgb(101,16,16); /*#940000*/
433 background-color: rgb(101,51,51); /*#FFCCCF*/ 433 background-color: rgb(101,51,51); /*#FFCCCF*/
434} 434}
435 435
@@ -506,11 +506,15 @@ dl.class {
506} 506}
507 507
508dl.class > dt { 508dl.class > dt {
509 font-size: 20px; 509 font-size: 1.2em;
510 background-color: #333; 510 background-color: #333;
511 padding: 2px; 511 padding: 2px;
512} 512}
513 513
514dl.class > dt em {
515 font-size: 0.8em;
516}
517
514dl.class dt{ 518dl.class dt{
515 border-bottom: 1px solid #333; 519 border-bottom: 1px solid #333;
516} 520}
diff --git a/efl/elementary/__init__.pyx b/efl/elementary/__init__.pyx
index 7ece3c5..c4137da 100644
--- a/efl/elementary/__init__.pyx
+++ b/efl/elementary/__init__.pyx
@@ -47,86 +47,6 @@ elm_log = add_logger("efl.elementary")
47cdef int PY_EFL_ELM_LOG_DOMAIN = elm_log.eina_log_domain 47cdef int PY_EFL_ELM_LOG_DOMAIN = elm_log.eina_log_domain
48 48
49 49
50cdef class EventSystrayReady(Event):
51 cdef int _set_obj(self, void *o) except 0:
52 return 1
53
54 def __repr__(self):
55 return "<%s()>" % (self.__class__.__name__,)
56
57
58cdef class SysNotifyNotificationClosed(Event):
59
60 cdef Elm_Sys_Notify_Notification_Closed *obj
61
62 cdef int _set_obj(self, void *o) except 0:
63 self.obj = <Elm_Sys_Notify_Notification_Closed*>o
64 return 1
65
66 def __repr__(self):
67 # TODO: int -> string for 'reason'
68 return "<%s(id=%d, reason=%s)>" % \
69 (type(self).__name__, self.id, self.reason)
70
71 property id:
72 """ID of the notification.
73
74 :type: int
75
76 """
77 def __get__(self):
78 return self.obj.id
79
80 property reason:
81 """The Reason the notification was closed.
82
83 :type: :ref:`Elm_Sys_Notify_Closed_Reason`
84
85 """
86 def __get__(self):
87 return self.obj.reason
88
89
90cdef class SysNotifyActionInvoked(Event):
91
92 cdef Elm_Sys_Notify_Action_Invoked *obj
93
94 cdef int _set_obj(self, void *o) except 0:
95 self.obj = <Elm_Sys_Notify_Action_Invoked*>o
96 return 1
97
98 def __repr__(self):
99 return "<%s(id=%d, action_key=%s)>" % \
100 (type(self).__name__, self.id, self.action_key)
101
102 property id:
103 """ID of the notification.
104
105 :type: int
106
107 """
108 def __get__(self):
109 return self.obj.id
110
111 property action_key:
112 """The key of the action invoked. These match the keys sent over in the
113 list of actions.
114
115 :type: string
116
117 """
118 def __get__(self):
119 return _touni(self.obj.action_key)
120
121
122cdef class EthumbConnect(Event):
123 cdef int _set_obj(self, void *o) except 0:
124 return 1
125
126 def __repr__(self):
127 return "<%s()>" % (self.__class__.__name__,)
128
129
130cdef class ConfigAllChanged(Event): 50cdef class ConfigAllChanged(Event):
131 cdef int _set_obj(self, void *o) except 0: 51 cdef int _set_obj(self, void *o) except 0:
132 return 1 52 return 1
@@ -208,39 +128,7 @@ def init():
208 argv[i] = <char *>PyMem_Malloc(arg_len + 1) 128 argv[i] = <char *>PyMem_Malloc(arg_len + 1)
209 memcpy(argv[i], arg, arg_len + 1) 129 memcpy(argv[i], arg, arg_len + 1)
210 130
211 ret = elm_init(argc, argv) 131 return elm_init(argc, argv)
212
213 if ret != 1:
214 return ret
215
216 if elm_need_ethumb():
217 _event_mapping_register(ELM_ECORE_EVENT_ETHUMB_CONNECT, EthumbConnect)
218 else:
219 EINA_LOG_DOM_WARN(PY_EFL_ELM_LOG_DOMAIN, "Ethumb not available", NULL)
220
221 _event_mapping_register(ELM_EVENT_CONFIG_ALL_CHANGED, ConfigAllChanged)
222 _event_mapping_register(ELM_EVENT_POLICY_CHANGED, PolicyChanged)
223 _event_mapping_register(ELM_EVENT_PROCESS_BACKGROUND, ProcessBackground)
224 _event_mapping_register(ELM_EVENT_PROCESS_FOREGROUND, ProcessForeground)
225
226 if elm_need_systray():
227 _event_mapping_register(ELM_EVENT_SYSTRAY_READY, EventSystrayReady)
228 else:
229 EINA_LOG_DOM_WARN(PY_EFL_ELM_LOG_DOMAIN, "Systray not available", NULL)
230
231 if elm_need_sys_notify():
232 _event_mapping_register(
233 ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED,
234 SysNotifyNotificationClosed
235 )
236 _event_mapping_register(
237 ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED,
238 SysNotifyActionInvoked
239 )
240 else:
241 EINA_LOG_DOM_WARN(PY_EFL_ELM_LOG_DOMAIN, "Sys notify not available", NULL)
242
243 return ret
244 132
245def shutdown(): 133def shutdown():
246 """Shut down Elementary 134 """Shut down Elementary
@@ -272,6 +160,11 @@ def shutdown():
272init() 160init()
273atexit.register(shutdown) 161atexit.register(shutdown)
274 162
163_event_mapping_register(ELM_EVENT_CONFIG_ALL_CHANGED, ConfigAllChanged)
164_event_mapping_register(ELM_EVENT_POLICY_CHANGED, PolicyChanged)
165_event_mapping_register(ELM_EVENT_PROCESS_BACKGROUND, ProcessBackground)
166_event_mapping_register(ELM_EVENT_PROCESS_FOREGROUND, ProcessForeground)
167
275 168
276cdef void py_elm_sys_notify_send_cb(void *data, unsigned int id): 169cdef void py_elm_sys_notify_send_cb(void *data, unsigned int id):
277 cdef object func, func_data 170 cdef object func, func_data
diff --git a/efl/elementary/colorselector.pxi b/efl/elementary/colorselector.pxi
index db521a2..811e470 100644
--- a/efl/elementary/colorselector.pxi
+++ b/efl/elementary/colorselector.pxi
@@ -18,6 +18,7 @@
18 18
19include "colorselector_cdef.pxi" 19include "colorselector_cdef.pxi"
20 20
21
21cdef class ColorselectorPaletteItem(ObjectItem): 22cdef class ColorselectorPaletteItem(ObjectItem):
22 """ 23 """
23 24
@@ -243,6 +244,19 @@ cdef class Colorselector(LayoutClass):
243 def callback_changed_del(self, func): 244 def callback_changed_del(self, func):
244 self._callback_del("changed", func) 245 self._callback_del("changed", func)
245 246
247 def callback_changed_user_add(self, func, *args, **kwargs):
248 """When the color value is changed by the user
249
250 .. versionadded:: 1.14
251 """
252 self._callback_add("changed,user", func, args, kwargs)
253
254 def callback_changed_user_del(self, func):
255 """
256 .. versionadded:: 1.14
257 """
258 self._callback_del("changed,user", func)
259
246 def callback_color_item_selected_add(self, func, *args, **kwargs): 260 def callback_color_item_selected_add(self, func, *args, **kwargs):
247 """When user clicks on color item. The event_info parameter of the 261 """When user clicks on color item. The event_info parameter of the
248 callback will be the selected color item.""" 262 callback will be the selected color item."""
diff --git a/efl/elementary/elementary_cdef.pxi b/efl/elementary/elementary_cdef.pxi
index 7be828b..bc1a105 100644
--- a/efl/elementary/elementary_cdef.pxi
+++ b/efl/elementary/elementary_cdef.pxi
@@ -82,14 +82,6 @@ cdef extern from "Elementary.h":
82 ctypedef enum Elm_Policy_Throttle: 82 ctypedef enum Elm_Policy_Throttle:
83 pass 83 pass
84 84
85 cpdef enum Elm_Sys_Notify_Closed_Reason:
86 ELM_SYS_NOTIFY_CLOSED_EXPIRED
87 ELM_SYS_NOTIFY_CLOSED_DISMISSED
88 ELM_SYS_NOTIFY_CLOSED_REQUESTED
89 ELM_SYS_NOTIFY_CLOSED_UNDEFINED
90 ctypedef enum Elm_Sys_Notify_Closed_Reason:
91 pass
92
93 cpdef enum Elm_Sys_Notify_Urgency: 85 cpdef enum Elm_Sys_Notify_Urgency:
94 ELM_SYS_NOTIFY_URGENCY_LOW 86 ELM_SYS_NOTIFY_URGENCY_LOW
95 ELM_SYS_NOTIFY_URGENCY_NORMAL 87 ELM_SYS_NOTIFY_URGENCY_NORMAL
@@ -197,14 +189,6 @@ cdef extern from "Elementary.h":
197 # sys_notify.h 189 # sys_notify.h
198 ctypedef void (*Elm_Sys_Notify_Send_Cb)(void *data, unsigned int id) 190 ctypedef void (*Elm_Sys_Notify_Send_Cb)(void *data, unsigned int id)
199 191
200 ctypedef struct Elm_Sys_Notify_Notification_Closed:
201 unsigned int id # ID of the notification.
202 Elm_Sys_Notify_Closed_Reason reason # The Reason the notification was closed.
203
204 ctypedef struct Elm_Sys_Notify_Action_Invoked:
205 unsigned int id # ID of the notification.
206 char *action_key # The key of the action invoked. These match the keys sent over in the list of actions.
207
208 void elm_sys_notify_close(unsigned int id) 192 void elm_sys_notify_close(unsigned int id)
209 void elm_sys_notify_send( unsigned int replaces_id, 193 void elm_sys_notify_send( unsigned int replaces_id,
210 const char *icon, 194 const char *icon,
diff --git a/efl/elementary/multibuttonentry.pxi b/efl/elementary/multibuttonentry.pxi
index 16686b7..593b65f 100644
--- a/efl/elementary/multibuttonentry.pxi
+++ b/efl/elementary/multibuttonentry.pxi
@@ -17,6 +17,7 @@
17 17
18include "multibuttonentry_cdef.pxi" 18include "multibuttonentry_cdef.pxi"
19 19
20
20cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, \ 21cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, \
21 const char *item_label, void *item_data, void *data) with gil: 22 const char *item_label, void *item_data, void *data) with gil:
22 23
@@ -459,6 +460,18 @@ cdef class MultiButtonEntry(Object):
459 def callback_item_clicked_del(self, func): 460 def callback_item_clicked_del(self, func):
460 self._callback_del_full("item,clicked", _cb_object_item_conv, func) 461 self._callback_del_full("item,clicked", _cb_object_item_conv, func)
461 462
463 def callback_item_longpressed_add(self, func, *args, **kwargs):
464 """
465 .. versionadded:: 1.14
466 """
467 self._callback_add_full("item,longpressed", _cb_object_item_conv, func, args, kwargs)
468
469 def callback_item_longpressed_del(self, func):
470 """
471 .. versionadded:: 1.14
472 """
473 self._callback_del_full("item,longpressed", _cb_object_item_conv, func)
474
462 def callback_clicked_add(self, func, *args, **kwargs): 475 def callback_clicked_add(self, func, *args, **kwargs):
463 self._callback_add("clicked", func, args, kwargs) 476 self._callback_add("clicked", func, args, kwargs)
464 477
diff --git a/efl/elementary/need.pxi b/efl/elementary/need.pxi
index aff5765..62377e2 100644
--- a/efl/elementary/need.pxi
+++ b/efl/elementary/need.pxi
@@ -17,6 +17,86 @@
17 17
18include "need_cdef.pxi" 18include "need_cdef.pxi"
19 19
20
21cdef class SysNotifyNotificationClosed(Event):
22
23 cdef Elm_Sys_Notify_Notification_Closed *obj
24
25 cdef int _set_obj(self, void *o) except 0:
26 self.obj = <Elm_Sys_Notify_Notification_Closed*>o
27 return 1
28
29 def __repr__(self):
30 # TODO: int -> string for 'reason'
31 return "<%s(id=%d, reason=%s)>" % \
32 (type(self).__name__, self.id, self.reason)
33
34 property id:
35 """ID of the notification.
36
37 :type: int
38
39 """
40 def __get__(self):
41 return self.obj.id
42
43 property reason:
44 """The Reason the notification was closed.
45
46 :type: :ref:`Elm_Sys_Notify_Closed_Reason`
47
48 """
49 def __get__(self):
50 return self.obj.reason
51
52
53cdef class SysNotifyActionInvoked(Event):
54
55 cdef Elm_Sys_Notify_Action_Invoked *obj
56
57 cdef int _set_obj(self, void *o) except 0:
58 self.obj = <Elm_Sys_Notify_Action_Invoked*>o
59 return 1
60
61 def __repr__(self):
62 return "<%s(id=%d, action_key=%s)>" % \
63 (type(self).__name__, self.id, self.action_key)
64
65 property id:
66 """ID of the notification.
67
68 :type: int
69
70 """
71 def __get__(self):
72 return self.obj.id
73
74 property action_key:
75 """The key of the action invoked. These match the keys sent over in the
76 list of actions.
77
78 :type: string
79
80 """
81 def __get__(self):
82 return _touni(self.obj.action_key)
83
84
85cdef class EthumbConnect(Event):
86 cdef int _set_obj(self, void *o) except 0:
87 return 1
88
89 def __repr__(self):
90 return "<%s()>" % (self.__class__.__name__,)
91
92cdef class EventSystrayReady(Event):
93 cdef int _set_obj(self, void *o) except 0:
94 return 1
95
96 def __repr__(self):
97 return "<%s()>" % (self.__class__.__name__,)
98
99
20def need_efreet(): 100def need_efreet():
21 """Request that your elementary application needs Efreet 101 """Request that your elementary application needs Efreet
22 102
@@ -43,7 +123,13 @@ def need_systray():
43 .. versionadded:: 1.8 123 .. versionadded:: 1.8
44 124
45 """ 125 """
46 return bool(elm_need_systray()) 126 cdef bint ret = elm_need_systray()
127 if ret:
128 try:
129 _event_mapping_register(ELM_EVENT_SYSTRAY_READY, EventSystrayReady)
130 except ValueError:
131 pass
132 return ret
47 133
48def need_sys_notify(): 134def need_sys_notify():
49 """Request that your elementary application needs Elm_Sys_Notify 135 """Request that your elementary application needs Elm_Sys_Notify
@@ -58,7 +144,20 @@ def need_sys_notify():
58 .. versionadded:: 1.8 144 .. versionadded:: 1.8
59 145
60 """ 146 """
61 return bool(elm_need_sys_notify()) 147 cdef bint ret = elm_need_sys_notify()
148 if ret:
149 try:
150 _event_mapping_register(
151 ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED,
152 SysNotifyNotificationClosed
153 )
154 _event_mapping_register(
155 ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED,
156 SysNotifyActionInvoked
157 )
158 except ValueError:
159 pass
160 return ret
62 161
63@DEPRECATED("1.8", "Use :py:func:`need_eldbus` for eldbus (v2) support. Old API is deprecated.") 162@DEPRECATED("1.8", "Use :py:func:`need_eldbus` for eldbus (v2) support. Old API is deprecated.")
64def need_e_dbus(): 163def need_e_dbus():
@@ -117,7 +216,12 @@ def need_ethumb():
117 :rtype: bool 216 :rtype: bool
118 217
119 """ 218 """
120 return bool(elm_need_ethumb()) 219 cdef bint ret = elm_need_ethumb()
220 try:
221 _event_mapping_register(ELM_ECORE_EVENT_ETHUMB_CONNECT, EthumbConnect)
222 except ValueError:
223 pass
224 return ret
121 225
122def need_web(): 226def need_web():
123 """Request that your elementary application needs web support 227 """Request that your elementary application needs web support
diff --git a/efl/elementary/need_cdef.pxi b/efl/elementary/need_cdef.pxi
index b8aef99..764aa2a 100644
--- a/efl/elementary/need_cdef.pxi
+++ b/efl/elementary/need_cdef.pxi
@@ -1,4 +1,27 @@
1cdef extern from "Elementary.h": 1cdef extern from "Elementary.h":
2 cpdef enum:
3 ELM_ECORE_EVENT_ETHUMB_CONNECT
4 ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED
5 ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED
6 ELM_EVENT_SYSTRAY_READY
7
8 ctypedef struct Elm_Sys_Notify_Notification_Closed:
9 unsigned int id # ID of the notification.
10 Elm_Sys_Notify_Closed_Reason reason # The Reason the notification was closed.
11
12 ctypedef struct Elm_Sys_Notify_Action_Invoked:
13 unsigned int id # ID of the notification.
14 char *action_key # The key of the action invoked. These match the keys sent over in the list of actions.
15
16 cpdef enum Elm_Sys_Notify_Closed_Reason:
17 ELM_SYS_NOTIFY_CLOSED_EXPIRED
18 ELM_SYS_NOTIFY_CLOSED_DISMISSED
19 ELM_SYS_NOTIFY_CLOSED_REQUESTED
20 ELM_SYS_NOTIFY_CLOSED_UNDEFINED
21 ctypedef enum Elm_Sys_Notify_Closed_Reason:
22 pass
23
24
2 Eina_Bool elm_need_efreet() 25 Eina_Bool elm_need_efreet()
3 Eina_Bool elm_need_systray() 26 Eina_Bool elm_need_systray()
4 Eina_Bool elm_need_sys_notify() 27 Eina_Bool elm_need_sys_notify()
diff --git a/examples/elementary/test_multibuttonentry.py b/examples/elementary/test_multibuttonentry.py
index ea365d7..e57a6cd 100644
--- a/examples/elementary/test_multibuttonentry.py
+++ b/examples/elementary/test_multibuttonentry.py
@@ -16,9 +16,15 @@ SCROLL_POLICY_VERT = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO
16 16
17counter = 0 17counter = 0
18 18
19def cb_item_selected(mbe, *args, **kwargs): 19def cb_item_selected(mbe, item):
20 # XXX: This gets called twice 20 print("ITEM SELECTED", item)
21 print(mbe) 21
22def cb_item_clicked(mbe, item):
23 print("ITEM CLICKED", item)
24
25def cb_item_longpressed(mbe, item):
26 print("ITEM LONGPRESSED", item)
27
22 28
23def cb_btn_item_prepend(btn, mbe): 29def cb_btn_item_prepend(btn, mbe):
24 global counter 30 global counter
@@ -75,6 +81,8 @@ def multibuttonentry_clicked(obj, item=None):
75 mbe = MultiButtonEntry(win, size_hint_align=FILL_BOTH, 81 mbe = MultiButtonEntry(win, size_hint_align=FILL_BOTH,
76 size_hint_weight=EXPAND_BOTH, text="To: ") 82 size_hint_weight=EXPAND_BOTH, text="To: ")
77 mbe.callback_item_selected_add(cb_item_selected) 83 mbe.callback_item_selected_add(cb_item_selected)
84 mbe.callback_item_clicked_add(cb_item_clicked)
85 mbe.callback_item_longpressed_add(cb_item_longpressed)
78 mbe.part_text_set("guide", "Tap to add recipient") 86 mbe.part_text_set("guide", "Tap to add recipient")
79 mbe.filter_append(cb_filter1) 87 mbe.filter_append(cb_filter1)
80 mbe.show() 88 mbe.show()