summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-01 13:35:50 +0200
committerdavemds <dave@gurumeditation.it>2014-08-01 13:35:50 +0200
commit401145f4fa5eb54ba962b59de79390dc9cec19dc (patch)
tree56d1c4f3461a7a741c80fe098b4dd45767c7d2f0
parenta97e61dd4ffceb30e62cc0973e879e60a8d43169 (diff)
Toolbar: new un/selected signals, with tests
-rw-r--r--efl/elementary/toolbar.pyx22
-rw-r--r--examples/elementary/test_toolbar.py17
2 files changed, 39 insertions, 0 deletions
diff --git a/efl/elementary/toolbar.pyx b/efl/elementary/toolbar.pyx
index 03a6829..6b04029 100644
--- a/efl/elementary/toolbar.pyx
+++ b/efl/elementary/toolbar.pyx
@@ -1182,6 +1182,28 @@ cdef class Toolbar(LayoutClass):
1182 def callback_item_unfocused_del(self, func): 1182 def callback_item_unfocused_del(self, func):
1183 self._callback_del_full("item,unfocused", _cb_object_item_conv, func) 1183 self._callback_del_full("item,unfocused", _cb_object_item_conv, func)
1184 1184
1185 def callback_selected_add(self, func, *args, **kwargs):
1186 """When the toolbar item is selected.
1187
1188 .. versionadded:: 1.11
1189
1190 """
1191 self._callback_add_full("selected", _cb_object_item_conv, func, *args, **kwargs)
1192
1193 def callback_selected_del(self, func):
1194 self._callback_del_full("selected", _cb_object_item_conv, func)
1195
1196 def callback_unselected_add(self, func, *args, **kwargs):
1197 """When the toolbar item is unselected.
1198
1199 .. versionadded:: 1.11
1200
1201 """
1202 self._callback_add_full("unselected", _cb_object_item_conv, func, *args, **kwargs)
1203
1204 def callback_unselected_del(self, func):
1205 self._callback_del_full("unselected", _cb_object_item_conv, func)
1206
1185 property scroller_policy: 1207 property scroller_policy:
1186 """ 1208 """
1187 1209
diff --git a/examples/elementary/test_toolbar.py b/examples/elementary/test_toolbar.py
index bd82038..67f4372 100644
--- a/examples/elementary/test_toolbar.py
+++ b/examples/elementary/test_toolbar.py
@@ -48,6 +48,20 @@ def tb_4a(obj, it, ph):
48def tb_5(obj, it, ph): 48def tb_5(obj, it, ph):
49 ph.file = None 49 ph.file = None
50 50
51def cb_clicked(tb):
52 print("CLICKED")
53 print(tb)
54
55def cb_item_focused(tb, item):
56 print("ITEM FOCUSED")
57 print(tb)
58 print(item)
59
60def cb_selected(tb, item):
61 print("SELECTED")
62 print(tb)
63 print(item)
64
51def toolbar_clicked(obj, item=None): 65def toolbar_clicked(obj, item=None):
52 win = StandardWindow("toolbar", "Toolbar", autodel=True, size=(320, 300)) 66 win = StandardWindow("toolbar", "Toolbar", autodel=True, size=(320, 300))
53 if obj is None: 67 if obj is None:
@@ -62,6 +76,9 @@ def toolbar_clicked(obj, item=None):
62 76
63 tb = Toolbar(win, homogeneous=False, size_hint_weight=(0.0, 0.0), 77 tb = Toolbar(win, homogeneous=False, size_hint_weight=(0.0, 0.0),
64 size_hint_align=(EVAS_HINT_FILL, 0.0)) 78 size_hint_align=(EVAS_HINT_FILL, 0.0))
79 tb.callback_clicked_add(cb_clicked)
80 tb.callback_selected_add(cb_selected)
81 tb.callback_item_focused_add(cb_item_focused)
65 82
66 ph1 = Photo(win, size=40, file=os.path.join(img_path, "plant_01.jpg"), 83 ph1 = Photo(win, size=40, file=os.path.join(img_path, "plant_01.jpg"),
67 size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER) 84 size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)