gdk.pixbuf_new_from_file requires an unicode on windows

This commit is contained in:
Cédric Krier committed 2011-03-23 14:56:54 +01:00
1 parent 1de4f131f0
commit b27404e8a8
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -58,7 +58,7 @@ class TrytonIconFactory(gtk.IconFactory):
continue
try:
pixbuf = gtk.gdk.pixbuf_new_from_file(
os.path.join(PIXMAPS_DIR, fname))
os.path.join(PIXMAPS_DIR, fname).encode('utf-8'))
except Exception:
continue
icon_set = gtk.IconSet(pixbuf)
@@ -103,7 +103,7 @@ class TrytonIconFactory(gtk.IconFactory):
fileno, path = tempfile.mkstemp()
with os.fdopen(fileno, 'w') as svgfile:
svgfile.write(icon['icon'])
pixbuf = gtk.gdk.pixbuf_new_from_file(path)
pixbuf = gtk.gdk.pixbuf_new_from_file(path.encode('utf-8'))
os.remove(path)
iconset = gtk.IconSet(pixbuf)
self.add(icon['name'], iconset)
@@ -309,7 +309,8 @@ def file_selection(title, filename='', parent=None,
def update_preview_cb(win, img):
filename = win.get_preview_filename()
try:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename, 128, 128)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename.encode('utf-8'),
128, 128)
img.set_from_pixbuf(pixbuf)
have_preview = True
except Exception:
+1 -1
View File
@@ -187,7 +187,7 @@ if not os.path.isdir(PIXMAPS_DIR):
PIXMAPS_DIR = os.path.join(PREFIX, 'share', 'pixmaps', 'tryton')
TRYTON_ICON = gtk.gdk.pixbuf_new_from_file(
os.path.join(PIXMAPS_DIR, 'tryton-icon.png'))
os.path.join(PIXMAPS_DIR, 'tryton-icon.png').encode('utf-8'))
def _data_dir():
data_dir = os.path.join(CURRENT_DIR, 'share', 'tryton')