~jconti/recent-notifications/trunk

« back to all changes in this revision

Viewing changes to tests/test_pixbuf.py

  • Committer: Jason Conti
  • Date: 2011-04-05 19:03:12 UTC
  • Revision ID: jason.conti@gmail.com-20110405190312-itbygycjwlneewkw
GdkPixbuf.Pixbuf.new_from_data is partially fixed with the latest update in Natty, however the pixbufs are extremely corrupted unless copied to a freshly allocated pixbuf first. Using that workaround for now, and reenabled icons from image_data.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
import gtk
8
8
import os
9
9
import pynotify
 
10
import sys
10
11
 
11
12
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
12
 
ICON_PATH = os.path.join(SCRIPT_PATH, "..", "icons", "recent-notifications.svg")
 
13
ICON_PATH = os.path.join(SCRIPT_PATH, "..", "icons")
13
14
 
14
15
def main():
 
16
  if len(sys.argv) < 2:
 
17
    icon = os.path.join(ICON_PATH, "recent-notifications.svg")
 
18
  else:
 
19
    icon = os.path.join(ICON_PATH, sys.argv[1])
 
20
 
15
21
  if not pynotify.init("test_pixbuf"):
16
22
    print "Failed to initialize notifications."
17
23
    sys.exit(1)
19
25
  n = pynotify.Notification("TestPixbuf",
20
26
      "This is a test, this is only a test.")
21
27
 
22
 
  pixbuf = gtk.gdk.pixbuf_new_from_file(ICON_PATH)
 
28
  pixbuf = gtk.gdk.pixbuf_new_from_file(icon)
23
29
 
24
30
  n.set_icon_from_pixbuf(pixbuf)
25
31