File: test-urgency.py

package info (click to toggle)
notify-python 0.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,516 kB
  • sloc: sh: 8,496; ansic: 622; python: 255; makefile: 110
file content (39 lines) | stat: -rwxr-xr-x 972 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
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python

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

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

    # Low Urgency
    n = pynotify.Notification("Low Urgency", "Joe signed online.")
    n.set_urgency(pynotify.URGENCY_LOW)

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


    # Normal Urgency
    n = pynotify.Notification("Normal Urgency",
                              "You have a meeting in 10 minutes.")
    n.set_urgency(pynotify.URGENCY_NORMAL)

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


    # Critical Urgency
    n = pynotify.Notification("Critical Urgency",
                              "This message will self-destruct in 10 seconds.")
    n.set_urgency(pynotify.URGENCY_CRITICAL)
    n.set_timeout(10000) # 10 seconds

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