Fix implementation of elm.GenlistItem.all_contents_unset()
the old implementation was not working at all, so I marked it @since 1.18 also added a test for it
This commit is contained in:
parent
9381d46765
commit
99113cd990
|
@ -486,10 +486,23 @@ cdef class GenlistItem(ObjectItem):
|
|||
item, meaning that they will no longer be managed by genlist and are
|
||||
floating "orphans" that can be re-used elsewhere if the user wants to.
|
||||
|
||||
:return: The list of now orphans objects
|
||||
:rtype: list
|
||||
|
||||
.. versionadded:: 1.18
|
||||
|
||||
.. warning:: Don't forget to do something with the returned objects,
|
||||
they are hidden in the canvas, but still alive. You should
|
||||
at least delete them if you don't need to reuse.
|
||||
|
||||
"""
|
||||
cdef Eina_List *lst
|
||||
elm_genlist_item_all_contents_unset(self.item, &lst)
|
||||
return _object_item_list_to_python(lst)
|
||||
cdef:
|
||||
Eina_List *l = NULL
|
||||
list ret
|
||||
elm_genlist_item_all_contents_unset(self.item, &l)
|
||||
ret = eina_list_objects_to_python_list(l)
|
||||
eina_list_free(l)
|
||||
return ret
|
||||
|
||||
def promote(self):
|
||||
"""Promote an item to the top of the list"""
|
||||
|
|
|
@ -178,6 +178,25 @@ def test_genlist_1(parent):
|
|||
hbox.pack_end(bt)
|
||||
bt.show()
|
||||
|
||||
# item content unset
|
||||
def content_unset_clicked(bt, gl):
|
||||
item = gl.selected_item
|
||||
if item is None:
|
||||
print("You must select an item first!")
|
||||
else:
|
||||
contents = item.all_contents_unset()
|
||||
print(contents)
|
||||
for obj in contents:
|
||||
obj.pos = (200, 0)
|
||||
obj.show()
|
||||
# Now all the unsetted objects are orphan in the canvas,
|
||||
# the user should do something with them
|
||||
|
||||
bt = Button(win, text="Item content unset")
|
||||
bt.callback_clicked_add(content_unset_clicked, gl)
|
||||
hbox.pack_end(bt)
|
||||
bt.show()
|
||||
|
||||
# show the window
|
||||
win.show()
|
||||
|
||||
|
|
Loading…
Reference in New Issue