kuuko pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=fc69997a7525b60c3ae1501be0e23d1371bf7472

commit fc69997a7525b60c3ae1501be0e23d1371bf7472
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Sat Nov 2 02:05:48 2013 +0200

    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.
---
 README                         |  2 ++
 TODO                           |  5 +++++
 efl/elementary/object_item.pxd |  1 +
 efl/elementary/object_item.pyx | 32 ++++++++++++++------------------
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/README b/README
index 84c3a28..204ce2e 100644
--- a/README
+++ b/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.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:
 
diff --git a/TODO b/TODO
index 9948894..7c62fca 100644
--- a/TODO
+++ b/TODO
@@ -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:
diff --git a/efl/elementary/object_item.pxd b/efl/elementary/object_item.pxd
index 6d764f2..a89aa76 100644
--- a/efl/elementary/object_item.pxd
+++ b/efl/elementary/object_item.pxd
@@ -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)
diff --git a/efl/elementary/object_item.pyx b/efl/elementary/object_item.pyx
index 3f69d13..0f75c3f 100644
--- a/efl/elementary/object_item.pyx
+++ b/efl/elementary/object_item.pyx
@@ -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)
 

-- 


Reply via email to