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:
Kai Huuhko 2013-11-02 02:05:48 +02:00
parent 944234bccd
commit fc69997a75
4 changed files with 22 additions and 18 deletions

2
README
View File

@ -24,6 +24,8 @@ CHANGES FROM 1.7 to 1.8
* 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.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
an exception when the underlying C function returns failure:

5
TODO
View File

@ -34,6 +34,11 @@ Elementary
* Unit tests, things like top_widget and getting child objects
can be done easily.
* 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.
* Images missing in the documentation:

View File

@ -69,6 +69,7 @@ cdef class ObjectItem(object):
object cb_func
tuple args
dict kwargs
readonly dict data
int _set_obj(self, Elm_Object_Item *item) except 0
cpdef text_set(self, text)

View File

@ -31,8 +31,6 @@ from efl.utils.conversions cimport python_list_objects_to_eina_list, \
from object cimport Object
import traceback
cdef class ObjectItem
cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL:
if item is None or item.item is NULL:
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):
"""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:
# ==============================
@ -99,6 +107,9 @@ cdef class ObjectItem(object):
# a pointer to Elm_Object_Item.
#
def __cinit__(self):
self.data = dict()
def __dealloc__(self):
if 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,
<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):
"""signal_emit(unicode emission, unicode source)