aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--efl/elementary/popup.pxi19
-rw-r--r--efl/elementary/popup_cdef.pxi2
-rw-r--r--examples/elementary/test_popup.py39
3 files changed, 56 insertions, 4 deletions
diff --git a/efl/elementary/popup.pxi b/efl/elementary/popup.pxi
index 90a54f8..19940db 100644
--- a/efl/elementary/popup.pxi
+++ b/efl/elementary/popup.pxi
@@ -219,6 +219,25 @@ cdef class Popup(LayoutClass):
"""
elm_popup_dismiss(self.obj)
+ property align:
+ """The alignment of the popup object.
+
+ The alignment in which the popup will appear inside its parent.
+
+ :type: 2 doubles tuple: (horiz, vert)
+
+ .. versionadded:: 1.18
+
+ """
+ def __set__(self, value):
+ cdef double h, v
+ h, v = value
+ elm_popup_align_set(self.obj, h, v)
+ def __get__(self):
+ cdef double h, v
+ elm_popup_align_get(self.obj, &h, &v)
+ return (h, v)
+
def callback_dismissed_add(self, func, *args, **kwargs):
"""When popup is closed as a result of a dismiss.
diff --git a/efl/elementary/popup_cdef.pxi b/efl/elementary/popup_cdef.pxi
index 3f75bd4..4d27f90 100644
--- a/efl/elementary/popup_cdef.pxi
+++ b/efl/elementary/popup_cdef.pxi
@@ -24,6 +24,8 @@ cdef extern from "Elementary.h":
Evas_Object *elm_popup_add(Evas_Object *parent)
+ void elm_popup_align_set(Evas_Object *obj, double horizontal, double vertical)
+ void elm_popup_align_get(const Evas_Object *obj, double *horizontal, double *vertical)
Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, void *data)
void elm_popup_content_text_wrap_type_set(Evas_Object *obj, Elm_Wrap_Type wrap)
Elm_Wrap_Type elm_popup_content_text_wrap_type_get(const Evas_Object *obj)
diff --git a/examples/elementary/test_popup.py b/examples/elementary/test_popup.py
index c938151..77b1081 100644
--- a/examples/elementary/test_popup.py
+++ b/examples/elementary/test_popup.py
@@ -5,7 +5,7 @@ import os
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \
FilledImage
-from efl import elementary
+from efl import elementary as elm
from efl.elementary.window import StandardWindow
from efl.elementary.button import Button
from efl.elementary.list import List, ELM_LIST_LIMIT
@@ -184,13 +184,39 @@ def cb_popup_center_title_1button_hide_effect(li, item, win):
popup.part_content_set("button1", btn)
popup.show()
-
+def cb_popup_align(li, item, win):
+ popup = Popup(win, text="Align (0.2, 0.8)", align=(0.2, 0.8),
+ size_hint_weight=EXPAND_BOTH)
+ bt = Button(win, text="Close")
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button1", bt)
+ popup.show()
+
+def cb_popup_orient(li, item, win, name, orient):
+ popup = Popup(win, text=name, orient=orient, size_hint_weight=EXPAND_BOTH)
+ bt = Button(win, text="Close")
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button1", bt)
+ popup.show()
+
+orients = [
+ ("ELM_POPUP_ORIENT_TOP", elm.ELM_POPUP_ORIENT_TOP),
+ ("ELM_POPUP_ORIENT_CENTER", elm.ELM_POPUP_ORIENT_CENTER),
+ ("ELM_POPUP_ORIENT_BOTTOM", elm.ELM_POPUP_ORIENT_BOTTOM),
+ ("ELM_POPUP_ORIENT_LEFT", elm.ELM_POPUP_ORIENT_LEFT),
+ ("ELM_POPUP_ORIENT_RIGHT", elm.ELM_POPUP_ORIENT_RIGHT),
+ ("ELM_POPUP_ORIENT_TOP_LEFT", elm.ELM_POPUP_ORIENT_TOP_LEFT),
+ ("ELM_POPUP_ORIENT_TOP_RIGHT", elm.ELM_POPUP_ORIENT_TOP_RIGHT),
+ ("ELM_POPUP_ORIENT_BOTTOM_LEFT", elm.ELM_POPUP_ORIENT_BOTTOM_LEFT),
+ ("ELM_POPUP_ORIENT_BOTTOM_RIGHT", elm.ELM_POPUP_ORIENT_BOTTOM_RIGHT),
+]
+
def popup_clicked(obj):
win = StandardWindow("popup", "Popup test", autodel=True, size=(400, 400))
if obj is None:
- win.callback_delete_request_add(lambda o: elementary.exit())
+ win.callback_delete_request_add(lambda o: elm.exit())
li = List(win, mode=ELM_LIST_LIMIT, size_hint_weight=EXPAND_BOTH)
li.callback_selected_add(lambda li, it: it.selected_set(False))
@@ -217,6 +243,11 @@ def popup_clicked(obj):
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.item_append("Popup Align (0.2, 0.8)", None, None,
+ cb_popup_align, win)
+ for name, val in orients:
+ li.item_append("Popup Orient (%s)" % name, None, None,
+ cb_popup_orient, win, name, val)
li.go()
@@ -227,4 +258,4 @@ if __name__ == "__main__":
popup_clicked(None)
- elementary.run()
+ elm.run()