home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-notify / examples / test-urgency.py < prev    next >
Encoding:
Python Source  |  2006-04-25  |  972 b   |  40 lines

  1. #!/usr/bin/env python
  2.  
  3. import pygtk
  4. pygtk.require('2.0')
  5. import pynotify
  6. import sys
  7.  
  8. if __name__ == '__main__':
  9.     if not pynotify.init("Urgency"):
  10.         sys.exit(1)
  11.  
  12.     # Low Urgency
  13.     n = pynotify.Notification("Low Urgency", "Joe signed online.")
  14.     n.set_urgency(pynotify.URGENCY_LOW)
  15.  
  16.     if not n.show():
  17.         print "Failed to send notification"
  18.         sys.exit(1)
  19.  
  20.  
  21.     # Normal Urgency
  22.     n = pynotify.Notification("Normal Urgency",
  23.                               "You have a meeting in 10 minutes.")
  24.     n.set_urgency(pynotify.URGENCY_NORMAL)
  25.  
  26.     if not n.show():
  27.         print "Failed to send notification"
  28.         sys.exit(1)
  29.  
  30.  
  31.     # Critical Urgency
  32.     n = pynotify.Notification("Critical Urgency",
  33.                               "This message will self-destruct in 10 seconds.")
  34.     n.set_urgency(pynotify.URGENCY_CRITICAL)
  35.     n.set_timeout(10000) # 10 seconds
  36.  
  37.     if not n.show():
  38.         print "Failed to send notification"
  39.         sys.exit(1)
  40.