aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-04-28 03:12:16 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2015-04-28 03:14:39 +0300
commitfb34f48c9d4a4ce80b9d4543fae1e986e0483aaf (patch)
treeee18796a65b735ba7fa8c4ff84b371dd9d1550e1 /examples
parentEmotion: Fix documentation paragraph title (diff)
downloadpython-efl-fb34f48c9d4a4ce80b9d4543fae1e986e0483aaf.tar.gz
Examples: Add systray test/example to the main menu
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/elementary/test.py1
-rw-r--r--examples/elementary/test_systray.py40
2 files changed, 22 insertions, 19 deletions
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index 72d8ee7..e306cc0 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -237,6 +237,7 @@ items = [
]),
("System", [
("Notification", "test_sys_notify", "sys_notify_clicked"),
+ ("Systray", "test_systray", "systray_clicked"),
]),
("Text", [
("Label", "test_label", "label_clicked"),
diff --git a/examples/elementary/test_systray.py b/examples/elementary/test_systray.py
index 81feb8b..7c8791c 100644
--- a/examples/elementary/test_systray.py
+++ b/examples/elementary/test_systray.py
@@ -1,36 +1,38 @@
#!/usr/bin/python
-from efl.ecore import ECORE_CALLBACK_DONE
import efl.elementary as elm
-elm.init()
-if not elm.need_systray():
- raise SystemExit("systray support missing")
from efl.elementary.window import StandardWindow
from efl.elementary.systray import Systray, on_systray_ready
from efl.elementary.menu import Menu
-def ready_cb(event):
- print(tray.register())
+def systray_clicked(obj, item=None):
+ if not elm.need_systray():
+ print("systray support not available")
+ return
- return ECORE_CALLBACK_DONE
+ win = StandardWindow("test", "systray test", size=(400, 400), autodel=True)
+ if not obj:
+ win.callback_delete_request_add(lambda x: elm.exit())
+ menu = Menu(win)
+ menu.item_add(None, "it works!")
-win = StandardWindow("test", "systray test", size=(400, 400))
-win.callback_delete_request_add(lambda x: elm.exit())
+ global tray
+ tray = Systray(win)
+ tray.icon_name = "elementary"
+ tray.att_icon_name = "elementary"
+ tray.menu = menu
-on_systray_ready(ready_cb)
+ on_systray_ready(lambda x: tray.register())
-menu = Menu(win)
-menu.item_add(None, "it works!")
+ win.show()
-tray = Systray(win)
-tray.icon_name = "elementary"
-tray.att_icon_name = "elementary"
-tray.menu = menu
+if __name__ == "__main__":
+ elm.init()
-win.show()
+ systray_clicked(None)
-elm.run()
-elm.shutdown()
+ elm.run()
+ elm.shutdown()