aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-07-22 17:24:06 +0200
committerDave Andreoli <dave@gurumeditation.it>2017-07-22 17:24:06 +0200
commit5bbaba2a6ebad92aa2309ca546d774977201527f (patch)
tree06acb922529e4308236e5fbd7c3763e30d6aac67
parentUse the buffer engine for elm tests (diff)
downloadpython-efl-5bbaba2a6ebad92aa2309ca546d774977201527f.tar.gz
New 1.20 API: elm.Genlist.multi_select_mode
with test
-rw-r--r--efl/elementary/genlist_cdef.pxi2
-rw-r--r--efl/elementary/genlist_widget.pxi20
-rwxr-xr-xexamples/elementary/test.py1
-rw-r--r--examples/elementary/test_genlist_multiselect.py81
4 files changed, 104 insertions, 0 deletions
diff --git a/efl/elementary/genlist_cdef.pxi b/efl/elementary/genlist_cdef.pxi
index 17190ce..c4da09b 100644
--- a/efl/elementary/genlist_cdef.pxi
+++ b/efl/elementary/genlist_cdef.pxi
@@ -28,6 +28,8 @@ cdef extern from "Elementary.h":
void elm_genlist_clear(Evas_Object *obj)
void elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi)
Eina_Bool elm_genlist_multi_select_get(const Evas_Object *obj)
+ void elm_genlist_multi_select_mode_set(Evas_Object *obj, Elm_Object_Multi_Select_Mode mode)
+ Elm_Object_Multi_Select_Mode elm_genlist_multi_select_mode_get(const Evas_Object *obj)
void elm_genlist_mode_set(Evas_Object *obj, Elm_List_Mode mode)
Elm_List_Mode elm_genlist_mode_get(const Evas_Object *obj)
Elm_Object_Item * elm_genlist_item_append(Evas_Object *obj, Elm_Genlist_Item_Class *itc, void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Type flags, Evas_Smart_Cb func, void *func_data)
diff --git a/efl/elementary/genlist_widget.pxi b/efl/elementary/genlist_widget.pxi
index 49a9fb7..3c89d14 100644
--- a/efl/elementary/genlist_widget.pxi
+++ b/efl/elementary/genlist_widget.pxi
@@ -64,6 +64,26 @@ cdef class Genlist(Object):
def multi_select_get(self):
return bool(elm_genlist_multi_select_get(self.obj))
+ property multi_select_mode:
+ """The genlist multi select mode.
+
+ Whenever the user need to pres Ctrl to perform multiselect or not.
+
+ :type: :ref:`Elm_Object_Multi_Select_Mode`
+
+ .. versionadded:: 1.20
+
+ """
+ def __set__(self, mode):
+ elm_genlist_multi_select_mode_set(self.obj, mode)
+ def __get__(self):
+ return elm_genlist_multi_select_mode_get(self.obj)
+
+ def multi_select_mode_set(self, mode):
+ elm_genlist_multi_select_mode_set(self.obj, mode)
+ def multi_select_mode_get(self):
+ return elm_genlist_multi_select_mode_get(self.obj)
+
property mode:
"""The mode used for sizing items horizontally.
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index bf87b9b..3c01007 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -174,6 +174,7 @@ items = [
("Lists - Genlist", [
("Genlist 1", "test_genlist_1", "test_genlist_1"),
("Genlist 2", "test_genlist_2", "test_genlist_2"),
+ ("Genlist Multi Select", "test_genlist_multiselect", "test_genlist_multiselect"),
("Genlist Tree", "test_genlist_tree", "test_genlist_tree"),
("Genlist Group", "test_genlist_group", "test_genlist_group"),
("Genlist Filter", "test_genlist_filter", "test_genlist_filter"),
diff --git a/examples/elementary/test_genlist_multiselect.py b/examples/elementary/test_genlist_multiselect.py
new file mode 100644
index 0000000..457d937
--- /dev/null
+++ b/examples/elementary/test_genlist_multiselect.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import os
+
+from efl.evas import EXPAND_BOTH, FILL_BOTH, EXPAND_HORIZ, FILL_HORIZ
+from efl import elementary as elm
+
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
+
+
+class MyItemClass(elm.GenlistItemClass):
+ def __init__(self):
+ elm.GenlistItemClass.__init__(self, item_style="tree_effect")
+
+ def text_get(self, obj, part, item_data):
+ return "Item # %i" % item_data
+
+ def content_get(self, obj, part, item_data):
+ icon = "logo_small.png" if part == "elm.swallow.icon" else "bubble.png"
+ return elm.Icon(obj, file=os.path.join(img_path, icon))
+
+itc = MyItemClass()
+
+
+def test_genlist_multiselect(parent):
+ win = elm.StandardWindow("Genlist", "Genlist Multi Select",
+ size=(320, 500), autodel=True)
+
+ # vertical box + options frame
+ box = elm.Box(win, size_hint_expand=EXPAND_BOTH)
+ win.resize_object_add(box)
+ box.show()
+
+ fr = elm.Frame(win, text='Multi Select Options',
+ size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ)
+ box.pack_end(fr)
+ fr.show()
+
+ hbox = elm.Box(win, horizontal=True, homogeneous=False,
+ size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ)
+ fr.content = hbox
+ hbox.show()
+
+ # Genlist
+ gl = elm.Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
+ box.pack_end(gl)
+ gl.show()
+
+ for i in range(100):
+ gl.item_append(itc, i)
+
+ # Options
+ ck = elm.Check(win, style="toggle", text="Multi Select Enable")
+ ck.callback_changed_add(lambda o: setattr(gl, "multi_select", o.state))
+ hbox.pack_end(ck)
+ ck.show()
+
+ rdg = rd = elm.Radio(win, text="Default mode", state_value=0)
+ rd.callback_changed_add(lambda o: setattr(gl, "multi_select_mode",
+ elm.ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT))
+ hbox.pack_end(rd)
+ rd.show()
+
+ rd = elm.Radio(win, text="With Control mode", state_value=1)
+ rd.callback_changed_add(lambda o: setattr(gl, "multi_select_mode",
+ elm.ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL))
+ rdg.group_add(rd)
+ hbox.pack_end(rd)
+ rd.show()
+
+ # show the window
+ win.show()
+
+
+if __name__ == "__main__":
+ elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
+ test_genlist_multiselect(None)
+ elm.run()