davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=190d0aa7b635682dc5ce1f83cab28006eb8fc27e

commit 190d0aa7b635682dc5ce1f83cab28006eb8fc27e
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Sat Jan 23 16:32:08 2016 +0100

    New 1.17 API: elm.Popup.dismiss()
---
 doc/elementary/popup.rst          |  1 +
 efl/elementary/popup.pxi          | 19 +++++++++++++++++++
 efl/elementary/popup_cdef.pxi     |  1 +
 examples/elementary/test_popup.py | 23 ++++++++++++++++++++++-
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/doc/elementary/popup.rst b/doc/elementary/popup.rst
index 2747c63..3742613 100644
--- a/doc/elementary/popup.rst
+++ b/doc/elementary/popup.rst
@@ -71,6 +71,7 @@ Emitted signals
 - ``block,clicked`` - when ever user taps on Blocked Event area.
 - ``item,focused`` - the popup item has received focus. (since 1.10)
 - ``item,unfocused`` - the popup item has lost focus. (since 1.10)
+- ``dismissed`` - the popup has been dismissed. (since 1.17)
 
 
 Layout content parts
diff --git a/efl/elementary/popup.pxi b/efl/elementary/popup.pxi
index e14676a..90a54f8 100644
--- a/efl/elementary/popup.pxi
+++ b/efl/elementary/popup.pxi
@@ -211,6 +211,25 @@ cdef class Popup(LayoutClass):
         def __get__(self):
             return bool(elm_popup_allow_events_get(self.obj))
 
+    def dismiss(self):
+        """Dismiss a popup object.
+
+        .. versionadded:: 1.17
+
+        """
+        elm_popup_dismiss(self.obj)
+
+    def callback_dismissed_add(self, func, *args, **kwargs):
+        """When popup is closed as a result of a dismiss.
+
+        .. versionadded:: 1.17
+
+        """
+        self._callback_add("dismissed", func, args, kwargs)
+
+    def callback_dismissed_del(self, func):
+        self._callback_del("dismissed", func)
+
     def callback_timeout_add(self, func, *args, **kwargs):
         """When popup is closed as a result of timeout."""
         self._callback_add("timeout", func, args, kwargs)
diff --git a/efl/elementary/popup_cdef.pxi b/efl/elementary/popup_cdef.pxi
index 2216f5c..3f75bd4 100644
--- a/efl/elementary/popup_cdef.pxi
+++ b/efl/elementary/popup_cdef.pxi
@@ -33,3 +33,4 @@ cdef extern from "Elementary.h":
     double                   elm_popup_timeout_get(const Evas_Object *obj)
     void                     elm_popup_allow_events_set(Evas_Object *obj, 
Eina_Bool allow)
     Eina_Bool                elm_popup_allow_events_get(const Evas_Object *obj)
+    void                     elm_popup_dismiss(const Evas_Object *obj)
diff --git a/examples/elementary/test_popup.py 
b/examples/elementary/test_popup.py
index a00e5f4..c938151 100644
--- a/examples/elementary/test_popup.py
+++ b/examples/elementary/test_popup.py
@@ -168,8 +168,27 @@ def cb_popup_center_text_1button_hide_show(li, item, win):
     g_popup.show()
 
 
+def _popup_dismissed_cb(popup):
+    print("dismissed", popup)
+    popup.delete()
+
+def cb_popup_center_title_1button_hide_effect(li, item, win):
+    popup = Popup(win, text="This Popup has title area, content area and " \
+                  "action area set, action area has one button Close",
+                  size_hint_expand=EXPAND_BOTH)
+    popup.part_text_set("title", "Title")
+    popup.callback_dismissed_add(_popup_dismissed_cb)
+
+    btn = Button(popup, text="Close")
+    btn.callback_clicked_add(lambda b: popup.dismiss())
+    popup.part_content_set("button1", btn)
+
+    popup.show()
+    
+
+
 def popup_clicked(obj):
-    win = StandardWindow("popup", "Popup test", autodel=True, size=(480, 800))
+    win = StandardWindow("popup", "Popup test", autodel=True, size=(400, 400))
     if obj is None:
         win.callback_delete_request_add(lambda o: elementary.exit())
 
@@ -196,6 +215,8 @@ def popup_clicked(obj):
                    cb_popup_center_title_text_2button_restack, win)
     li.item_append("popup-center-text + 1 button (check hide, show)", None, 
None,
                    cb_popup_center_text_1button_hide_show, win)
+    li.item_append("popup-center-title + text + 1 button + hide effect", None, 
None,
+                   cb_popup_center_title_1button_hide_effect, win)
 
     li.go()
 

-- 


Reply via email to