diff options
author | Kai Huuhko <kai.huuhko@gmail.com> | 2015-04-28 03:12:16 +0300 |
---|---|---|
committer | Kai Huuhko <kai.huuhko@gmail.com> | 2015-04-28 03:12:16 +0300 |
commit | d87ce265454b5423c39c89e18562fb001efe1fd0 (patch) | |
tree | ad179bea9fa035282876a3b18c89de8c188640c2 | |
parent | fa3733b57f629f19dbd56615c485d63fb4a79378 (diff) |
Examples: Add systray test/example to the main menu
-rwxr-xr-x | examples/elementary/test.py | 1 | ||||
-rw-r--r-- | examples/elementary/test_systray.py | 40 |
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 | ||
3 | from efl.ecore import ECORE_CALLBACK_DONE | ||
4 | import efl.elementary as elm | 3 | import efl.elementary as elm |
5 | elm.init() | ||
6 | if not elm.need_systray(): | ||
7 | raise SystemExit("systray support missing") | ||
8 | 4 | ||
9 | from efl.elementary.window import StandardWindow | 5 | from efl.elementary.window import StandardWindow |
10 | from efl.elementary.systray import Systray, on_systray_ready | 6 | from efl.elementary.systray import Systray, on_systray_ready |
11 | from efl.elementary.menu import Menu | 7 | from efl.elementary.menu import Menu |
12 | 8 | ||
13 | 9 | ||
14 | def ready_cb(event): | 10 | def 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 | ||
20 | win = StandardWindow("test", "systray test", size=(400, 400)) | 22 | global tray |
21 | win.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 | ||
23 | on_systray_ready(ready_cb) | 28 | on_systray_ready(lambda x: tray.register()) |
24 | 29 | ||
25 | menu = Menu(win) | 30 | win.show() |
26 | menu.item_add(None, "it works!") | ||
27 | 31 | ||
28 | tray = Systray(win) | 32 | if __name__ == "__main__": |
29 | tray.icon_name = "elementary" | 33 | elm.init() |
30 | tray.att_icon_name = "elementary" | ||
31 | tray.menu = menu | ||
32 | 34 | ||
33 | win.show() | 35 | systray_clicked(None) |
34 | 36 | ||
35 | elm.run() | 37 | elm.run() |
36 | elm.shutdown() | 38 | elm.shutdown() |