summaryrefslogtreecommitdiff
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:12:16 +0300
commitd87ce265454b5423c39c89e18562fb001efe1fd0 (patch)
treead179bea9fa035282876a3b18c89de8c188640c2
parentfa3733b57f629f19dbd56615c485d63fb4a79378 (diff)
Examples: Add systray test/example to the main menu
-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 = [
237 ]), 237 ]),
238 ("System", [ 238 ("System", [
239 ("Notification", "test_sys_notify", "sys_notify_clicked"), 239 ("Notification", "test_sys_notify", "sys_notify_clicked"),
240 ("Systray", "test_systray", "systray_clicked"),
240 ]), 241 ]),
241 ("Text", [ 242 ("Text", [
242 ("Label", "test_label", "label_clicked"), 243 ("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 @@
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()