Revert svn21255 (svn21254 in branches/maintenance/gramps40) as discussed in issue 6424

svn: r21329
This commit is contained in:
Helge Herz 2013-02-10 15:23:06 +00:00
parent 8066052641
commit 9c7a058ef4
2 changed files with 9 additions and 45 deletions

View File

@ -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

View File

@ -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)
#-------------------------------------------------------------------------
#