davemds pushed a commit to branch master.

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

commit 01d334b5f6da5bac0752501b5d62a3d62a5edb00
Author: Dave Andreoli <[email protected]>
Date:   Tue Aug 9 16:21:43 2016 +0200

    New 1.18 API: elm.Genlist.filtered_items_count()
    
    with test
---
 efl/elementary/genlist_cdef.pxi            |  1 +
 efl/elementary/genlist_widget.pxi          | 14 ++++++++++++++
 examples/elementary/test_genlist_filter.py |  1 +
 3 files changed, 16 insertions(+)

diff --git a/efl/elementary/genlist_cdef.pxi b/efl/elementary/genlist_cdef.pxi
index d76fd05..937fae7 100644
--- a/efl/elementary/genlist_cdef.pxi
+++ b/efl/elementary/genlist_cdef.pxi
@@ -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)
diff --git a/efl/elementary/genlist_widget.pxi 
b/efl/elementary/genlist_widget.pxi
index 98e28b0..f74e159 100644
--- a/efl/elementary/genlist_widget.pxi
+++ b/efl/elementary/genlist_widget.pxi
@@ -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
     # =============
diff --git a/examples/elementary/test_genlist_filter.py 
b/examples/elementary/test_genlist_filter.py
index ff69149..71f6ca6 100644
--- a/examples/elementary/test_genlist_filter.py
+++ b/examples/elementary/test_genlist_filter.py
@@ -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,

-- 


Reply via email to