summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-01-23 16:32:08 +0100
committerDave Andreoli <dave@gurumeditation.it>2016-01-23 16:32:08 +0100
commit190d0aa7b635682dc5ce1f83cab28006eb8fc27e (patch)
tree23da36d9151a23c0dca7c952f41f29a11f75935c
parent24318c8d3351d816827a0ad1e14fcb8c64484a2a (diff)
New 1.17 API: elm.Popup.dismiss()
-rw-r--r--doc/elementary/popup.rst1
-rw-r--r--efl/elementary/popup.pxi19
-rw-r--r--efl/elementary/popup_cdef.pxi1
-rw-r--r--examples/elementary/test_popup.py23
4 files changed, 43 insertions, 1 deletions
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
71- ``block,clicked`` - when ever user taps on Blocked Event area. 71- ``block,clicked`` - when ever user taps on Blocked Event area.
72- ``item,focused`` - the popup item has received focus. (since 1.10) 72- ``item,focused`` - the popup item has received focus. (since 1.10)
73- ``item,unfocused`` - the popup item has lost focus. (since 1.10) 73- ``item,unfocused`` - the popup item has lost focus. (since 1.10)
74- ``dismissed`` - the popup has been dismissed. (since 1.17)
74 75
75 76
76Layout content parts 77Layout 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):
211 def __get__(self): 211 def __get__(self):
212 return bool(elm_popup_allow_events_get(self.obj)) 212 return bool(elm_popup_allow_events_get(self.obj))
213 213
214 def dismiss(self):
215 """Dismiss a popup object.
216
217 .. versionadded:: 1.17
218
219 """
220 elm_popup_dismiss(self.obj)
221
222 def callback_dismissed_add(self, func, *args, **kwargs):
223 """When popup is closed as a result of a dismiss.
224
225 .. versionadded:: 1.17
226
227 """
228 self._callback_add("dismissed", func, args, kwargs)
229
230 def callback_dismissed_del(self, func):
231 self._callback_del("dismissed", func)
232
214 def callback_timeout_add(self, func, *args, **kwargs): 233 def callback_timeout_add(self, func, *args, **kwargs):
215 """When popup is closed as a result of timeout.""" 234 """When popup is closed as a result of timeout."""
216 self._callback_add("timeout", func, args, kwargs) 235 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":
33 double elm_popup_timeout_get(const Evas_Object *obj) 33 double elm_popup_timeout_get(const Evas_Object *obj)
34 void elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow) 34 void elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow)
35 Eina_Bool elm_popup_allow_events_get(const Evas_Object *obj) 35 Eina_Bool elm_popup_allow_events_get(const Evas_Object *obj)
36 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):
168 g_popup.show() 168 g_popup.show()
169 169
170 170
171def _popup_dismissed_cb(popup):
172 print("dismissed", popup)
173 popup.delete()
174
175def cb_popup_center_title_1button_hide_effect(li, item, win):
176 popup = Popup(win, text="This Popup has title area, content area and " \
177 "action area set, action area has one button Close",
178 size_hint_expand=EXPAND_BOTH)
179 popup.part_text_set("title", "Title")
180 popup.callback_dismissed_add(_popup_dismissed_cb)
181
182 btn = Button(popup, text="Close")
183 btn.callback_clicked_add(lambda b: popup.dismiss())
184 popup.part_content_set("button1", btn)
185
186 popup.show()
187
188
189
171def popup_clicked(obj): 190def popup_clicked(obj):
172 win = StandardWindow("popup", "Popup test", autodel=True, size=(480, 800)) 191 win = StandardWindow("popup", "Popup test", autodel=True, size=(400, 400))
173 if obj is None: 192 if obj is None:
174 win.callback_delete_request_add(lambda o: elementary.exit()) 193 win.callback_delete_request_add(lambda o: elementary.exit())
175 194
@@ -196,6 +215,8 @@ def popup_clicked(obj):
196 cb_popup_center_title_text_2button_restack, win) 215 cb_popup_center_title_text_2button_restack, win)
197 li.item_append("popup-center-text + 1 button (check hide, show)", None, None, 216 li.item_append("popup-center-text + 1 button (check hide, show)", None, None,
198 cb_popup_center_text_1button_hide_show, win) 217 cb_popup_center_text_1button_hide_show, win)
218 li.item_append("popup-center-title + text + 1 button + hide effect", None, None,
219 cb_popup_center_title_1button_hide_effect, win)
199 220
200 li.go() 221 li.go()
201 222