New 1.18 API: elm.Genlist.filtered_items_count()

with test
This commit is contained in:
Davide Andreoli 2016-08-09 16:21:43 +02:00
parent 105743d304
commit 01d334b5f6
3 changed files with 16 additions and 0 deletions

View File

@ -161,3 +161,4 @@ cdef extern from "Elementary.h":
void elm_genlist_focus_on_selection_set(Evas_Object *obj, Eina_Bool enabled)
Eina_Bool elm_genlist_focus_on_selection_get(const Evas_Object *obj)
void elm_genlist_filter_set(Evas_Object *obj, void *key)
unsigned int elm_genlist_filtered_items_count(Evas_Object *obj)

View File

@ -734,6 +734,20 @@ cdef class Genlist(Object):
def filter_get(self):
return self.internal_data['__filterkeyref']
def filtered_items_count(self):
"""Return how many items have passed the filter currently.
This behaviour is O(1) and may or may not return the filtered count for
complete genlist based on the timing of the call. To get complete
count, call after "filter,done" callback.
:return: The number of filtered items
:rtype: int
.. versionadded:: 1.18
"""
return elm_genlist_filtered_items_count(self.obj)
#
# Drag and Drop
# =============

View File

@ -39,6 +39,7 @@ def entry_changed_cb(en, gl):
def filter_done_cb(gl):
print("filter,done")
print("Filtered items count: ", gl.filtered_items_count())
def test_genlist_filter(parent):
win = StandardWindow("genlist-filter", "Genlist Filter", autodel=True,