Merge branch 'master' into elmfusion

Conflicts:
	efl/elementary/__init__.pyx
	efl/elementary/colorselector.pxi
	efl/elementary/multibuttonentry.pxi
	efl/elementary/need.pxi
This commit is contained in:
Kai Huuhko 2015-04-24 15:59:11 +03:00
commit bd88b8845e
8 changed files with 186 additions and 143 deletions

View File

@ -322,10 +322,10 @@ cite, code, tt {
letter-spacing: -0.02em;
}
tt {
code, tt {
background-color: rgb(51,51,51); /*#f2f2f2*/
border: 1px solid rgb(32,32,32); /*#ddd*/
border-radius: 2px;
border-radius: 3px;
color: white; /*#333*/
padding: 1px;
}
@ -351,12 +351,12 @@ hr {
margin: 2em;
}
a tt {
a tt, a code{
border: 0;
color: rgb(200,200,170);
}
a tt:hover {
a tt:hover, a code:hover{
color: rgb(230,230,200);
}
@ -406,8 +406,8 @@ table td, table th {
div.admonition, div.warning {
font-size: 0.9em;
margin: 1em 0 1em 0;
border: 1px solid rgb(32,32,32); /*#86989B*/
border-radius: 2px;
border: 1px dashed rgb(32,32,32); /*#86989B*/
border-radius: 12px;
background-color: rgb(51,51,51); /*#f7f7f7*/
padding: 0;
}
@ -429,7 +429,7 @@ div.warning p.admonition-title {
}
div.warning {
border: 1px solid rgb(101,16,16); /*#940000*/
border-color: rgb(101,16,16); /*#940000*/
background-color: rgb(101,51,51); /*#FFCCCF*/
}
@ -506,11 +506,15 @@ dl.class {
}
dl.class > dt {
font-size: 20px;
font-size: 1.2em;
background-color: #333;
padding: 2px;
}
dl.class > dt em {
font-size: 0.8em;
}
dl.class dt{
border-bottom: 1px solid #333;
}

View File

@ -47,86 +47,6 @@ elm_log = add_logger("efl.elementary")
cdef int PY_EFL_ELM_LOG_DOMAIN = elm_log.eina_log_domain
cdef class EventSystrayReady(Event):
cdef int _set_obj(self, void *o) except 0:
return 1
def __repr__(self):
return "<%s()>" % (self.__class__.__name__,)
cdef class SysNotifyNotificationClosed(Event):
cdef Elm_Sys_Notify_Notification_Closed *obj
cdef int _set_obj(self, void *o) except 0:
self.obj = <Elm_Sys_Notify_Notification_Closed*>o
return 1
def __repr__(self):
# TODO: int -> string for 'reason'
return "<%s(id=%d, reason=%s)>" % \
(type(self).__name__, self.id, self.reason)
property id:
"""ID of the notification.
:type: int
"""
def __get__(self):
return self.obj.id
property reason:
"""The Reason the notification was closed.
:type: :ref:`Elm_Sys_Notify_Closed_Reason`
"""
def __get__(self):
return self.obj.reason
cdef class SysNotifyActionInvoked(Event):
cdef Elm_Sys_Notify_Action_Invoked *obj
cdef int _set_obj(self, void *o) except 0:
self.obj = <Elm_Sys_Notify_Action_Invoked*>o
return 1
def __repr__(self):
return "<%s(id=%d, action_key=%s)>" % \
(type(self).__name__, self.id, self.action_key)
property id:
"""ID of the notification.
:type: int
"""
def __get__(self):
return self.obj.id
property action_key:
"""The key of the action invoked. These match the keys sent over in the
list of actions.
:type: string
"""
def __get__(self):
return _touni(self.obj.action_key)
cdef class EthumbConnect(Event):
cdef int _set_obj(self, void *o) except 0:
return 1
def __repr__(self):
return "<%s()>" % (self.__class__.__name__,)
cdef class ConfigAllChanged(Event):
cdef int _set_obj(self, void *o) except 0:
return 1
@ -208,39 +128,7 @@ def init():
argv[i] = <char *>PyMem_Malloc(arg_len + 1)
memcpy(argv[i], arg, arg_len + 1)
ret = elm_init(argc, argv)
if ret != 1:
return ret
if elm_need_ethumb():
_event_mapping_register(ELM_ECORE_EVENT_ETHUMB_CONNECT, EthumbConnect)
else:
EINA_LOG_DOM_WARN(PY_EFL_ELM_LOG_DOMAIN, "Ethumb not available", NULL)
_event_mapping_register(ELM_EVENT_CONFIG_ALL_CHANGED, ConfigAllChanged)
_event_mapping_register(ELM_EVENT_POLICY_CHANGED, PolicyChanged)
_event_mapping_register(ELM_EVENT_PROCESS_BACKGROUND, ProcessBackground)
_event_mapping_register(ELM_EVENT_PROCESS_FOREGROUND, ProcessForeground)
if elm_need_systray():
_event_mapping_register(ELM_EVENT_SYSTRAY_READY, EventSystrayReady)
else:
EINA_LOG_DOM_WARN(PY_EFL_ELM_LOG_DOMAIN, "Systray not available", NULL)
if elm_need_sys_notify():
_event_mapping_register(
ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED,
SysNotifyNotificationClosed
)
_event_mapping_register(
ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED,
SysNotifyActionInvoked
)
else:
EINA_LOG_DOM_WARN(PY_EFL_ELM_LOG_DOMAIN, "Sys notify not available", NULL)
return ret
return elm_init(argc, argv)
def shutdown():
"""Shut down Elementary
@ -272,6 +160,11 @@ def shutdown():
init()
atexit.register(shutdown)
_event_mapping_register(ELM_EVENT_CONFIG_ALL_CHANGED, ConfigAllChanged)
_event_mapping_register(ELM_EVENT_POLICY_CHANGED, PolicyChanged)
_event_mapping_register(ELM_EVENT_PROCESS_BACKGROUND, ProcessBackground)
_event_mapping_register(ELM_EVENT_PROCESS_FOREGROUND, ProcessForeground)
cdef void py_elm_sys_notify_send_cb(void *data, unsigned int id):
cdef object func, func_data

View File

@ -18,6 +18,7 @@
include "colorselector_cdef.pxi"
cdef class ColorselectorPaletteItem(ObjectItem):
"""
@ -243,6 +244,19 @@ cdef class Colorselector(LayoutClass):
def callback_changed_del(self, func):
self._callback_del("changed", func)
def callback_changed_user_add(self, func, *args, **kwargs):
"""When the color value is changed by the user
.. versionadded:: 1.14
"""
self._callback_add("changed,user", func, args, kwargs)
def callback_changed_user_del(self, func):
"""
.. versionadded:: 1.14
"""
self._callback_del("changed,user", func)
def callback_color_item_selected_add(self, func, *args, **kwargs):
"""When user clicks on color item. The event_info parameter of the
callback will be the selected color item."""

View File

@ -82,14 +82,6 @@ cdef extern from "Elementary.h":
ctypedef enum Elm_Policy_Throttle:
pass
cpdef enum Elm_Sys_Notify_Closed_Reason:
ELM_SYS_NOTIFY_CLOSED_EXPIRED
ELM_SYS_NOTIFY_CLOSED_DISMISSED
ELM_SYS_NOTIFY_CLOSED_REQUESTED
ELM_SYS_NOTIFY_CLOSED_UNDEFINED
ctypedef enum Elm_Sys_Notify_Closed_Reason:
pass
cpdef enum Elm_Sys_Notify_Urgency:
ELM_SYS_NOTIFY_URGENCY_LOW
ELM_SYS_NOTIFY_URGENCY_NORMAL
@ -197,14 +189,6 @@ cdef extern from "Elementary.h":
# sys_notify.h
ctypedef void (*Elm_Sys_Notify_Send_Cb)(void *data, unsigned int id)
ctypedef struct Elm_Sys_Notify_Notification_Closed:
unsigned int id # ID of the notification.
Elm_Sys_Notify_Closed_Reason reason # The Reason the notification was closed.
ctypedef struct Elm_Sys_Notify_Action_Invoked:
unsigned int id # ID of the notification.
char *action_key # The key of the action invoked. These match the keys sent over in the list of actions.
void elm_sys_notify_close(unsigned int id)
void elm_sys_notify_send( unsigned int replaces_id,
const char *icon,

View File

@ -17,6 +17,7 @@
include "multibuttonentry_cdef.pxi"
cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, \
const char *item_label, void *item_data, void *data) with gil:
@ -459,6 +460,18 @@ cdef class MultiButtonEntry(Object):
def callback_item_clicked_del(self, func):
self._callback_del_full("item,clicked", _cb_object_item_conv, func)
def callback_item_longpressed_add(self, func, *args, **kwargs):
"""
.. versionadded:: 1.14
"""
self._callback_add_full("item,longpressed", _cb_object_item_conv, func, args, kwargs)
def callback_item_longpressed_del(self, func):
"""
.. versionadded:: 1.14
"""
self._callback_del_full("item,longpressed", _cb_object_item_conv, func)
def callback_clicked_add(self, func, *args, **kwargs):
self._callback_add("clicked", func, args, kwargs)

View File

@ -17,6 +17,86 @@
include "need_cdef.pxi"
cdef class SysNotifyNotificationClosed(Event):
cdef Elm_Sys_Notify_Notification_Closed *obj
cdef int _set_obj(self, void *o) except 0:
self.obj = <Elm_Sys_Notify_Notification_Closed*>o
return 1
def __repr__(self):
# TODO: int -> string for 'reason'
return "<%s(id=%d, reason=%s)>" % \
(type(self).__name__, self.id, self.reason)
property id:
"""ID of the notification.
:type: int
"""
def __get__(self):
return self.obj.id
property reason:
"""The Reason the notification was closed.
:type: :ref:`Elm_Sys_Notify_Closed_Reason`
"""
def __get__(self):
return self.obj.reason
cdef class SysNotifyActionInvoked(Event):
cdef Elm_Sys_Notify_Action_Invoked *obj
cdef int _set_obj(self, void *o) except 0:
self.obj = <Elm_Sys_Notify_Action_Invoked*>o
return 1
def __repr__(self):
return "<%s(id=%d, action_key=%s)>" % \
(type(self).__name__, self.id, self.action_key)
property id:
"""ID of the notification.
:type: int
"""
def __get__(self):
return self.obj.id
property action_key:
"""The key of the action invoked. These match the keys sent over in the
list of actions.
:type: string
"""
def __get__(self):
return _touni(self.obj.action_key)
cdef class EthumbConnect(Event):
cdef int _set_obj(self, void *o) except 0:
return 1
def __repr__(self):
return "<%s()>" % (self.__class__.__name__,)
cdef class EventSystrayReady(Event):
cdef int _set_obj(self, void *o) except 0:
return 1
def __repr__(self):
return "<%s()>" % (self.__class__.__name__,)
def need_efreet():
"""Request that your elementary application needs Efreet
@ -43,7 +123,13 @@ def need_systray():
.. versionadded:: 1.8
"""
return bool(elm_need_systray())
cdef bint ret = elm_need_systray()
if ret:
try:
_event_mapping_register(ELM_EVENT_SYSTRAY_READY, EventSystrayReady)
except ValueError:
pass
return ret
def need_sys_notify():
"""Request that your elementary application needs Elm_Sys_Notify
@ -58,7 +144,20 @@ def need_sys_notify():
.. versionadded:: 1.8
"""
return bool(elm_need_sys_notify())
cdef bint ret = elm_need_sys_notify()
if ret:
try:
_event_mapping_register(
ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED,
SysNotifyNotificationClosed
)
_event_mapping_register(
ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED,
SysNotifyActionInvoked
)
except ValueError:
pass
return ret
@DEPRECATED("1.8", "Use :py:func:`need_eldbus` for eldbus (v2) support. Old API is deprecated.")
def need_e_dbus():
@ -117,7 +216,12 @@ def need_ethumb():
:rtype: bool
"""
return bool(elm_need_ethumb())
cdef bint ret = elm_need_ethumb()
try:
_event_mapping_register(ELM_ECORE_EVENT_ETHUMB_CONNECT, EthumbConnect)
except ValueError:
pass
return ret
def need_web():
"""Request that your elementary application needs web support

View File

@ -1,4 +1,27 @@
cdef extern from "Elementary.h":
cpdef enum:
ELM_ECORE_EVENT_ETHUMB_CONNECT
ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED
ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED
ELM_EVENT_SYSTRAY_READY
ctypedef struct Elm_Sys_Notify_Notification_Closed:
unsigned int id # ID of the notification.
Elm_Sys_Notify_Closed_Reason reason # The Reason the notification was closed.
ctypedef struct Elm_Sys_Notify_Action_Invoked:
unsigned int id # ID of the notification.
char *action_key # The key of the action invoked. These match the keys sent over in the list of actions.
cpdef enum Elm_Sys_Notify_Closed_Reason:
ELM_SYS_NOTIFY_CLOSED_EXPIRED
ELM_SYS_NOTIFY_CLOSED_DISMISSED
ELM_SYS_NOTIFY_CLOSED_REQUESTED
ELM_SYS_NOTIFY_CLOSED_UNDEFINED
ctypedef enum Elm_Sys_Notify_Closed_Reason:
pass
Eina_Bool elm_need_efreet()
Eina_Bool elm_need_systray()
Eina_Bool elm_need_sys_notify()

View File

@ -16,9 +16,15 @@ SCROLL_POLICY_VERT = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO
counter = 0
def cb_item_selected(mbe, *args, **kwargs):
# XXX: This gets called twice
print(mbe)
def cb_item_selected(mbe, item):
print("ITEM SELECTED", item)
def cb_item_clicked(mbe, item):
print("ITEM CLICKED", item)
def cb_item_longpressed(mbe, item):
print("ITEM LONGPRESSED", item)
def cb_btn_item_prepend(btn, mbe):
global counter
@ -75,6 +81,8 @@ def multibuttonentry_clicked(obj, item=None):
mbe = MultiButtonEntry(win, size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_BOTH, text="To: ")
mbe.callback_item_selected_add(cb_item_selected)
mbe.callback_item_clicked_add(cb_item_clicked)
mbe.callback_item_longpressed_add(cb_item_longpressed)
mbe.part_text_set("guide", "Tap to add recipient")
mbe.filter_append(cb_filter1)
mbe.show()