File: test-default-action.py

package info (click to toggle)
notify-python 0.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,516 kB
  • ctags: 90
  • sloc: sh: 8,496; ansic: 622; python: 255; makefile: 111
file content (27 lines) | stat: -rwxr-xr-x 575 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import pynotify
import sys

def default_cb(n, action):
    assert action == "default"
    print "You clicked the default action"
    n.close()
    gtk.main_quit()

if __name__ == '__main__':
    if not pynotify.init("Default Action Test"):
        sys.exit(1)

    n = pynotify.Notification("Matt is online")
    n.set_category("presence.online")
    n.add_action("default", "Default Action", default_cb)

    if not n.show():
        print "Failed to send notification"
        sys.exit(1)

    gtk.main()