Elementary: Split genlist into more easily manageable files, it still
compiles into one module.
This commit is contained in:
parent
dc1a54dec3
commit
d2a6f8a94c
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,781 @@
|
||||||
|
cdef class GenlistItem(ObjectItem):
|
||||||
|
|
||||||
|
"""An item for the :py:class:`Genlist` widget."""
|
||||||
|
|
||||||
|
cdef:
|
||||||
|
Elm_Genlist_Item_Class *item_class
|
||||||
|
Elm_Object_Item *parent_item
|
||||||
|
int flags
|
||||||
|
Evas_Smart_Cb cb
|
||||||
|
object comparison_func
|
||||||
|
|
||||||
|
def __init__( self,
|
||||||
|
GenlistItemClass item_class not None,
|
||||||
|
item_data=None,
|
||||||
|
GenlistItem parent_item=None,
|
||||||
|
Elm_Genlist_Item_Type flags=enums.ELM_GENLIST_ITEM_NONE,
|
||||||
|
func=None,
|
||||||
|
func_data=None):
|
||||||
|
"""Create a new GenlistItem.
|
||||||
|
|
||||||
|
:param item_data: Data that defines the model of this row.
|
||||||
|
This value will be given to methods of ``item_class`` such as
|
||||||
|
:py:func:`GenlistItemClass.text_get()`.
|
||||||
|
|
||||||
|
:param item_class: a valid instance that defines the behavior of this
|
||||||
|
row.
|
||||||
|
:type item_class: :py:class:`GenlistItemClass`
|
||||||
|
|
||||||
|
:param parent_item: If this is a tree child, then the
|
||||||
|
parent item must be given here, otherwise it may be
|
||||||
|
None. The parent must have the flag
|
||||||
|
``ELM_GENLIST_ITEM_SUBITEMS`` set.
|
||||||
|
:type parent_item: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
:param flags: defines special behavior of this item:
|
||||||
|
:type flags: :ref:`Elm_Genlist_Item_Type`
|
||||||
|
|
||||||
|
:param func: if not None, this must be a callable to be
|
||||||
|
called back when the item is selected. The function
|
||||||
|
signature is::
|
||||||
|
|
||||||
|
func(item, obj, item_data)
|
||||||
|
|
||||||
|
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||||
|
that represents this item, and ``item_data`` is the
|
||||||
|
value given as parameter to this function.
|
||||||
|
|
||||||
|
:param func_data: This value will be passed to the callback.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.item_class = &item_class.cls
|
||||||
|
|
||||||
|
self.parent_item = _object_item_from_python(parent_item) if parent_item is not None else NULL
|
||||||
|
|
||||||
|
self.flags = flags
|
||||||
|
|
||||||
|
if func is not None:
|
||||||
|
if not callable(func):
|
||||||
|
raise TypeError("func is not None or callable")
|
||||||
|
self.cb = _py_elm_genlist_item_func
|
||||||
|
|
||||||
|
self.params = (item_class, item_data, func, func_data)
|
||||||
|
|
||||||
|
cdef int _set_obj(self, Elm_Object_Item *item, params=None) except 0:
|
||||||
|
assert self.item == NULL, "Object must be clean"
|
||||||
|
self.item = item
|
||||||
|
Py_INCREF(self)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
cdef void _unset_obj(self):
|
||||||
|
assert self.item != NULL, "Object must wrap something"
|
||||||
|
self.item = NULL
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "%s(item_class=%s, func=%s, item_data=%s)" % \
|
||||||
|
(self.__class__.__name__,
|
||||||
|
self.params[0].__class__.__name__,
|
||||||
|
self.params[2],
|
||||||
|
self.params[1])
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return ("%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
|
||||||
|
"item_class=%s, func=%s, item_data=%r)") % \
|
||||||
|
(self.__class__.__name__,
|
||||||
|
<unsigned long><void*>self,
|
||||||
|
PY_REFCOUNT(self),
|
||||||
|
<unsigned long>self.item,
|
||||||
|
self.params[0].__class__.__name__,
|
||||||
|
self.params[2],
|
||||||
|
self.params[1])
|
||||||
|
|
||||||
|
def append_to(self, GenlistWidget genlist not None):
|
||||||
|
"""append_to(Genlist genlist) -> GenlistItem
|
||||||
|
|
||||||
|
Append a new item (add as last row) to this genlist.
|
||||||
|
|
||||||
|
:param genlist: The Genlist upon which this item is to be appended.
|
||||||
|
:type genlist: :py:class:`Genlist`
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
cdef Elm_Object_Item *item
|
||||||
|
|
||||||
|
item = elm_genlist_item_append( genlist.obj,
|
||||||
|
self.item_class,
|
||||||
|
<void*>self,
|
||||||
|
self.parent_item,
|
||||||
|
<Elm_Genlist_Item_Type>self.flags,
|
||||||
|
self.cb,
|
||||||
|
<void*>self)
|
||||||
|
|
||||||
|
if item is not NULL:
|
||||||
|
self._set_obj(item)
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
Py_DECREF(self)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def prepend_to(self, GenlistWidget genlist not None):
|
||||||
|
"""prepend_to(Genlist genlist) -> GenlistItem
|
||||||
|
|
||||||
|
Prepend a new item (add as first row) to this Genlist.
|
||||||
|
|
||||||
|
:param genlist: The Genlist upon which this item is to be prepended.
|
||||||
|
:type genlist: :py:class:`Genlist`
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
cdef Elm_Object_Item *item
|
||||||
|
|
||||||
|
item = elm_genlist_item_prepend(genlist.obj,
|
||||||
|
self.item_class,
|
||||||
|
<void*>self,
|
||||||
|
self.parent_item,
|
||||||
|
<Elm_Genlist_Item_Type>self.flags,
|
||||||
|
self.cb,
|
||||||
|
<void*>self)
|
||||||
|
|
||||||
|
if item is not NULL:
|
||||||
|
self._set_obj(item)
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
Py_DECREF(self)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def insert_before(self, GenlistItem before_item=None):
|
||||||
|
"""insert_before(GenlistItem before_item=None) -> GenlistItem
|
||||||
|
|
||||||
|
Insert a new item (row) before another item in this genlist.
|
||||||
|
|
||||||
|
:param before_item: a reference item to use, the new item
|
||||||
|
will be inserted before it.
|
||||||
|
:type before_item: :py:class:`GenlistItem`
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
cdef Elm_Object_Item *item, *before
|
||||||
|
|
||||||
|
genlist = before_item.widget
|
||||||
|
before = _object_item_from_python(before_item)
|
||||||
|
|
||||||
|
item = elm_genlist_item_insert_before( <Evas_Object *>genlist.obj,
|
||||||
|
self.item_class,
|
||||||
|
<void*>self,
|
||||||
|
self.parent_item,
|
||||||
|
before,
|
||||||
|
<Elm_Genlist_Item_Type>self.flags,
|
||||||
|
self.cb,
|
||||||
|
<void*>self)
|
||||||
|
|
||||||
|
if item is not NULL:
|
||||||
|
self._set_obj(item)
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
Py_DECREF(self)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def insert_after(self, GenlistItem after_item=None):
|
||||||
|
"""insert_after(GenlistItem after_item=None) -> GenlistItem
|
||||||
|
|
||||||
|
Insert a new item (row) after another item in this genlist.
|
||||||
|
|
||||||
|
:param after_item: a reference item to use, the new item
|
||||||
|
will be inserted after it.
|
||||||
|
:type after_item: :py:class:`GenlistItem`
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
cdef Elm_Object_Item *item, *after
|
||||||
|
|
||||||
|
genlist = after_item.widget
|
||||||
|
after = _object_item_from_python(after_item)
|
||||||
|
|
||||||
|
item = elm_genlist_item_insert_after( <Evas_Object *>genlist.obj,
|
||||||
|
self.item_class,
|
||||||
|
<void*>self,
|
||||||
|
self.parent_item,
|
||||||
|
after,
|
||||||
|
<Elm_Genlist_Item_Type>self.flags,
|
||||||
|
self.cb,
|
||||||
|
<void*>self)
|
||||||
|
|
||||||
|
if item is not NULL:
|
||||||
|
self._set_obj(item)
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
Py_DECREF(self)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def sorted_insert(self, GenlistWidget genlist not None, comparison_func):
|
||||||
|
"""sorted_insert(Genlist genlist, comparison_func) -> GenlistItem
|
||||||
|
|
||||||
|
Insert a new item into the sorted genlist object
|
||||||
|
|
||||||
|
:param genlist: The Genlist object
|
||||||
|
:type genlist: :py:class:`Genlist`
|
||||||
|
:param comparison_func: The function called for the sort.
|
||||||
|
This must be a callable and will be called
|
||||||
|
to insert the item in the right position. The two arguments passed
|
||||||
|
are two :py:class:`GenlistItem` to compare. The function must return
|
||||||
|
1 if ``item1`` comes before ``item2``, 0 if the two items
|
||||||
|
are equal or -1 otherwise.
|
||||||
|
Signature is::
|
||||||
|
|
||||||
|
func(item1, item2)->int
|
||||||
|
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
This inserts an item in the genlist based on user defined comparison
|
||||||
|
function. The two arguments passed to the function are genlist items
|
||||||
|
to compare.
|
||||||
|
|
||||||
|
"""
|
||||||
|
cdef Elm_Object_Item *item
|
||||||
|
|
||||||
|
if comparison_func is not None:
|
||||||
|
if not callable(comparison_func):
|
||||||
|
raise TypeError("func is not None or callable")
|
||||||
|
self.comparison_func = comparison_func
|
||||||
|
|
||||||
|
item = elm_genlist_item_sorted_insert( <Evas_Object *>genlist.obj,
|
||||||
|
self.item_class,
|
||||||
|
<void*>self,
|
||||||
|
self.parent_item,
|
||||||
|
<Elm_Genlist_Item_Type>self.flags,
|
||||||
|
_py_elm_genlist_compare_func,
|
||||||
|
self.cb,
|
||||||
|
<void*>self)
|
||||||
|
|
||||||
|
if item is not NULL:
|
||||||
|
self._set_obj(item)
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
Py_DECREF(self)
|
||||||
|
return None
|
||||||
|
|
||||||
|
property data:
|
||||||
|
"""User data for the item."""
|
||||||
|
def __get__(self):
|
||||||
|
return self.params[1]
|
||||||
|
|
||||||
|
def data_get(self):
|
||||||
|
return self.params[1]
|
||||||
|
|
||||||
|
property next:
|
||||||
|
"""This returns the item placed after the ``item``, on the container
|
||||||
|
genlist.
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`prev`
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_item_next_get(self.item))
|
||||||
|
|
||||||
|
def next_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_item_next_get(self.item))
|
||||||
|
|
||||||
|
property prev:
|
||||||
|
"""This returns the item placed before the ``item``, on the container
|
||||||
|
genlist.
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`next`
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_item_prev_get(self.item))
|
||||||
|
|
||||||
|
def prev_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_item_prev_get(self.item))
|
||||||
|
|
||||||
|
property selected:
|
||||||
|
"""This sets the selected state of an item. If multi selection is
|
||||||
|
not enabled on the containing genlist and ``selected`` is ``True``,
|
||||||
|
any other previously selected items will get unselected in favor of
|
||||||
|
this new one.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_item_selected_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def __set__(self, bint selected):
|
||||||
|
elm_genlist_item_selected_set(self.item, selected)
|
||||||
|
|
||||||
|
def selected_set(self, bint selected):
|
||||||
|
elm_genlist_item_selected_set(self.item, selected)
|
||||||
|
def selected_get(self):
|
||||||
|
cdef bint ret = elm_genlist_item_selected_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def show(self, scrollto_type = enums.ELM_GENLIST_ITEM_SCROLLTO_IN):
|
||||||
|
"""show(int scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN)
|
||||||
|
|
||||||
|
This causes genlist to jump to the item and show it (by
|
||||||
|
jumping to that position), if it is not fully visible.
|
||||||
|
|
||||||
|
:type: :ref:`Elm_Genlist_Item_Scrollto_Type`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`bring_in()`
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_show(self.item, scrollto_type)
|
||||||
|
|
||||||
|
def bring_in(self, scrollto_type = enums.ELM_GENLIST_ITEM_SCROLLTO_IN):
|
||||||
|
"""bring_in(int scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN)
|
||||||
|
|
||||||
|
This causes genlist to jump to the item and show it (by
|
||||||
|
animatedly scrolling), if it is not fully visible.
|
||||||
|
This may use animation and take a some time to do so.
|
||||||
|
|
||||||
|
:type: :ref:`Elm_Genlist_Item_Scrollto_Type`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`show()`
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_bring_in(self.item, scrollto_type)
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
"""update()
|
||||||
|
|
||||||
|
This updates an item by calling all the item class functions again
|
||||||
|
to get the contents, texts and states. Use this when the original
|
||||||
|
item data has changed and the changes are desired to be reflected.
|
||||||
|
|
||||||
|
Use elm_genlist_realized_items_update() to update all already realized
|
||||||
|
items.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`Genlist.realized_items_update()`
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_update(self.item)
|
||||||
|
|
||||||
|
def item_class_update(self, GenlistItemClass itc not None):
|
||||||
|
"""This sets another class of the item, changing the way that it is
|
||||||
|
displayed. After changing the item class, elm_genlist_item_update() is
|
||||||
|
called on the item.
|
||||||
|
|
||||||
|
:type itc: :py:class:`GenlistItemClass`
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_item_class_update(self.item, &itc.cls)
|
||||||
|
|
||||||
|
#TODO: def item_class_get(self):
|
||||||
|
"""This returns the Genlist_Item_Class for the given item. It can be
|
||||||
|
used to examine the function pointers and item_style.
|
||||||
|
|
||||||
|
"""
|
||||||
|
#return elm_genlist_item_item_class_get(self.item)
|
||||||
|
|
||||||
|
property index:
|
||||||
|
"""Get the index of the item. It is only valid once displayed.
|
||||||
|
|
||||||
|
:type: int
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_item_index_get(self.item)
|
||||||
|
|
||||||
|
def index_get(self):
|
||||||
|
return elm_genlist_item_index_get(self.item)
|
||||||
|
|
||||||
|
def tooltip_text_set(self, text):
|
||||||
|
"""tooltip_text_set(unicode text)
|
||||||
|
|
||||||
|
Set the text to be shown in the tooltip object
|
||||||
|
|
||||||
|
Setup the text as tooltip object. The object can have only one
|
||||||
|
tooltip, so any previous tooltip data is removed.
|
||||||
|
Internally, this method calls :py:func:`tooltip_content_cb_set`
|
||||||
|
|
||||||
|
"""
|
||||||
|
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
|
||||||
|
elm_genlist_item_tooltip_text_set(self.item,
|
||||||
|
<const_char *>text if text is not None else NULL)
|
||||||
|
|
||||||
|
def tooltip_content_cb_set(self, func, *args, **kargs):
|
||||||
|
"""tooltip_content_cb_set(func, *args, **kargs)
|
||||||
|
|
||||||
|
Set the content to be shown in the tooltip object
|
||||||
|
|
||||||
|
Setup the tooltip to object. The object can have only one tooltip,
|
||||||
|
so any previews tooltip data is removed. ``func(args,kargs)`` will
|
||||||
|
be called every time that need show the tooltip and it should return
|
||||||
|
a valid Evas_Object. This object is then managed fully by tooltip
|
||||||
|
system and is deleted when the tooltip is gone.
|
||||||
|
|
||||||
|
:param func: Function to be create tooltip content, called when
|
||||||
|
need show tooltip.
|
||||||
|
|
||||||
|
"""
|
||||||
|
if not callable(func):
|
||||||
|
raise TypeError("func must be callable")
|
||||||
|
|
||||||
|
cdef void *cbdata
|
||||||
|
|
||||||
|
data = (func, self, args, kargs)
|
||||||
|
Py_INCREF(data)
|
||||||
|
cbdata = <void *>data
|
||||||
|
elm_genlist_item_tooltip_content_cb_set(self.item,
|
||||||
|
_tooltip_item_content_create,
|
||||||
|
cbdata,
|
||||||
|
_tooltip_item_data_del_cb)
|
||||||
|
|
||||||
|
def tooltip_unset(self):
|
||||||
|
"""tooltip_unset()
|
||||||
|
|
||||||
|
Unset tooltip from object
|
||||||
|
|
||||||
|
Remove tooltip from object. If used the :py:func:`tooltip_text_set`
|
||||||
|
the internal copy of label will be removed correctly. If used
|
||||||
|
:py:func:`tooltip_content_cb_set`, the data will be unreferred but
|
||||||
|
no freed.
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_tooltip_unset(self.item)
|
||||||
|
|
||||||
|
property tooltip_style:
|
||||||
|
"""Tooltips can have **alternate styles** to be displayed on,
|
||||||
|
which are defined by the theme set on Elementary. This function
|
||||||
|
works analogously as elm_object_tooltip_style_set(), but here
|
||||||
|
applied only to genlist item objects. The default style for
|
||||||
|
tooltips is ``"default"``.
|
||||||
|
|
||||||
|
.. note:: before you set a style you should define a tooltip with
|
||||||
|
elm_genlist_item_tooltip_content_cb_set() or
|
||||||
|
elm_genlist_item_tooltip_text_set()
|
||||||
|
|
||||||
|
:type: string
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, style):
|
||||||
|
self.tooltip_style_set(style)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return self.tooltip_style_get()
|
||||||
|
|
||||||
|
cpdef tooltip_style_set(self, style=None):
|
||||||
|
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
|
||||||
|
elm_genlist_item_tooltip_style_set(self.item,
|
||||||
|
<const_char *>style if style is not None else NULL)
|
||||||
|
cpdef tooltip_style_get(self):
|
||||||
|
return _ctouni(elm_genlist_item_tooltip_style_get(self.item))
|
||||||
|
|
||||||
|
property tooltip_window_mode:
|
||||||
|
"""This property allows a tooltip to expand beyond its parent window's canvas.
|
||||||
|
It will instead be limited only by the size of the display.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
:raise RuntimeError: when setting the mode fails
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, disable):
|
||||||
|
self.tooltip_window_mode_set(disable)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return self.tooltip_window_mode_get()
|
||||||
|
|
||||||
|
cpdef tooltip_window_mode_set(self, disable):
|
||||||
|
if not elm_genlist_item_tooltip_window_mode_set(self.item, disable):
|
||||||
|
raise RuntimeError("Setting tooltip_window_mode failed")
|
||||||
|
cpdef tooltip_window_mode_get(self):
|
||||||
|
return bool(elm_genlist_item_tooltip_window_mode_get(self.item))
|
||||||
|
|
||||||
|
property cursor:
|
||||||
|
"""Set the cursor that will be displayed when mouse is over the
|
||||||
|
item. The item can have only one cursor set to it, so if
|
||||||
|
this function is called twice for an item, the previous set
|
||||||
|
will be unset.
|
||||||
|
|
||||||
|
:type: unicode
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, cursor):
|
||||||
|
self.cursor_set(cursor)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return self.cursor_get()
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self.cursor_unset()
|
||||||
|
|
||||||
|
cpdef cursor_set(self, cursor):
|
||||||
|
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
|
||||||
|
elm_genlist_item_cursor_set(self.item,
|
||||||
|
<const_char *>cursor if cursor is not None else NULL)
|
||||||
|
cpdef cursor_get(self):
|
||||||
|
return _ctouni(elm_genlist_item_cursor_get(self.item))
|
||||||
|
cpdef cursor_unset(self):
|
||||||
|
elm_genlist_item_cursor_unset(self.item)
|
||||||
|
|
||||||
|
property cursor_style:
|
||||||
|
"""Sets a different style for this object cursor.
|
||||||
|
|
||||||
|
.. note:: before you set a style you should define a cursor with
|
||||||
|
elm_genlist_item_cursor_set()
|
||||||
|
|
||||||
|
:type: unicode
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, style):
|
||||||
|
self.cursor_style_set(style)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return self.cursor_style_get()
|
||||||
|
|
||||||
|
cpdef cursor_style_set(self, style=None):
|
||||||
|
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
|
||||||
|
elm_genlist_item_cursor_style_set(self.item,
|
||||||
|
<const_char *>style if style is not None else NULL)
|
||||||
|
cpdef cursor_style_get(self):
|
||||||
|
return _ctouni(elm_genlist_item_cursor_style_get(self.item))
|
||||||
|
|
||||||
|
property cursor_engine_only:
|
||||||
|
""" Sets cursor engine only usage for this object.
|
||||||
|
|
||||||
|
.. note:: before you set engine only usage you should define a
|
||||||
|
cursor with elm_genlist_item_cursor_set()
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, bint engine_only):
|
||||||
|
elm_genlist_item_cursor_engine_only_set(self.item, engine_only)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_item_cursor_engine_only_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def cursor_engine_only_set(self, bint engine_only):
|
||||||
|
elm_genlist_item_cursor_engine_only_set(self.item, engine_only)
|
||||||
|
def cursor_engine_only_get(self):
|
||||||
|
cdef bint ret = elm_genlist_item_cursor_engine_only_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property parent:
|
||||||
|
"""This returns the item that was specified as parent of the item
|
||||||
|
on elm_genlist_item_append() and insertion related functions.
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_item_parent_get(self.item))
|
||||||
|
|
||||||
|
def parent_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_item_parent_get(self.item))
|
||||||
|
|
||||||
|
def subitems_clear(self):
|
||||||
|
"""subitems_clear()
|
||||||
|
|
||||||
|
This removes all items that are children (and their descendants)
|
||||||
|
of the item.
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_subitems_clear(self.item)
|
||||||
|
|
||||||
|
property expanded:
|
||||||
|
"""This function flags the item of type #ELM_GENLIST_ITEM_TREE as
|
||||||
|
expanded or not.
|
||||||
|
|
||||||
|
The theme will respond to this change visually, and a signal
|
||||||
|
"expanded" or "contracted" will be sent from the genlist with a
|
||||||
|
pointer to the item that has been expanded/contracted.
|
||||||
|
|
||||||
|
Calling this function won't show or hide any child of this item (if
|
||||||
|
it is a parent). You must manually delete and create them on the
|
||||||
|
callbacks of the "expanded" or "contracted" signals.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_item_expanded_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def __set__(self, bint expanded):
|
||||||
|
elm_genlist_item_expanded_set(self.item, expanded)
|
||||||
|
|
||||||
|
def expanded_set(self, bint expanded):
|
||||||
|
elm_genlist_item_expanded_set(self.item, expanded)
|
||||||
|
def expanded_get(self):
|
||||||
|
cdef bint ret = elm_genlist_item_expanded_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property expanded_depth:
|
||||||
|
"""Get the depth of expanded item.
|
||||||
|
|
||||||
|
:type: int
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_item_expanded_depth_get(self.item)
|
||||||
|
|
||||||
|
def expanded_depth_get(self):
|
||||||
|
return elm_genlist_item_expanded_depth_get(self.item)
|
||||||
|
|
||||||
|
def all_contents_unset(self):
|
||||||
|
"""all_contents_unset() -> list
|
||||||
|
|
||||||
|
This instructs genlist to release references to contents in the
|
||||||
|
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.
|
||||||
|
|
||||||
|
"""
|
||||||
|
cdef Eina_List *lst
|
||||||
|
elm_genlist_item_all_contents_unset(self.item, &lst)
|
||||||
|
return _object_item_list_to_python(lst)
|
||||||
|
|
||||||
|
def promote(self):
|
||||||
|
"""promote()
|
||||||
|
|
||||||
|
Promote an item to the top of the list
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_promote(self.item)
|
||||||
|
|
||||||
|
def demote(self):
|
||||||
|
"""demote()
|
||||||
|
|
||||||
|
Demote an item to the end of the list
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_item_demote(self.item)
|
||||||
|
|
||||||
|
def fields_update(self, parts, Elm_Genlist_Item_Field_Type itf):
|
||||||
|
"""fields_update(unicode parts, itf)
|
||||||
|
|
||||||
|
This updates an item's part by calling item's fetching functions again
|
||||||
|
to get the contents, texts and states. Use this when the original
|
||||||
|
item data has changed and the changes are desired to be reflected.
|
||||||
|
Parts argument is used for globbing to match '*', '?', and '.'
|
||||||
|
It can be used at updating multi fields.
|
||||||
|
|
||||||
|
Use elm_genlist_realized_items_update() to update an item's all
|
||||||
|
property.
|
||||||
|
|
||||||
|
:param parts: The name of item's part
|
||||||
|
:type parts: unicode
|
||||||
|
:param itf: The type of item's part type
|
||||||
|
:type itf: :ref:`Elm_Genlist_Item_Field_Type`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`update()`
|
||||||
|
|
||||||
|
"""
|
||||||
|
if isinstance(parts, unicode): parts = PyUnicode_AsUTF8String(parts)
|
||||||
|
elm_genlist_item_fields_update(self.item,
|
||||||
|
<const_char *>parts if parts is not None else NULL,
|
||||||
|
itf)
|
||||||
|
|
||||||
|
property decorate_mode:
|
||||||
|
"""A genlist mode is a different way of selecting an item. Once a
|
||||||
|
mode is activated on an item, any other selected item is immediately
|
||||||
|
unselected. This feature provides an easy way of implementing a new
|
||||||
|
kind of animation for selecting an item, without having to entirely
|
||||||
|
rewrite the item style theme. However, the elm_genlist_selected_*
|
||||||
|
API can't be used to get what item is activate for a mode.
|
||||||
|
|
||||||
|
The current item style will still be used, but applying a genlist
|
||||||
|
mode to an item will select it using a different kind of animation.
|
||||||
|
|
||||||
|
The current active item for a mode can be found by
|
||||||
|
elm_genlist_decorated_item_get().
|
||||||
|
|
||||||
|
The characteristics of genlist mode are:
|
||||||
|
|
||||||
|
- Only one mode can be active at any time, and for only one item.
|
||||||
|
- Genlist handles deactivating other items when one item is activated.
|
||||||
|
- A mode is defined in the genlist theme (edc), and more modes can
|
||||||
|
easily be added.
|
||||||
|
- A mode style and the genlist item style are different things. They
|
||||||
|
can be combined to provide a default style to the item, with some
|
||||||
|
kind of animation for that item when the mode is activated.
|
||||||
|
|
||||||
|
When a mode is activated on an item, a new view for that item is
|
||||||
|
created. The theme of this mode defines the animation that will be
|
||||||
|
used to transit the item from the old view to the new view. This
|
||||||
|
second (new) view will be active for that item while the mode is
|
||||||
|
active on the item, and will be destroyed after the mode is totally
|
||||||
|
deactivated from that item.
|
||||||
|
|
||||||
|
:type: (unicode **decorate_it_type**, bool **decorate_it_set**)
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`mode` :py:attr:`decorated_item`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, value):
|
||||||
|
decorate_it_type, decorate_it_set = value
|
||||||
|
self.decorate_mode_set(decorate_it_type, decorate_it_set)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return self.decorate_mode_get()
|
||||||
|
|
||||||
|
def decorate_mode_set(self, decorate_it_type, decorate_it_set):
|
||||||
|
a1 = decorate_it_type
|
||||||
|
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
|
||||||
|
elm_genlist_item_decorate_mode_set(self.item,
|
||||||
|
<const_char *>a1 if a1 is not None else NULL,
|
||||||
|
decorate_it_set)
|
||||||
|
def decorate_mode_get(self):
|
||||||
|
return _ctouni(elm_genlist_item_decorate_mode_get(self.item))
|
||||||
|
|
||||||
|
property type:
|
||||||
|
"""This function returns the item's type. Normally the item's type.
|
||||||
|
If it failed, return value is ELM_GENLIST_ITEM_MAX
|
||||||
|
|
||||||
|
:type: :ref:`Elm_Genlist_Item_Type`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
cdef Elm_Genlist_Item_Type ittype = elm_genlist_item_type_get(self.item)
|
||||||
|
return <Elm_Genlist_Item_Type>ittype
|
||||||
|
|
||||||
|
def type_get(self):
|
||||||
|
cdef Elm_Genlist_Item_Type ittype = elm_genlist_item_type_get(self.item)
|
||||||
|
return <Elm_Genlist_Item_Type>ittype
|
||||||
|
|
||||||
|
property flip:
|
||||||
|
"""The flip state of a given genlist item. Flip mode overrides
|
||||||
|
current item object. It can be used for on-the-fly item replace.
|
||||||
|
Flip mode can be used with/without decorate mode.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, flip):
|
||||||
|
elm_genlist_item_flip_set(self.item, flip)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_item_flip_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def flip_set(self, flip):
|
||||||
|
elm_genlist_item_flip_set(self.item, flip)
|
||||||
|
def flip_get(self):
|
||||||
|
cdef bint ret = elm_genlist_item_flip_get(self.item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property select_mode:
|
||||||
|
"""Item's select mode. Possible values are:
|
||||||
|
|
||||||
|
:type: :ref:`Elm_Object_Select_Mode`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, mode):
|
||||||
|
elm_genlist_item_select_mode_set(self.item, mode)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_item_select_mode_get(self.item)
|
||||||
|
|
||||||
|
def select_mode_set(self, mode):
|
||||||
|
elm_genlist_item_select_mode_set(self.item, mode)
|
||||||
|
def select_mode_get(self):
|
||||||
|
return elm_genlist_item_select_mode_get(self.item)
|
||||||
|
|
|
@ -0,0 +1,219 @@
|
||||||
|
cdef class GenlistItemClass(object):
|
||||||
|
"""
|
||||||
|
|
||||||
|
Defines the behavior of each list item.
|
||||||
|
|
||||||
|
This class should be created and handled to the Genlist itself.
|
||||||
|
|
||||||
|
It may be subclassed, in this case the methods :py:func:`text_get()`,
|
||||||
|
:py:func:`content_get()`, :py:func:`state_get()` and ``delete()`` will
|
||||||
|
be used.
|
||||||
|
|
||||||
|
It may also be instantiated directly, given getters to override as
|
||||||
|
constructor parameters.
|
||||||
|
|
||||||
|
"""
|
||||||
|
# In pxd:
|
||||||
|
# Elm_Genlist_Item_Class cls
|
||||||
|
# object _text_get_func
|
||||||
|
# object _content_get_func
|
||||||
|
# object _state_get_func
|
||||||
|
# object _del_func
|
||||||
|
# object _item_style
|
||||||
|
# object _decorate_item_style
|
||||||
|
# object _decorate_all_item_style
|
||||||
|
|
||||||
|
def __cinit__(self):
|
||||||
|
self.cls.func.text_get = _py_elm_genlist_item_text_get
|
||||||
|
self.cls.func.content_get = _py_elm_genlist_item_content_get
|
||||||
|
self.cls.func.state_get = _py_elm_genlist_item_state_get
|
||||||
|
# TODO: Check if the struct member is named del_
|
||||||
|
self.cls.func.del_ = _py_elm_genlist_object_item_del
|
||||||
|
|
||||||
|
def __init__(self, item_style=None, text_get_func=None,
|
||||||
|
content_get_func=None, state_get_func=None, del_func=None,
|
||||||
|
decorate_item_style=None, decorate_all_item_style=None):
|
||||||
|
|
||||||
|
"""GenlistItemClass constructor.
|
||||||
|
|
||||||
|
:param item_style: the string that defines the genlist item
|
||||||
|
theme to be used. The corresponding edje group will
|
||||||
|
have this as suffix.
|
||||||
|
|
||||||
|
:param text_get_func: if provided will override the
|
||||||
|
behavior defined by :py:func:`text_get()` in this class. Its
|
||||||
|
purpose is to return the label string to be used by a
|
||||||
|
given part and row. This function should have the
|
||||||
|
signature:
|
||||||
|
``func(obj, part, item_data) -> str``
|
||||||
|
|
||||||
|
:param content_get_func: if provided will override the behavior
|
||||||
|
defined by :py:func:`content_get()` in this class. Its purpose is
|
||||||
|
to return the icon object to be used (swalloed) by a
|
||||||
|
given part and row. This function should have the
|
||||||
|
signature:
|
||||||
|
``func(obj, part, item_data) -> obj``
|
||||||
|
|
||||||
|
:param state_get_func: if provided will override the
|
||||||
|
behavior defined by :py:func:`state_get()` in this class. Its
|
||||||
|
purpose is to return the boolean state to be used by a
|
||||||
|
given part and row. This function should have the
|
||||||
|
signature:
|
||||||
|
``func(obj, part, item_data) -> bool``
|
||||||
|
|
||||||
|
:param del_func: if provided will override the behavior
|
||||||
|
defined by ``delete()`` in this class. Its purpose is to be
|
||||||
|
called when row is deleted, thus finalizing resouces
|
||||||
|
and similar. This function should have the signature:
|
||||||
|
``func(obj, part, item_data) -> str``
|
||||||
|
|
||||||
|
.. note:: In all these signatures, 'obj' means Genlist and
|
||||||
|
'item_data' is the value given to Genlist item append/prepend
|
||||||
|
methods, it should represent your row model as you want.
|
||||||
|
"""
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use argument if found, else a function that was defined by child
|
||||||
|
# class, or finally the fallback function defined in this class.
|
||||||
|
#
|
||||||
|
if text_get_func is not None:
|
||||||
|
if callable(text_get_func):
|
||||||
|
self._text_get_func = text_get_func
|
||||||
|
else:
|
||||||
|
raise TypeError("text_get_func is not callable!")
|
||||||
|
else:
|
||||||
|
self._text_get_func = self.text_get
|
||||||
|
|
||||||
|
if content_get_func is not None:
|
||||||
|
if callable(content_get_func):
|
||||||
|
self._content_get_func = content_get_func
|
||||||
|
else:
|
||||||
|
raise TypeError("content_get_func is not callable!")
|
||||||
|
else:
|
||||||
|
self._content_get_func = self.content_get
|
||||||
|
|
||||||
|
if state_get_func is not None:
|
||||||
|
if callable(state_get_func):
|
||||||
|
self._state_get_func = state_get_func
|
||||||
|
else:
|
||||||
|
raise TypeError("state_get_func is not callable!")
|
||||||
|
else:
|
||||||
|
self._state_get_func = self.state_get
|
||||||
|
|
||||||
|
if del_func is not None:
|
||||||
|
if callable(del_func):
|
||||||
|
self._del_func = del_func
|
||||||
|
else:
|
||||||
|
raise TypeError("del_func is not callable!")
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
self._del_func = self.delete
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
a1 = item_style
|
||||||
|
a2 = decorate_item_style
|
||||||
|
a3 = decorate_all_item_style
|
||||||
|
|
||||||
|
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
|
||||||
|
if isinstance(a2, unicode): a2 = PyUnicode_AsUTF8String(a2)
|
||||||
|
if isinstance(a3, unicode): a3 = PyUnicode_AsUTF8String(a3)
|
||||||
|
|
||||||
|
self._item_style = a1
|
||||||
|
self._decorate_item_style = a2
|
||||||
|
self._decorate_all_item_style = a3
|
||||||
|
|
||||||
|
self.cls.item_style = <char *>self._item_style if self._item_style is not None else NULL
|
||||||
|
self.cls.decorate_item_style = <char *>self._decorate_item_style if self._decorate_item_style is not None else NULL
|
||||||
|
self.cls.decorate_all_item_style = <char *>self._decorate_all_item_style if self._decorate_all_item_style is not None else NULL
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return ("%s(item_style=%r, text_get_func=%s, content_get_func=%s, "
|
||||||
|
"state_get_func=%s, del_func=%s)") % \
|
||||||
|
(self.__class__.__name__,
|
||||||
|
_ctouni(self.cls.item_style),
|
||||||
|
self._text_get_func,
|
||||||
|
self._content_get_func,
|
||||||
|
self._state_get_func,
|
||||||
|
self._del_func)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return ("%s(%#x, refcount=%d, Elm_Genlist_Item_Class=%#x, "
|
||||||
|
"item_style=%r, text_get_func=%s, content_get_func=%s, "
|
||||||
|
"state_get_func=%s, del_func=%s)") % \
|
||||||
|
(self.__class__.__name__,
|
||||||
|
<unsigned long><void *>self,
|
||||||
|
PY_REFCOUNT(self),
|
||||||
|
<unsigned long>&self.cls,
|
||||||
|
_ctouni(self.cls.item_style),
|
||||||
|
self._text_get_func,
|
||||||
|
self._content_get_func,
|
||||||
|
self._state_get_func,
|
||||||
|
self._del_func)
|
||||||
|
|
||||||
|
property item_style:
|
||||||
|
"""The style of this item class."""
|
||||||
|
def __get__(self):
|
||||||
|
return self._item_style.decode("UTF-8")
|
||||||
|
|
||||||
|
def __set__(self, style):
|
||||||
|
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
|
||||||
|
self._item_style = style
|
||||||
|
self.cls.item_style = <char *>style if style is not None else NULL
|
||||||
|
|
||||||
|
property decorate_item_style:
|
||||||
|
"""The decoration style of this item class."""
|
||||||
|
def __get__(self):
|
||||||
|
return self._decorate_item_style.decode("UTF-8")
|
||||||
|
|
||||||
|
def __set__(self, style):
|
||||||
|
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
|
||||||
|
self._decorate_item_style = style
|
||||||
|
self.cls.decorate_item_style = <char *>style if style is not None else NULL
|
||||||
|
|
||||||
|
property decorate_all_item_style:
|
||||||
|
"""Decorate all style of this item class."""
|
||||||
|
def __get__(self):
|
||||||
|
return self._decorate_all_item_style.decode("UTF-8")
|
||||||
|
|
||||||
|
def __set__(self, style):
|
||||||
|
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
|
||||||
|
self._decorate_all_item_style = style
|
||||||
|
self.cls.decorate_all_item_style = <char *>style if style is not None else NULL
|
||||||
|
|
||||||
|
def text_get(self, evasObject obj, part, item_data):
|
||||||
|
"""To be called by Genlist for each row to get its label.
|
||||||
|
|
||||||
|
:param obj: the Genlist instance
|
||||||
|
:param part: the part that is being handled.
|
||||||
|
:param item_data: the value given to genlist append/prepend.
|
||||||
|
|
||||||
|
:return: label to be used.
|
||||||
|
:rtype: str or None
|
||||||
|
"""
|
||||||
|
return None
|
||||||
|
|
||||||
|
def content_get(self, evasObject obj, part, item_data):
|
||||||
|
"""To be called by Genlist for each row to get its icon.
|
||||||
|
|
||||||
|
:param obj: the Genlist instance
|
||||||
|
:param part: the part that is being handled.
|
||||||
|
:param item_data: the value given to genlist append/prepend.
|
||||||
|
|
||||||
|
:return: icon object to be used and swallowed.
|
||||||
|
:rtype: evas Object or None
|
||||||
|
"""
|
||||||
|
return None
|
||||||
|
|
||||||
|
def state_get(self, evasObject obj, part, item_data):
|
||||||
|
"""To be called by Genlist for each row to get its state.
|
||||||
|
|
||||||
|
:param obj: the Genlist instance
|
||||||
|
:param part: the part that is being handled.
|
||||||
|
:param item_data: the value given to genlist append/prepend.
|
||||||
|
|
||||||
|
:return: state to be used.
|
||||||
|
:rtype: bool or None
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
|
@ -0,0 +1,821 @@
|
||||||
|
cdef class GenlistWidget(Object):
|
||||||
|
|
||||||
|
"""This is the class that actually implements the widget."""
|
||||||
|
|
||||||
|
def __init__(self, evasObject parent not None):
|
||||||
|
self._set_obj(elm_genlist_add(parent.obj))
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return GenlistIterator(self)
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return elm_genlist_items_count(self.obj)
|
||||||
|
|
||||||
|
def __contains__(self, GenlistItem x):
|
||||||
|
cdef:
|
||||||
|
Elm_Object_Item *current_item = elm_genlist_first_item_get(self.obj)
|
||||||
|
int count = elm_genlist_items_count(self.obj)
|
||||||
|
int i
|
||||||
|
|
||||||
|
for i in range(count):
|
||||||
|
if x.item == current_item:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
current_item = elm_genlist_item_next_get(current_item)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
"""clear()
|
||||||
|
|
||||||
|
Remove all items from a given genlist widget.
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_clear(self.obj)
|
||||||
|
|
||||||
|
property multi_select:
|
||||||
|
"""This enables (``True``) or disables (``False``) multi-selection in
|
||||||
|
the list. This allows more than 1 item to be selected. To retrieve
|
||||||
|
the list of selected items, use elm_genlist_selected_items_get().
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, multi):
|
||||||
|
elm_genlist_multi_select_set(self.obj, bool(multi))
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return bool(elm_genlist_multi_select_get(self.obj))
|
||||||
|
|
||||||
|
def multi_select_set(self, multi):
|
||||||
|
elm_genlist_multi_select_set(self.obj, bool(multi))
|
||||||
|
def multi_select_get(self):
|
||||||
|
return bool(elm_genlist_multi_select_get(self.obj))
|
||||||
|
|
||||||
|
property mode:
|
||||||
|
"""The mode used for sizing items horizontally.
|
||||||
|
|
||||||
|
Default value is ELM_LIST_SCROLL. This mode means that if items are too
|
||||||
|
wide to fit, the scroller will scroll horizontally. Otherwise items are
|
||||||
|
expanded to fill the width of the viewport of the scroller. If it is
|
||||||
|
ELM_LIST_LIMIT, items will be expanded to the viewport width and limited
|
||||||
|
to that size. If it is ELM_LIST_COMPRESS, the item width will be fixed
|
||||||
|
(restricted to a minimum of) to the list width when calculating its size
|
||||||
|
in order to allow the height to be calculated based on it. This allows,
|
||||||
|
for instance, text block to wrap lines if the Edje part is configured
|
||||||
|
with "text.min: 0 1".
|
||||||
|
|
||||||
|
.. note:: ELM_LIST_COMPRESS will make list resize slower as it will
|
||||||
|
have to recalculate every item height again whenever the list
|
||||||
|
width changes!
|
||||||
|
|
||||||
|
.. note:: With Homogeneous mode all items in the genlist have the same
|
||||||
|
width/height. With ELM_LIST_COMPRESS the genlist items have
|
||||||
|
fast initializing. However there are no sub-objects in genlist
|
||||||
|
which can be on-the-fly resizable (such as TEXTBLOCK), as some
|
||||||
|
dynamic resizable objects would not be diplayed properly.
|
||||||
|
|
||||||
|
"""
|
||||||
|
# TODO: The above description had badly broken English, check that
|
||||||
|
# it's correct.
|
||||||
|
def __set__(self, mode):
|
||||||
|
elm_genlist_mode_set(self.obj, mode)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_mode_get(self.obj)
|
||||||
|
|
||||||
|
def mode_set(self, mode):
|
||||||
|
elm_genlist_mode_set(self.obj, mode)
|
||||||
|
def mode_get(self):
|
||||||
|
return elm_genlist_mode_get(self.obj)
|
||||||
|
|
||||||
|
def item_append(self,
|
||||||
|
GenlistItemClass item_class not None,
|
||||||
|
item_data,
|
||||||
|
GenlistItem parent_item=None,
|
||||||
|
int flags=ELM_GENLIST_ITEM_NONE,
|
||||||
|
func=None):
|
||||||
|
"""item_append(item_class not None, item_data, parent_item=None, flags=ELM_GENLIST_ITEM_NONE, func=None) -> GenlistItem
|
||||||
|
|
||||||
|
Append a new item (add as last row) to this genlist.
|
||||||
|
|
||||||
|
:param item_class: a valid instance that defines the
|
||||||
|
behavior of this row. See :py:class:`GenlistItemClass`.
|
||||||
|
:param item_data: some data that defines the model of this
|
||||||
|
row. This value will be given to methods of
|
||||||
|
``item_class`` such as
|
||||||
|
:py:func:`GenlistItemClass.text_get()`. It will also be
|
||||||
|
provided to ``func`` as its last parameter.
|
||||||
|
:param parent_item: if this is a tree child, then the
|
||||||
|
parent item must be given here, otherwise it may be
|
||||||
|
None. The parent must have the flag
|
||||||
|
``ELM_GENLIST_ITEM_SUBITEMS`` set.
|
||||||
|
:param flags: defines special behavior of this item, can be one of:
|
||||||
|
ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or
|
||||||
|
ELM_GENLIST_ITEM_GROUP
|
||||||
|
:param func: if not None, this must be a callable to be
|
||||||
|
called back when the item is selected. The function
|
||||||
|
signature is::
|
||||||
|
|
||||||
|
func(item, obj, item_data)
|
||||||
|
|
||||||
|
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||||
|
that represents this item, and ``item_data`` is the
|
||||||
|
value given as parameter to this function.
|
||||||
|
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
return GenlistItem(item_class, item_data, parent_item, flags, func, item_data)\
|
||||||
|
.append_to(self)
|
||||||
|
|
||||||
|
def item_prepend( self,
|
||||||
|
GenlistItemClass item_class not None,
|
||||||
|
item_data,
|
||||||
|
GenlistItem parent_item=None,
|
||||||
|
int flags=ELM_GENLIST_ITEM_NONE,
|
||||||
|
func=None):
|
||||||
|
"""item_prepend(item_class not None, item_data, parent_item=None, flags=ELM_GENLIST_ITEM_NONE, func=None) -> GenlistItem
|
||||||
|
|
||||||
|
Prepend a new item (add as first row) to this genlist.
|
||||||
|
|
||||||
|
:param item_class: a valid instance that defines the
|
||||||
|
behavior of this row. See :py:class:`GenlistItemClass`.
|
||||||
|
:param item_data: some data that defines the model of this
|
||||||
|
row. This value will be given to methods of
|
||||||
|
``item_class`` such as
|
||||||
|
:py:func:`GenlistItemClass.text_get()`. It will also be
|
||||||
|
provided to ``func`` as its last parameter.
|
||||||
|
:param parent_item: if this is a tree child, then the
|
||||||
|
parent item must be given here, otherwise it may be
|
||||||
|
None. The parent must have the flag
|
||||||
|
``ELM_GENLIST_ITEM_SUBITEMS`` set.
|
||||||
|
:param flags: defines special behavior of this item, can be one of:
|
||||||
|
ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or
|
||||||
|
ELM_GENLIST_ITEM_GROUP
|
||||||
|
:param func: if not None, this must be a callable to be
|
||||||
|
called back when the item is selected. The function
|
||||||
|
signature is::
|
||||||
|
|
||||||
|
func(item, obj, item_data)
|
||||||
|
|
||||||
|
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||||
|
that represents this item, and ``item_data`` is the
|
||||||
|
value given as parameter to this function.
|
||||||
|
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
return GenlistItem(item_class, item_data, parent_item, flags, func, item_data)\
|
||||||
|
.prepend_to(self)
|
||||||
|
|
||||||
|
def item_insert_before( self,
|
||||||
|
GenlistItemClass item_class not None,
|
||||||
|
item_data,
|
||||||
|
GenlistItem before_item=None,
|
||||||
|
int flags=ELM_GENLIST_ITEM_NONE,
|
||||||
|
func=None
|
||||||
|
):
|
||||||
|
"""item_insert_before(item_class not None, item_data, before_item=None, flags=ELM_GENLIST_ITEM_NONE, func=None) -> GenlistItem
|
||||||
|
|
||||||
|
Insert a new item before another item to this genlist.
|
||||||
|
|
||||||
|
:param item_class: a valid instance that defines the
|
||||||
|
behavior of this row. See :py:class:`GenlistItemClass`.
|
||||||
|
:param item_data: some data that defines the model of this
|
||||||
|
row. This value will be given to methods of
|
||||||
|
``item_class`` such as
|
||||||
|
:py:func:`GenlistItemClass.text_get()`. It will also be
|
||||||
|
provided to ``func`` as its last parameter.
|
||||||
|
:param before_item: the new item will be inserted before this one.
|
||||||
|
:param flags: defines special behavior of this item, can be one of:
|
||||||
|
ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or
|
||||||
|
ELM_GENLIST_ITEM_GROUP
|
||||||
|
:param func: if not None, this must be a callable to be
|
||||||
|
called back when the item is selected. The function
|
||||||
|
signature is::
|
||||||
|
|
||||||
|
func(item, obj, item_data)
|
||||||
|
|
||||||
|
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||||
|
that represents this item, and ``item_data`` is the
|
||||||
|
value given as parameter to this function.
|
||||||
|
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
return GenlistItem(item_class, item_data, None, flags, func, item_data)\
|
||||||
|
.insert_before(before_item)
|
||||||
|
|
||||||
|
def item_insert_after( self,
|
||||||
|
GenlistItemClass item_class not None,
|
||||||
|
item_data,
|
||||||
|
GenlistItem after_item=None,
|
||||||
|
int flags=ELM_GENLIST_ITEM_NONE,
|
||||||
|
func=None
|
||||||
|
):
|
||||||
|
"""item_insert_after(item_class not None, item_data, after_item=None, flags=ELM_GENLIST_ITEM_NONE, func=None) -> GenlistItem
|
||||||
|
|
||||||
|
Insert a new item after another item to this genlist.
|
||||||
|
|
||||||
|
:param item_class: a valid instance that defines the
|
||||||
|
behavior of this row. See :py:class:`GenlistItemClass`.
|
||||||
|
:param item_data: some data that defines the model of this
|
||||||
|
row. This value will be given to methods of
|
||||||
|
``item_class`` such as
|
||||||
|
:py:func:`GenlistItemClass.text_get()`. It will also be
|
||||||
|
provided to ``func`` as its last parameter.
|
||||||
|
:param after_item: the new item will be inserted after this one.
|
||||||
|
:param flags: defines special behavior of this item, can be one of:
|
||||||
|
ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or
|
||||||
|
ELM_GENLIST_ITEM_GROUP
|
||||||
|
:param func: if not None, this must be a callable to be
|
||||||
|
called back when the item is selected. The function
|
||||||
|
signature is::
|
||||||
|
|
||||||
|
func(item, obj, item_data)
|
||||||
|
|
||||||
|
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||||
|
that represents this item, and ``item_data`` is the
|
||||||
|
value given as parameter to this function.
|
||||||
|
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
return GenlistItem(item_class, item_data, None, flags, func, item_data)\
|
||||||
|
.insert_after(after_item)
|
||||||
|
|
||||||
|
def item_sorted_insert( self,
|
||||||
|
GenlistItemClass item_class not None,
|
||||||
|
item_data,
|
||||||
|
comparison_func not None,
|
||||||
|
GenlistItem parent_item=None,
|
||||||
|
int flags=ELM_GENLIST_ITEM_NONE,
|
||||||
|
func=None
|
||||||
|
#API XXX: *args, **kwargs
|
||||||
|
):
|
||||||
|
"""item_sorted_insert(item_class not None, item_data, comparison_func not None, parent_item=None, flags=ELM_GENLIST_ITEM_NONE, func=None) -> GenlistItem
|
||||||
|
|
||||||
|
This inserts a new item in the genlist based on a user defined
|
||||||
|
comparison function.
|
||||||
|
|
||||||
|
:param item_class: a valid instance that defines the
|
||||||
|
behavior of this row. See :py:class:`GenlistItemClass`.
|
||||||
|
:param item_data: some data that defines the model of this
|
||||||
|
row. This value will be given to methods of
|
||||||
|
``item_class`` such as
|
||||||
|
:py:func:`GenlistItemClass.text_get()`. It will also be
|
||||||
|
provided to ``func`` as its last parameter.
|
||||||
|
:param comparison_func: The function called for the sort.
|
||||||
|
this must be a callable and will be called
|
||||||
|
to insert the item in the right position. The two arguments passed
|
||||||
|
are two :py:class:`GenlistItem` to compare. The function must return
|
||||||
|
1 if ``item1`` comes before ``item2``, 0 if the two items
|
||||||
|
are equal or -1 otherwise.
|
||||||
|
Signature is::
|
||||||
|
|
||||||
|
func(item1, item2)->int
|
||||||
|
|
||||||
|
:param parent_item: if this is a tree child, then the
|
||||||
|
parent item must be given here, otherwise it may be
|
||||||
|
None. The parent must have the flag
|
||||||
|
``ELM_GENLIST_ITEM_SUBITEMS`` set.
|
||||||
|
:param flags: defines special behavior of this item, can be one of:
|
||||||
|
ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or
|
||||||
|
ELM_GENLIST_ITEM_GROUP
|
||||||
|
:param func: if not None, this must be a callable to be
|
||||||
|
called back when the item is selected. The function
|
||||||
|
signature is::
|
||||||
|
|
||||||
|
func(item, obj, item_data)
|
||||||
|
|
||||||
|
Where ``item`` is the handle, ``obj`` is the Evas object
|
||||||
|
that represents this item, and ``item_data`` is the
|
||||||
|
value given as parameter to this function.
|
||||||
|
|
||||||
|
:rtype: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
return GenlistItem(item_class, item_data, parent_item, flags, func, item_data)\
|
||||||
|
.sorted_insert(self, comparison_func)
|
||||||
|
|
||||||
|
property selected_item:
|
||||||
|
"""This gets the selected item in the list (if multi-selection is
|
||||||
|
enabled, only the item that was first selected in the list is
|
||||||
|
returned - which is not very useful, so see
|
||||||
|
elm_genlist_selected_items_get() for when multi-selection is used).
|
||||||
|
|
||||||
|
If no item is selected, None is returned.
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`selected_items`
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_selected_item_get(self.obj))
|
||||||
|
|
||||||
|
def selected_item_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_selected_item_get(self.obj))
|
||||||
|
|
||||||
|
property selected_items:
|
||||||
|
"""It returns a list of the selected items. This list pointer is
|
||||||
|
only valid so long as the selection doesn't change (no items are
|
||||||
|
selected or unselected, or unselected implicitly by deletion). The
|
||||||
|
list contains genlist items pointers. The order of the items in this
|
||||||
|
list is the order which they were selected, i.e. the first item in
|
||||||
|
this list is the first item that was selected, and so on.
|
||||||
|
|
||||||
|
.. note:: If not in multi-select mode, consider using function
|
||||||
|
elm_genlist_selected_item_get() instead.
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`multi_select` :py:attr:`selected_item`
|
||||||
|
|
||||||
|
:type: tuple of :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return tuple(_object_item_list_to_python(elm_genlist_selected_items_get(self.obj)))
|
||||||
|
|
||||||
|
def selected_items_get(self):
|
||||||
|
return _object_item_list_to_python(elm_genlist_selected_items_get(self.obj))
|
||||||
|
|
||||||
|
property realized_items:
|
||||||
|
"""This returns a list of the realized items in the genlist. The list
|
||||||
|
contains genlist item pointers. The list must be freed by the
|
||||||
|
caller when done with eina_list_free(). The item pointers in the
|
||||||
|
list are only valid so long as those items are not deleted or the
|
||||||
|
genlist is not deleted.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`realized_items_update()`
|
||||||
|
|
||||||
|
:type: tuple of :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_list_to_python(elm_genlist_realized_items_get(self.obj))
|
||||||
|
|
||||||
|
def realized_items_get(self):
|
||||||
|
return _object_item_list_to_python(elm_genlist_realized_items_get(self.obj))
|
||||||
|
|
||||||
|
property first_item:
|
||||||
|
"""This returns the first item in the list.
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_first_item_get(self.obj))
|
||||||
|
|
||||||
|
def first_item_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_first_item_get(self.obj))
|
||||||
|
|
||||||
|
property last_item:
|
||||||
|
"""This returns the last item in the list.
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_last_item_get(self.obj))
|
||||||
|
|
||||||
|
def last_item_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_last_item_get(self.obj))
|
||||||
|
|
||||||
|
|
||||||
|
def realized_items_update(self):
|
||||||
|
"""realized_items_update()
|
||||||
|
|
||||||
|
This updates all realized items by calling all the item class
|
||||||
|
functions again to get the contents, texts and states. Use this when
|
||||||
|
the original item data has changed and the changes are desired to be
|
||||||
|
reflected.
|
||||||
|
|
||||||
|
To update just one item, use elm_genlist_item_update().
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`realized_items` :py:func:`item_update()`
|
||||||
|
|
||||||
|
"""
|
||||||
|
elm_genlist_realized_items_update(self.obj)
|
||||||
|
|
||||||
|
def _items_count(self):
|
||||||
|
return elm_genlist_items_count(self.obj)
|
||||||
|
|
||||||
|
property items_count:
|
||||||
|
"""Return how many items are currently in a list
|
||||||
|
|
||||||
|
:type: int
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
count = elm_genlist_items_count(self.obj)
|
||||||
|
return GenlistItemsCount(self, count)
|
||||||
|
|
||||||
|
property homogeneous:
|
||||||
|
"""This will enable the homogeneous mode where items are of the same
|
||||||
|
height and width so that genlist may do the lazy-loading at its
|
||||||
|
maximum (which increases the performance for scrolling the list).
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`mode`
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, bint homogeneous):
|
||||||
|
elm_genlist_homogeneous_set(self.obj, homogeneous)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_homogeneous_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def homogeneous_set(self, bint homogeneous):
|
||||||
|
elm_genlist_homogeneous_set(self.obj, homogeneous)
|
||||||
|
def homogeneous_get(self):
|
||||||
|
cdef bint ret = elm_genlist_homogeneous_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property block_count:
|
||||||
|
"""This will configure the block count to tune to the target with
|
||||||
|
particular performance matrix.
|
||||||
|
|
||||||
|
A block of objects will be used to reduce the number of operations
|
||||||
|
due to many objects in the screen. It can determine the visibility,
|
||||||
|
or if the object has changed, it theme needs to be updated, etc.
|
||||||
|
doing this kind of calculation to the entire block, instead of per
|
||||||
|
object.
|
||||||
|
|
||||||
|
The default value for the block count is enough for most lists, so
|
||||||
|
unless you know you will have a lot of objects visible in the screen
|
||||||
|
at the same time, don't try to change this.
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, int n):
|
||||||
|
elm_genlist_block_count_set(self.obj, n)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_block_count_get(self.obj)
|
||||||
|
|
||||||
|
def block_count_set(self, int n):
|
||||||
|
elm_genlist_block_count_set(self.obj, n)
|
||||||
|
def block_count_get(self):
|
||||||
|
return elm_genlist_block_count_get(self.obj)
|
||||||
|
|
||||||
|
property longpress_timeout:
|
||||||
|
"""This option will change how long it takes to send an event
|
||||||
|
"longpressed" after the mouse down signal is sent to the list. If
|
||||||
|
this event occurs, no "clicked" event will be sent.
|
||||||
|
|
||||||
|
.. warning:: If you set the longpress timeout value with this API,
|
||||||
|
your genlist will not be affected by the longpress value of
|
||||||
|
elementary config value later.
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, timeout):
|
||||||
|
elm_genlist_longpress_timeout_set(self.obj, timeout)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_longpress_timeout_get(self.obj)
|
||||||
|
|
||||||
|
def longpress_timeout_set(self, timeout):
|
||||||
|
elm_genlist_longpress_timeout_set(self.obj, timeout)
|
||||||
|
def longpress_timeout_get(self):
|
||||||
|
return elm_genlist_longpress_timeout_get(self.obj)
|
||||||
|
|
||||||
|
def at_xy_item_get(self, int x, int y):
|
||||||
|
"""at_xy_item_get(int x, int y) -> GenlistItem
|
||||||
|
|
||||||
|
Get the item that is at the x, y canvas coords.
|
||||||
|
|
||||||
|
:param x: The input x coordinate
|
||||||
|
:param y: The input y coordinate
|
||||||
|
:param posret: The position relative to the item returned here
|
||||||
|
:return: The item at the coordinates or None if none
|
||||||
|
|
||||||
|
This returns the item at the given coordinates (which are canvas
|
||||||
|
relative, not object-relative). If an item is at that coordinate,
|
||||||
|
that item handle is returned, and if ``posret`` is not None, the
|
||||||
|
integer pointed to is set to a value of -1, 0 or 1, depending if
|
||||||
|
the coordinate is on the upper portion of that item (-1), on the
|
||||||
|
middle section (0) or on the lower part (1). If None is returned as
|
||||||
|
an item (no item found there), then posret may indicate -1 or 1
|
||||||
|
based if the coordinate is above or below all items respectively in
|
||||||
|
the genlist.
|
||||||
|
|
||||||
|
"""
|
||||||
|
return _object_item_to_python(elm_genlist_at_xy_item_get(self.obj, x, y, NULL))
|
||||||
|
|
||||||
|
property decorated_item:
|
||||||
|
"""This function returns the item that was activated with a mode, by
|
||||||
|
the function elm_genlist_item_decorate_mode_set().
|
||||||
|
|
||||||
|
.. seealso:: :py:attr:`GenlistItem.decorate_mode` :py:attr:`mode`
|
||||||
|
|
||||||
|
:type: :py:class:`GenlistItem`
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __get__(self):
|
||||||
|
return _object_item_to_python(elm_genlist_decorated_item_get(self.obj))
|
||||||
|
|
||||||
|
def decorated_item_get(self):
|
||||||
|
return _object_item_to_python(elm_genlist_decorated_item_get(self.obj))
|
||||||
|
|
||||||
|
property reorder_mode:
|
||||||
|
"""Reorder mode.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, bint reorder_mode):
|
||||||
|
elm_genlist_reorder_mode_set(self.obj, reorder_mode)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_reorder_mode_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def reorder_mode_set(self, bint reorder_mode):
|
||||||
|
elm_genlist_reorder_mode_set(self.obj, reorder_mode)
|
||||||
|
def reorder_mode_get(self):
|
||||||
|
cdef bint ret = elm_genlist_reorder_mode_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property decorate_mode:
|
||||||
|
"""Genlist decorate mode for all items.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, bint decorated):
|
||||||
|
elm_genlist_decorate_mode_set(self.obj, decorated)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_decorate_mode_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def decorate_mode_set(self, bint decorated):
|
||||||
|
elm_genlist_decorate_mode_set(self.obj, decorated)
|
||||||
|
def decorate_mode_get(self):
|
||||||
|
cdef bint ret = elm_genlist_decorate_mode_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property tree_effect_enabled:
|
||||||
|
"""Genlist tree effect.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, bint enabled):
|
||||||
|
elm_genlist_tree_effect_enabled_set(self.obj, enabled)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_tree_effect_enabled_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def tree_effect_enabled_set(self, bint enabled):
|
||||||
|
elm_genlist_tree_effect_enabled_set(self.obj, enabled)
|
||||||
|
def tree_effect_enabled_get(self):
|
||||||
|
cdef bint ret = elm_genlist_tree_effect_enabled_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property highlight_mode:
|
||||||
|
"""Whether the item will, or will not highlighted on selection. The
|
||||||
|
selected and clicked callback functions will still be called.
|
||||||
|
|
||||||
|
Highlight is enabled by default.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, bint highlight):
|
||||||
|
elm_genlist_highlight_mode_set(self.obj, highlight)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
cdef bint ret = elm_genlist_highlight_mode_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def highlight_mode_set(self, bint highlight):
|
||||||
|
elm_genlist_highlight_mode_set(self.obj, highlight)
|
||||||
|
def highlight_mode_get(self):
|
||||||
|
cdef bint ret = elm_genlist_highlight_mode_get(self.obj)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
property select_mode:
|
||||||
|
"""Selection mode of the Genlist widget.
|
||||||
|
|
||||||
|
- ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their
|
||||||
|
selection func and callback when first becoming selected. Any
|
||||||
|
further clicks will do nothing, unless you set always select mode.
|
||||||
|
- ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected,
|
||||||
|
every click will make the selected callbacks be called.
|
||||||
|
- ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to
|
||||||
|
select items entirely and they will neither appear selected nor
|
||||||
|
call selected callback functions.
|
||||||
|
|
||||||
|
:type: Elm_Object_Select_Mode
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __set__(self, mode):
|
||||||
|
elm_genlist_select_mode_set(self.obj, mode)
|
||||||
|
|
||||||
|
def __get__(self):
|
||||||
|
return elm_genlist_select_mode_get(self.obj)
|
||||||
|
|
||||||
|
def select_mode_set(self, mode):
|
||||||
|
elm_genlist_select_mode_set(self.obj, mode)
|
||||||
|
def select_mode_get(self):
|
||||||
|
return elm_genlist_select_mode_get(self.obj)
|
||||||
|
|
||||||
|
def callback_activated_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("activated", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_activated_del(self, func):
|
||||||
|
self._callback_del_full("activated", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_clicked_double_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("clicked,double", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_clicked_double_del(self, func):
|
||||||
|
self._callback_del_full("clicked,double", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_selected_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("selected", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_selected_del(self, func):
|
||||||
|
self._callback_del_full("selected", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_unselected_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("unselected", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_unselected_del(self, func):
|
||||||
|
self._callback_del_full("unselected", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_expanded_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("expanded", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_expanded_del(self, func):
|
||||||
|
self._callback_del_full("expanded", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_contracted_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("contracted", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_contracted_del(self, func):
|
||||||
|
self._callback_del_full("contracted", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_expand_request_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("expand,request", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_expand_request_del(self, func):
|
||||||
|
self._callback_del_full("expand,request", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_contract_request_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("contract,request", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_contract_request_del(self, func):
|
||||||
|
self._callback_del_full("contract,request", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_realized_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("realized", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_realized_del(self, func):
|
||||||
|
self._callback_del_full("realized", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_unrealized_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("unrealized", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_unrealized_del(self, func):
|
||||||
|
self._callback_del_full("unrealized", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_drag_start_up_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("drag,start,up", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_drag_start_up_del(self, func):
|
||||||
|
self._callback_del_full("drag,start,up", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_drag_start_down_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("drag,start,down", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_drag_start_down_del(self, func):
|
||||||
|
self._callback_del_full("drag,start,down", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_drag_start_left_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("drag,start,left", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_drag_start_left_del(self, func):
|
||||||
|
self._callback_del_full("drag,start,left", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_drag_start_right_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("drag,start,right", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_drag_start_right_del(self, func):
|
||||||
|
self._callback_del_full("drag,start,right", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_drag_stop_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("drag,stop", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_drag_stop_del(self, func):
|
||||||
|
self._callback_del_full("drag,stop", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_drag_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("drag", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_drag_del(self, func):
|
||||||
|
self._callback_del_full("drag", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_longpressed_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("longpressed", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_longpressed_del(self, func):
|
||||||
|
self._callback_del_full("longpressed", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
|
||||||
|
def callback_multi_swipe_left_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("multi,swipe,left", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_multi_swipe_left_del(self, func):
|
||||||
|
self._callback_del("multi,swipe,left", func)
|
||||||
|
|
||||||
|
def callback_multi_swipe_right_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("multi,swipe,right", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_multi_swipe_right_del(self, func):
|
||||||
|
self._callback_del("multi,swipe,right", func)
|
||||||
|
|
||||||
|
def callback_multi_swipe_up_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("multi,swipe,up", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_multi_swipe_up_del(self, func):
|
||||||
|
self._callback_del("multi,swipe,up", func)
|
||||||
|
|
||||||
|
def callback_multi_swipe_down_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("multi,swipe,down", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_multi_swipe_down_del(self, func):
|
||||||
|
self._callback_del("multi,swipe,down", func)
|
||||||
|
|
||||||
|
def callback_multi_pinch_out_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("multi,pinch,out", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_multi_pinch_out_del(self, func):
|
||||||
|
self._callback_del("multi,pinch,out", func)
|
||||||
|
|
||||||
|
def callback_multi_pinch_in_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("multi,pinch,in", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_multi_pinch_in_del(self, func):
|
||||||
|
self._callback_del("multi,pinch,in", func)
|
||||||
|
|
||||||
|
def callback_swipe_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("swipe", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_swipe_del(self, func):
|
||||||
|
self._callback_del("swipe", func)
|
||||||
|
|
||||||
|
def callback_moved_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("moved", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_moved_del(self, func):
|
||||||
|
self._callback_del_full("moved", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_moved_after_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("moved,after", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_moved_after_del(self, func):
|
||||||
|
self._callback_del_full("moved,after", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_moved_before_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add_full("moved,before", _cb_object_item_conv,
|
||||||
|
func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_moved_before_del(self, func):
|
||||||
|
self._callback_del_full("moved,before", _cb_object_item_conv, func)
|
||||||
|
|
||||||
|
def callback_language_changed_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("language,changed", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_language_changed_del(self, func):
|
||||||
|
self._callback_del("language,changed", func)
|
||||||
|
|
||||||
|
def callback_tree_effect_finished_add(self, func, *args, **kwargs):
|
||||||
|
self._callback_add("tree,effect,finished", func, *args, **kwargs)
|
||||||
|
|
||||||
|
def callback_tree_effect_finished_del(self, func):
|
||||||
|
self._callback_del("tree,effect,finished", func)
|
||||||
|
|
Loading…
Reference in New Issue