Elementary.object_item: Change ObjectItem.data to hold a dict (like Eo).
This may affect some cases where it was assumed to hold a tuple with args,kwargs. Dealing with the fallout was added as a TODO and the change documented in README.
This commit is contained in:
parent
944234bccd
commit
fc69997a75
2
README
2
README
|
@ -24,6 +24,8 @@ CHANGES FROM 1.7 to 1.8
|
||||||
* elm.domain_translatable_text_part_set => elm.domain_translatable_part_text_set
|
* elm.domain_translatable_text_part_set => elm.domain_translatable_part_text_set
|
||||||
* elm.Scroller.custom_widget_base_theme_set => elm.Layout.theme_set TODO is this right?
|
* elm.Scroller.custom_widget_base_theme_set => elm.Layout.theme_set TODO is this right?
|
||||||
* elm.notify.orient_set/get/prop removed => align_set (TODO)
|
* elm.notify.orient_set/get/prop removed => align_set (TODO)
|
||||||
|
* elm.ObjectItem.data changed to a dict (previously held args & kwargs)
|
||||||
|
|
||||||
* Many _set functions that would previously return status now instead raise
|
* Many _set functions that would previously return status now instead raise
|
||||||
an exception when the underlying C function returns failure:
|
an exception when the underlying C function returns failure:
|
||||||
|
|
||||||
|
|
5
TODO
5
TODO
|
@ -34,6 +34,11 @@ Elementary
|
||||||
* Unit tests, things like top_widget and getting child objects
|
* Unit tests, things like top_widget and getting child objects
|
||||||
can be done easily.
|
can be done easily.
|
||||||
* Fix Theme API, add a test
|
* Fix Theme API, add a test
|
||||||
|
* ObjectItem.data changed to dict (like in Eo). Find out what this affects
|
||||||
|
and document it.
|
||||||
|
* Item add methods (constructors) should be changed to have cb_args in a
|
||||||
|
single argument, not args, kwargs, and it should be assigned to
|
||||||
|
ObjectItem.data dict as necessary.
|
||||||
|
|
||||||
* New documentation images with the new default theme.
|
* New documentation images with the new default theme.
|
||||||
* Images missing in the documentation:
|
* Images missing in the documentation:
|
||||||
|
|
|
@ -69,6 +69,7 @@ cdef class ObjectItem(object):
|
||||||
object cb_func
|
object cb_func
|
||||||
tuple args
|
tuple args
|
||||||
dict kwargs
|
dict kwargs
|
||||||
|
readonly dict data
|
||||||
int _set_obj(self, Elm_Object_Item *item) except 0
|
int _set_obj(self, Elm_Object_Item *item) except 0
|
||||||
|
|
||||||
cpdef text_set(self, text)
|
cpdef text_set(self, text)
|
||||||
|
|
|
@ -31,8 +31,6 @@ from efl.utils.conversions cimport python_list_objects_to_eina_list, \
|
||||||
from object cimport Object
|
from object cimport Object
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
cdef class ObjectItem
|
|
||||||
|
|
||||||
cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL:
|
cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL:
|
||||||
if item is None or item.item is NULL:
|
if item is None or item.item is NULL:
|
||||||
raise TypeError("Invalid item!")
|
raise TypeError("Invalid item!")
|
||||||
|
@ -89,7 +87,17 @@ cdef void _object_item_callback(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
|
||||||
cdef class ObjectItem(object):
|
cdef class ObjectItem(object):
|
||||||
|
|
||||||
"""A generic item for the widgets."""
|
"""
|
||||||
|
|
||||||
|
A generic item for the widgets.
|
||||||
|
|
||||||
|
.. py:attribute:: data
|
||||||
|
|
||||||
|
:type: dict
|
||||||
|
|
||||||
|
A dictionary object that holds user data.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
# Notes to bindings' developers:
|
# Notes to bindings' developers:
|
||||||
# ==============================
|
# ==============================
|
||||||
|
@ -99,6 +107,9 @@ cdef class ObjectItem(object):
|
||||||
# a pointer to Elm_Object_Item.
|
# a pointer to Elm_Object_Item.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
def __cinit__(self):
|
||||||
|
self.data = dict()
|
||||||
|
|
||||||
def __dealloc__(self):
|
def __dealloc__(self):
|
||||||
if self.item != NULL:
|
if self.item != NULL:
|
||||||
elm_object_item_del_cb_set(self.item, NULL)
|
elm_object_item_del_cb_set(self.item, NULL)
|
||||||
|
@ -364,21 +375,6 @@ cdef class ObjectItem(object):
|
||||||
elm_object_item_access_info_set(self.item,
|
elm_object_item_access_info_set(self.item,
|
||||||
<const_char *>txt if txt is not None else NULL)
|
<const_char *>txt if txt is not None else NULL)
|
||||||
|
|
||||||
property data:
|
|
||||||
def __get__(self):
|
|
||||||
return (self.args, self.kwargs)
|
|
||||||
|
|
||||||
def __set__(self, data):
|
|
||||||
args, kwargs = data
|
|
||||||
self.args = args
|
|
||||||
self.kwargs = kwargs
|
|
||||||
|
|
||||||
def data_get(self):
|
|
||||||
return (self.args, self.kwargs)
|
|
||||||
def data_set(self, *args, **kwargs):
|
|
||||||
self.args = args
|
|
||||||
self.kwargs = kwargs
|
|
||||||
|
|
||||||
def signal_emit(self, emission, source):
|
def signal_emit(self, emission, source):
|
||||||
"""signal_emit(unicode emission, unicode source)
|
"""signal_emit(unicode emission, unicode source)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue