summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-11-02 02:05:48 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2013-11-02 02:05:48 +0200
commitfc69997a7525b60c3ae1501be0e23d1371bf7472 (patch)
treea0a8397f25136bd68829974ae93fc686e0b8cc81
parent944234bccdd02e53d14490373fa15930667bb50b (diff)
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.
-rw-r--r--README2
-rw-r--r--TODO5
-rw-r--r--efl/elementary/object_item.pxd1
-rw-r--r--efl/elementary/object_item.pyx32
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
24* elm.domain_translatable_text_part_set => elm.domain_translatable_part_text_set 24* elm.domain_translatable_text_part_set => elm.domain_translatable_part_text_set
25* elm.Scroller.custom_widget_base_theme_set => elm.Layout.theme_set TODO is this right? 25* elm.Scroller.custom_widget_base_theme_set => elm.Layout.theme_set TODO is this right?
26* elm.notify.orient_set/get/prop removed => align_set (TODO) 26* elm.notify.orient_set/get/prop removed => align_set (TODO)
27* elm.ObjectItem.data changed to a dict (previously held args & kwargs)
28
27* Many _set functions that would previously return status now instead raise 29* Many _set functions that would previously return status now instead raise
28 an exception when the underlying C function returns failure: 30 an exception when the underlying C function returns failure:
29 31
diff --git a/TODO b/TODO
index 9948894..7c62fca 100644
--- a/TODO
+++ b/TODO
@@ -34,6 +34,11 @@ Elementary
34* Unit tests, things like top_widget and getting child objects 34* Unit tests, things like top_widget and getting child objects
35 can be done easily. 35 can be done easily.
36* Fix Theme API, add a test 36* Fix Theme API, add a test
37* ObjectItem.data changed to dict (like in Eo). Find out what this affects
38 and document it.
39* Item add methods (constructors) should be changed to have cb_args in a
40 single argument, not args, kwargs, and it should be assigned to
41 ObjectItem.data dict as necessary.
37 42
38* New documentation images with the new default theme. 43* New documentation images with the new default theme.
39* Images missing in the documentation: 44* 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):
69 object cb_func 69 object cb_func
70 tuple args 70 tuple args
71 dict kwargs 71 dict kwargs
72 readonly dict data
72 int _set_obj(self, Elm_Object_Item *item) except 0 73 int _set_obj(self, Elm_Object_Item *item) except 0
73 74
74 cpdef text_set(self, text) 75 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, \
31from object cimport Object 31from object cimport Object
32import traceback 32import traceback
33 33
34cdef class ObjectItem
35
36cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL: 34cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL:
37 if item is None or item.item is NULL: 35 if item is None or item.item is NULL:
38 raise TypeError("Invalid item!") 36 raise TypeError("Invalid item!")
@@ -89,7 +87,17 @@ cdef void _object_item_callback(void *data, Evas_Object *obj, void *event_info)
89 87
90cdef class ObjectItem(object): 88cdef class ObjectItem(object):
91 89
92 """A generic item for the widgets.""" 90 """
91
92 A generic item for the widgets.
93
94 .. py:attribute:: data
95
96 :type: dict
97
98 A dictionary object that holds user data.
99
100 """
93 101
94 # Notes to bindings' developers: 102 # Notes to bindings' developers:
95 # ============================== 103 # ==============================
@@ -99,6 +107,9 @@ cdef class ObjectItem(object):
99 # a pointer to Elm_Object_Item. 107 # a pointer to Elm_Object_Item.
100 # 108 #
101 109
110 def __cinit__(self):
111 self.data = dict()
112
102 def __dealloc__(self): 113 def __dealloc__(self):
103 if self.item != NULL: 114 if self.item != NULL:
104 elm_object_item_del_cb_set(self.item, NULL) 115 elm_object_item_del_cb_set(self.item, NULL)
@@ -364,21 +375,6 @@ cdef class ObjectItem(object):
364 elm_object_item_access_info_set(self.item, 375 elm_object_item_access_info_set(self.item,
365 <const_char *>txt if txt is not None else NULL) 376 <const_char *>txt if txt is not None else NULL)
366 377
367 property data:
368 def __get__(self):
369 return (self.args, self.kwargs)
370
371 def __set__(self, data):
372 args, kwargs = data
373 self.args = args
374 self.kwargs = kwargs
375
376 def data_get(self):
377 return (self.args, self.kwargs)
378 def data_set(self, *args, **kwargs):
379 self.args = args
380 self.kwargs = kwargs
381
382 def signal_emit(self, emission, source): 378 def signal_emit(self, emission, source):
383 """signal_emit(unicode emission, unicode source) 379 """signal_emit(unicode emission, unicode source)
384 380