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-default-action.py < prev    next >
Encoding:
Python Source  |  2006-04-25  |  575 b   |  28 lines

  1. #!/usr/bin/env python
  2.  
  3. import pygtk
  4. pygtk.require('2.0')
  5. import gtk
  6. import pynotify
  7. import sys
  8.  
  9. def default_cb(n, action):
  10.     assert action == "default"
  11.     print "You clicked the default action"
  12.     n.close()
  13.     gtk.main_quit()
  14.  
  15. if __name__ == '__main__':
  16.     if not pynotify.init("Default Action Test"):
  17.         sys.exit(1)
  18.  
  19.     n = pynotify.Notification("Matt is online")
  20.     n.set_category("presence.online")
  21.     n.add_action("default", "Default Action", default_cb)
  22.  
  23.     if not n.show():
  24.         print "Failed to send notification"
  25.         sys.exit(1)
  26.  
  27.     gtk.main()
  28.