summaryrefslogtreecommitdiff
path: root/examples/elementary/test_systray.py
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/elementary/test_systray.py
parent8df029d2408fa5b569cf6ac0135333db74e60ca9 (diff)
Examples: Add systray test/example to the main menu
Diffstat (limited to 'examples/elementary/test_systray.py')
-rw-r--r--examples/elementary/test_systray.py40
1 files changed, 21 insertions, 19 deletions
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 @@
1#!/usr/bin/python 1#!/usr/bin/python
2 2
3from efl.ecore import ECORE_CALLBACK_DONE
4import efl.elementary as elm 3import efl.elementary as elm
5elm.init()
6if not elm.need_systray():
7 raise SystemExit("systray support missing")
8 4
9from efl.elementary.window import StandardWindow 5from efl.elementary.window import StandardWindow
10from efl.elementary.systray import Systray, on_systray_ready 6from efl.elementary.systray import Systray, on_systray_ready
11from efl.elementary.menu import Menu 7from efl.elementary.menu import Menu
12 8
13 9
14def ready_cb(event): 10def systray_clicked(obj, item=None):
15 print(tray.register()) 11 if not elm.need_systray():
12 print("systray support not available")
13 return
16 14
17 return ECORE_CALLBACK_DONE 15 win = StandardWindow("test", "systray test", size=(400, 400), autodel=True)
16 if not obj:
17 win.callback_delete_request_add(lambda x: elm.exit())
18 18
19 menu = Menu(win)
20 menu.item_add(None, "it works!")
19 21
20win = StandardWindow("test", "systray test", size=(400, 400)) 22 global tray
21win.callback_delete_request_add(lambda x: elm.exit()) 23 tray = Systray(win)
24 tray.icon_name = "elementary"
25 tray.att_icon_name = "elementary"
26 tray.menu = menu
22 27
23on_systray_ready(ready_cb) 28 on_systray_ready(lambda x: tray.register())
24 29
25menu = Menu(win) 30 win.show()
26menu.item_add(None, "it works!")
27 31
28tray = Systray(win) 32if __name__ == "__main__":
29tray.icon_name = "elementary" 33 elm.init()
30tray.att_icon_name = "elementary"
31tray.menu = menu
32 34
33win.show() 35 systray_clicked(None)
34 36
35elm.run() 37 elm.run()
36elm.shutdown() 38 elm.shutdown()