summaryrefslogtreecommitdiff
path: root/efl
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-01 16:31:24 +0200
committerdavemds <dave@gurumeditation.it>2014-08-01 16:31:24 +0200
commitd8174aea3d6f185eca3a84934ef4bba67d713b91 (patch)
tree392ccbe8c783d99e118235fcdc6fd1394bbb00be /efl
parent401145f4fa5eb54ba962b59de79390dc9cec19dc (diff)
Genlist: implemented search_by_text_item_get(), with a proper test
Diffstat (limited to 'efl')
-rw-r--r--efl/elementary/enums.pxd6
-rw-r--r--efl/elementary/general.pyx42
-rw-r--r--efl/elementary/genlist.pxd3
-rw-r--r--efl/elementary/genlist_widget.pxi41
4 files changed, 91 insertions, 1 deletions
diff --git a/efl/elementary/enums.pxd b/efl/elementary/enums.pxd
index 624f01d..87ea2e9 100644
--- a/efl/elementary/enums.pxd
+++ b/efl/elementary/enums.pxd
@@ -188,6 +188,12 @@ cdef extern from "Elementary.h":
188 ELM_GENLIST_ITEM_SCROLLTO_TOP 188 ELM_GENLIST_ITEM_SCROLLTO_TOP
189 ELM_GENLIST_ITEM_SCROLLTO_MIDDLE 189 ELM_GENLIST_ITEM_SCROLLTO_MIDDLE
190 190
191 ctypedef enum Elm_Glob_Match_Flags:
192 ELM_GLOB_MATCH_NO_ESCAPE
193 ELM_GLOB_MATCH_PATH
194 ELM_GLOB_MATCH_PERIOD
195 ELM_GLOB_MATCH_NOCASE
196
191 ctypedef enum Elm_Gesture_State: 197 ctypedef enum Elm_Gesture_State:
192 ELM_GESTURE_STATE_UNDEFINED 198 ELM_GESTURE_STATE_UNDEFINED
193 ELM_GESTURE_STATE_START 199 ELM_GESTURE_STATE_START
diff --git a/efl/elementary/general.pyx b/efl/elementary/general.pyx
index 13d50e4..be3a096 100644
--- a/efl/elementary/general.pyx
+++ b/efl/elementary/general.pyx
@@ -177,6 +177,43 @@ Urgency levels of a notification
177 .. versionadded:: 1.10 177 .. versionadded:: 1.10
178 178
179 179
180.. _Elm_Glob_Match_Flags:
181
182Glob matching
183-------------
184
185Glob matching bitfiled flags
186
187.. data:: ELM_GLOB_MATCH_NO_ESCAPE
188
189 Treat backslash as an ordinary character instead of escape.
190
191 .. versionadded:: 1.11
192
193.. data:: ELM_GLOB_MATCH_PATH
194
195 Match a slash in string only with a slash in pattern and not by an
196 asterisk (*) or a question mark (?) metacharacter, nor by a bracket
197 expression ([]) containing a slash.
198
199 .. versionadded:: 1.11
200
201.. data:: ELM_GLOB_MATCH_PERIOD
202
203 Leading period in string has to be matched exactly by a period in
204 pattern. A period is considered to be leading if it is the first
205 character in string, or if both ELM_GLOB_MATCH_PATH is set and the
206 period immediately follows a slash.
207
208 .. versionadded:: 1.11
209
210.. data:: ELM_GLOB_MATCH_NOCASE
211
212 The pattern is matched case-insensitively.
213
214 .. versionadded:: 1.11
215
216
180""" 217"""
181 218
182from cpython cimport PyUnicode_AsUTF8String, PyMem_Malloc, Py_DECREF, Py_INCREF 219from cpython cimport PyUnicode_AsUTF8String, PyMem_Malloc, Py_DECREF, Py_INCREF
@@ -228,6 +265,11 @@ ELM_SYS_NOTIFY_URGENCY_CRITICAL = enums.ELM_SYS_NOTIFY_URGENCY_CRITICAL
228ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED = enums.ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED 265ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED = enums.ELM_EVENT_SYS_NOTIFY_NOTIFICATION_CLOSED
229ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED = enums.ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED 266ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED = enums.ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED
230 267
268ELM_GLOB_MATCH_NO_ESCAPE = enums.ELM_GLOB_MATCH_NO_ESCAPE
269ELM_GLOB_MATCH_PATH = enums.ELM_GLOB_MATCH_PATH
270ELM_GLOB_MATCH_PERIOD = enums.ELM_GLOB_MATCH_PERIOD
271ELM_GLOB_MATCH_NOCASE = enums.ELM_GLOB_MATCH_NOCASE
272
231import traceback 273import traceback
232 274
233cdef void py_elm_sys_notify_send_cb(void *data, unsigned int id): 275cdef void py_elm_sys_notify_send_cb(void *data, unsigned int id):
diff --git a/efl/elementary/genlist.pxd b/efl/elementary/genlist.pxd
index 7941c48..0d8d367 100644
--- a/efl/elementary/genlist.pxd
+++ b/efl/elementary/genlist.pxd
@@ -4,7 +4,7 @@ from object_item cimport Elm_Object_Item
4from general cimport Elm_Tooltip_Item_Content_Cb 4from general cimport Elm_Tooltip_Item_Content_Cb
5from enums cimport Elm_List_Mode, Elm_Object_Select_Mode, \ 5from enums cimport Elm_List_Mode, Elm_Object_Select_Mode, \
6 Elm_Genlist_Item_Type, Elm_Genlist_Item_Scrollto_Type, \ 6 Elm_Genlist_Item_Type, Elm_Genlist_Item_Scrollto_Type, \
7 Elm_Genlist_Item_Field_Type 7 Elm_Genlist_Item_Field_Type, Elm_Glob_Match_Flags
8 8
9cdef extern from "Elementary.h": 9cdef extern from "Elementary.h":
10 ctypedef char *(*GenlistItemLabelGetFunc) (void *data, Evas_Object *obj, const char *part) 10 ctypedef char *(*GenlistItemLabelGetFunc) (void *data, Evas_Object *obj, const char *part)
@@ -81,6 +81,7 @@ cdef extern from "Elementary.h":
81 void elm_genlist_longpress_timeout_set(Evas_Object *obj, double timeout) 81 void elm_genlist_longpress_timeout_set(Evas_Object *obj, double timeout)
82 double elm_genlist_longpress_timeout_get(const Evas_Object *obj) 82 double elm_genlist_longpress_timeout_get(const Evas_Object *obj)
83 Elm_Object_Item * elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret) 83 Elm_Object_Item * elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret)
84 Elm_Object_Item * elm_genlist_search_by_text_item_get(const Evas_Object *obj, Elm_Object_Item *item_to_search_from, const char *part_name, const char *pattern, Elm_Glob_Match_Flags flags)
84 85
85 Elm_Object_Item * elm_genlist_item_parent_get(const Elm_Object_Item *it) 86 Elm_Object_Item * elm_genlist_item_parent_get(const Elm_Object_Item *it)
86 void elm_genlist_item_subitems_clear(Elm_Object_Item *item) 87 void elm_genlist_item_subitems_clear(Elm_Object_Item *item)
diff --git a/efl/elementary/genlist_widget.pxi b/efl/elementary/genlist_widget.pxi
index 68cf2a8..dcc0c2d 100644
--- a/efl/elementary/genlist_widget.pxi
+++ b/efl/elementary/genlist_widget.pxi
@@ -634,6 +634,47 @@ cdef class Genlist(Object):
634 """ 634 """
635 return _object_item_to_python(elm_genlist_nth_item_get(self.obj, nth)) 635 return _object_item_to_python(elm_genlist_nth_item_get(self.obj, nth))
636 636
637 def search_by_text_item_get(self, GenlistItem item_to_search_from,
638 part_name, pattern, Elm_Glob_Match_Flags flags):
639 """Search genlist item by given string.
640
641 This function uses globs (like "\*.jpg") for searching and takes
642 search flags as last parameter. That is a bitfield with values
643 to be ored together or 0 for no flags.
644
645 :param item_to_search_from: item to start search from, or None to
646 search from the first item.
647 :type item_to_search_from: :py:class:`GenlistItem`
648 :param part_name: Name of the TEXT part of genlist item to search
649 string in (usually "elm.text").
650 :type part_name: string
651 :param pattern: The search pattern.
652 :type pattern: string
653 :param flags: Search flags
654 :type flags: :ref:`Elm_Glob_Match_Flags`
655
656 :return: The first item found
657 :rtype: :py:class:`GenlistItem`
658
659 .. versionadded:: 1.11
660
661 """
662 cdef Elm_Object_Item *from_item = NULL
663
664 if isinstance(part_name, unicode):
665 part_name = PyUnicode_AsUTF8String(part_name)
666 if isinstance(pattern, unicode):
667 pattern = PyUnicode_AsUTF8String(pattern)
668 if item_to_search_from is not None:
669 from_item = _object_item_from_python(item_to_search_from)
670
671 return _object_item_to_python(elm_genlist_search_by_text_item_get(
672 self.obj, from_item,
673 <const char *>part_name if part_name is not None else NULL,
674 <const char *>pattern if pattern is not None else NULL,
675 flags))
676
677
637 property focus_on_selection: 678 property focus_on_selection:
638 """ 679 """
639 680