parent
74ed9e86a4
commit
5bbaba2a6e
|
@ -28,6 +28,8 @@ cdef extern from "Elementary.h":
|
||||||
void elm_genlist_clear(Evas_Object *obj)
|
void elm_genlist_clear(Evas_Object *obj)
|
||||||
void elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi)
|
void elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi)
|
||||||
Eina_Bool elm_genlist_multi_select_get(const Evas_Object *obj)
|
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)
|
void elm_genlist_mode_set(Evas_Object *obj, Elm_List_Mode mode)
|
||||||
Elm_List_Mode elm_genlist_mode_get(const Evas_Object *obj)
|
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)
|
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)
|
||||||
|
|
|
@ -64,6 +64,26 @@ cdef class Genlist(Object):
|
||||||
def multi_select_get(self):
|
def multi_select_get(self):
|
||||||
return bool(elm_genlist_multi_select_get(self.obj))
|
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:
|
property mode:
|
||||||
"""The mode used for sizing items horizontally.
|
"""The mode used for sizing items horizontally.
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,7 @@ items = [
|
||||||
("Lists - Genlist", [
|
("Lists - Genlist", [
|
||||||
("Genlist 1", "test_genlist_1", "test_genlist_1"),
|
("Genlist 1", "test_genlist_1", "test_genlist_1"),
|
||||||
("Genlist 2", "test_genlist_2", "test_genlist_2"),
|
("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 Tree", "test_genlist_tree", "test_genlist_tree"),
|
||||||
("Genlist Group", "test_genlist_group", "test_genlist_group"),
|
("Genlist Group", "test_genlist_group", "test_genlist_group"),
|
||||||
("Genlist Filter", "test_genlist_filter", "test_genlist_filter"),
|
("Genlist Filter", "test_genlist_filter", "test_genlist_filter"),
|
||||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue