From 9c7a058ef491631cf51b0a78ca482a9456388e01 Mon Sep 17 00:00:00 2001 From: Helge Herz Date: Sun, 10 Feb 2013 15:23:06 +0000 Subject: [PATCH] Revert svn21255 (svn21254 in branches/maintenance/gramps40) as discussed in issue 6424 svn: r21329 --- gramps/gui/pluginmanager.py | 18 +++--------------- gramps/gui/thumbnails.py | 36 ++++++------------------------------ 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/gramps/gui/pluginmanager.py b/gramps/gui/pluginmanager.py index 5ed6d199a..ff094bd92 100644 --- a/gramps/gui/pluginmanager.py +++ b/gramps/gui/pluginmanager.py @@ -84,21 +84,13 @@ def base_reg_stock_icons(iconpaths, extraiconsize, items): icon_file = os.path.expanduser(os.path.join(dirname, data[0]+ext)) if os.path.isfile(icon_file): try: - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > \ - (2, 26) or not win(): - pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file) - else: - pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (icon_file) + pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file) break except: pass if not pixbuf : - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \ - not win(): - pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON) - else: - pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (ICON) + pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON) pixbuf = pixbuf.add_alpha(True, 255, 255, 255) icon_set = Gtk.IconSet.new_from_pixbuf (pixbuf) @@ -109,11 +101,7 @@ def base_reg_stock_icons(iconpaths, extraiconsize, items): os.path.join(size[0], data[0]+'.png')) if os.path.isfile(icon_file): try: - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > \ - (2, 26) or not win(): - pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file) - else: - pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (icon_file) + pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file) except: pass diff --git a/gramps/gui/thumbnails.py b/gramps/gui/thumbnails.py index 6a912c92e..261f565b1 100644 --- a/gramps/gui/thumbnails.py +++ b/gramps/gui/thumbnails.py @@ -187,11 +187,7 @@ def __create_thumbnail_image(src_file, mtype=None, rectangle=None, # build a thumbnail by scaling the image using GTK's built in # routines. try: - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or\ - not win(): - pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file) - else: - pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8(src_file) + pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file) width = pixbuf.get_width() height = pixbuf.get_height() @@ -220,11 +216,7 @@ def __create_thumbnail_image(src_file, mtype=None, rectangle=None, pixbuf = pixbuf.scale_simple(scaled_width, scaled_height, GdkPixbuf.InterpType.BILINEAR) - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \ - not win(): - pixbuf.savev(filename, "png", "", "") - else: - pixbuf.savev_utf8(filename, "png", "", "") + pixbuf.savev(filename, "png", "", "") return True except Exception as err: LOG.warn("Error scaling image down: %s", str(err)) @@ -249,17 +241,9 @@ def find_mime_type_pixbuf(mime_type): newicon = "gnome-mime-%s" % icontmp return _icon_theme.load_icon(newicon,48,0) except: - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) \ - or not win(): - return GdkPixbuf.Pixbuf.new_from_file(ICON) - else: - return GdkPixbuf.Pixbuf.new_from_file_utf8(ICON) + return GdkPixbuf.Pixbuf.new_from_file(ICON) except: - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) \ - or not win(): - return GdkPixbuf.Pixbuf.new_from_file(ICON) - else: - return GdkPixbuf.Pixbuf.new_from_file_utf8(ICON) + return GdkPixbuf.Pixbuf.new_from_file(ICON) #------------------------------------------------------------------------- # # run_thumbnailer @@ -336,21 +320,13 @@ def get_thumbnail_image(src_file, mtype=None, rectangle=None, size=SIZE_NORMAL): """ try: filename = get_thumbnail_path(src_file, mtype, rectangle, size) - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \ - not win(): - return GdkPixbuf.Pixbuf.new_from_file(filename) - else: - return GdkPixbuf.Pixbuf.new_from_file_utf8(filename) + return GdkPixbuf.Pixbuf.new_from_file(filename) except (GObject.GError, OSError): if mtype: return find_mime_type_pixbuf(mtype) else: default = os.path.join(IMAGE_DIR, "document.png") - if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \ - not win(): - return GdkPixbuf.Pixbuf.new_from_file(default) - else: - return GdkPixbuf.Pixbuf.new_from_file_utf8(default) + return GdkPixbuf.Pixbuf.new_from_file(default) #------------------------------------------------------------------------- #