aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary/test_notify.py
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
commitb58be93f121c2ca240b888d1dd41896d4779927f (patch)
tree371d4e331b3e685e106b211ce3e28b31e9886ada /examples/elementary/test_notify.py
parentPython-EFL: Cleanup and enable compilation of emotion, cleaned also the test. (diff)
downloadpython-efl-b58be93f121c2ca240b888d1dd41896d4779927f.tar.gz
move elementary and emotion tests in a new examples dir. Now tests/ contain only unittest while examples/ all the other tests that need user interaction
SVN revision: 83964
Diffstat (limited to 'examples/elementary/test_notify.py')
-rw-r--r--examples/elementary/test_notify.py118
1 files changed, 118 insertions, 0 deletions
diff --git a/examples/elementary/test_notify.py b/examples/elementary/test_notify.py
new file mode 100644
index 0000000..28f2c24
--- /dev/null
+++ b/examples/elementary/test_notify.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def notify_close(bt, notify):
+ notify.hide()
+
+def notify_show(bt, win, orient):
+ notify = elementary.Notify(win)
+ notify.repeat_events_set(False)
+ notify.timeout_set(5)
+ notify.orient_set(orient)
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.horizontal_set(True)
+ notify.content_set(bx)
+ bx.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Text notification")
+ bx.pack_end(lb)
+ lb.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Close")
+ bt.callback_clicked_add(notify_close, notify)
+ bx.pack_end(bt)
+ bt.show()
+ notify.show()
+
+def notify_clicked(obj):
+ win = elementary.Window("notify", elementary.ELM_WIN_BASIC)
+ win.title_set("Notify test")
+ win.autodel_set(True)
+ win.size_hint_min_set(160, 160)
+ win.size_hint_max_set(320, 320)
+ win.resize(320, 320)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(tb)
+ tb.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP)
+ tb.pack(bt, 1, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Center")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER)
+ tb.pack(bt, 1, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM)
+ tb.pack(bt, 1, 2, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Left")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_LEFT)
+ tb.pack(bt, 0, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top Left")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_LEFT)
+ tb.pack(bt, 0, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom Left")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_LEFT)
+ tb.pack(bt, 0, 2, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Right")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_RIGHT)
+ tb.pack(bt, 2, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top Right")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_RIGHT)
+ tb.pack(bt, 2, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom Right")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_RIGHT)
+ tb.pack(bt, 2, 2, 1, 1)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ notify_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()