From b27404e8a8e835495c3dc6f18e8b8b43a23af419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 23 Mar 2011 14:56:54 +0100 Subject: [PATCH] gdk.pixbuf_new_from_file requires an unicode on windows --- tryton/common/common.py | 7 ++++--- tryton/config.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index 9190b73c02..c31d490c84 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -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: diff --git a/tryton/config.py b/tryton/config.py index e0944aa718..d41373afed 100644 --- a/tryton/config.py +++ b/tryton/config.py @@ -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')