davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=401145f4fa5eb54ba962b59de79390dc9cec19dc

commit 401145f4fa5eb54ba962b59de79390dc9cec19dc
Author: davemds <[email protected]>
Date:   Fri Aug 1 13:35:50 2014 +0200

    Toolbar: new un/selected signals, with tests
---
 efl/elementary/toolbar.pyx          | 22 ++++++++++++++++++++++
 examples/elementary/test_toolbar.py | 17 +++++++++++++++++
 2 files changed, 39 insertions(+)

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):
     def callback_item_unfocused_del(self, func):
         self._callback_del_full("item,unfocused", _cb_object_item_conv, func)
 
+    def callback_selected_add(self, func, *args, **kwargs):
+        """When the toolbar item is selected.
+
+        .. versionadded:: 1.11
+
+        """
+        self._callback_add_full("selected", _cb_object_item_conv, func, *args, 
**kwargs)
+
+    def callback_selected_del(self, func):
+        self._callback_del_full("selected", _cb_object_item_conv, func)
+
+    def callback_unselected_add(self, func, *args, **kwargs):
+        """When the toolbar item is unselected.
+
+        .. versionadded:: 1.11
+
+        """
+        self._callback_add_full("unselected", _cb_object_item_conv, func, 
*args, **kwargs)
+
+    def callback_unselected_del(self, func):
+        self._callback_del_full("unselected", _cb_object_item_conv, func)
+
     property scroller_policy:
         """
 
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):
 def tb_5(obj, it, ph):
     ph.file = None
 
+def cb_clicked(tb):
+    print("CLICKED")
+    print(tb)
+
+def cb_item_focused(tb, item):
+    print("ITEM FOCUSED")
+    print(tb)
+    print(item)
+
+def cb_selected(tb, item):
+    print("SELECTED")
+    print(tb)
+    print(item)
+
 def toolbar_clicked(obj, item=None):
     win = StandardWindow("toolbar", "Toolbar", autodel=True, size=(320, 300))
     if obj is None:
@@ -62,6 +76,9 @@ def toolbar_clicked(obj, item=None):
 
     tb = Toolbar(win, homogeneous=False, size_hint_weight=(0.0, 0.0),
         size_hint_align=(EVAS_HINT_FILL, 0.0))
+    tb.callback_clicked_add(cb_clicked)
+    tb.callback_selected_add(cb_selected)
+    tb.callback_item_focused_add(cb_item_focused)
 
     ph1 = Photo(win, size=40, file=os.path.join(img_path, "plant_01.jpg"),
         size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)

-- 


Reply via email to