Revert svn21255 (svn21254 in branches/maintenance/gramps40) as discussed in issue 6424
svn: r21329
This commit is contained in:
parent
8066052641
commit
9c7a058ef4
@ -84,21 +84,13 @@ def base_reg_stock_icons(iconpaths, extraiconsize, items):
|
|||||||
icon_file = os.path.expanduser(os.path.join(dirname, data[0]+ext))
|
icon_file = os.path.expanduser(os.path.join(dirname, data[0]+ext))
|
||||||
if os.path.isfile(icon_file):
|
if os.path.isfile(icon_file):
|
||||||
try:
|
try:
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > \
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file)
|
||||||
(2, 26) or not win():
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file)
|
|
||||||
else:
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (icon_file)
|
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not pixbuf :
|
if not pixbuf :
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON)
|
||||||
not win():
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON)
|
|
||||||
else:
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (ICON)
|
|
||||||
|
|
||||||
pixbuf = pixbuf.add_alpha(True, 255, 255, 255)
|
pixbuf = pixbuf.add_alpha(True, 255, 255, 255)
|
||||||
icon_set = Gtk.IconSet.new_from_pixbuf (pixbuf)
|
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'))
|
os.path.join(size[0], data[0]+'.png'))
|
||||||
if os.path.isfile(icon_file):
|
if os.path.isfile(icon_file):
|
||||||
try:
|
try:
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > \
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file)
|
||||||
(2, 26) or not win():
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file (icon_file)
|
|
||||||
else:
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (icon_file)
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -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
|
# build a thumbnail by scaling the image using GTK's built in
|
||||||
# routines.
|
# routines.
|
||||||
try:
|
try:
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or\
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file)
|
||||||
not win():
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file)
|
|
||||||
else:
|
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8(src_file)
|
|
||||||
width = pixbuf.get_width()
|
width = pixbuf.get_width()
|
||||||
height = pixbuf.get_height()
|
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,
|
pixbuf = pixbuf.scale_simple(scaled_width, scaled_height,
|
||||||
GdkPixbuf.InterpType.BILINEAR)
|
GdkPixbuf.InterpType.BILINEAR)
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \
|
pixbuf.savev(filename, "png", "", "")
|
||||||
not win():
|
|
||||||
pixbuf.savev(filename, "png", "", "")
|
|
||||||
else:
|
|
||||||
pixbuf.savev_utf8(filename, "png", "", "")
|
|
||||||
return True
|
return True
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
LOG.warn("Error scaling image down: %s", str(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
|
newicon = "gnome-mime-%s" % icontmp
|
||||||
return _icon_theme.load_icon(newicon,48,0)
|
return _icon_theme.load_icon(newicon,48,0)
|
||||||
except:
|
except:
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) \
|
return GdkPixbuf.Pixbuf.new_from_file(ICON)
|
||||||
or not win():
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file(ICON)
|
|
||||||
else:
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file_utf8(ICON)
|
|
||||||
except:
|
except:
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) \
|
return GdkPixbuf.Pixbuf.new_from_file(ICON)
|
||||||
or not win():
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file(ICON)
|
|
||||||
else:
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file_utf8(ICON)
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# run_thumbnailer
|
# run_thumbnailer
|
||||||
@ -336,21 +320,13 @@ def get_thumbnail_image(src_file, mtype=None, rectangle=None, size=SIZE_NORMAL):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
filename = get_thumbnail_path(src_file, mtype, rectangle, size)
|
filename = get_thumbnail_path(src_file, mtype, rectangle, size)
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \
|
return GdkPixbuf.Pixbuf.new_from_file(filename)
|
||||||
not win():
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file(filename)
|
|
||||||
else:
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file_utf8(filename)
|
|
||||||
except (GObject.GError, OSError):
|
except (GObject.GError, OSError):
|
||||||
if mtype:
|
if mtype:
|
||||||
return find_mime_type_pixbuf(mtype)
|
return find_mime_type_pixbuf(mtype)
|
||||||
else:
|
else:
|
||||||
default = os.path.join(IMAGE_DIR, "document.png")
|
default = os.path.join(IMAGE_DIR, "document.png")
|
||||||
if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26) or \
|
return GdkPixbuf.Pixbuf.new_from_file(default)
|
||||||
not win():
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file(default)
|
|
||||||
else:
|
|
||||||
return GdkPixbuf.Pixbuf.new_from_file_utf8(default)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user