Python less 3.x uses GdkPixbuf.new_subpixbuf instead dkPixbuf.subpixbuf issue 6487

svn: r21476
This commit is contained in:
Helge Herz 2013-02-27 22:21:10 +00:00
parent c91eec3d5f
commit 357eb8af19

View File

@ -31,6 +31,7 @@ Image manipulation routines.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
import tempfile import tempfile
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -78,6 +79,9 @@ def resize_to_jpeg(source, destination, width, height, crop=None):
end_x = int((crop[2]/100.0)*img.get_width()) end_x = int((crop[2]/100.0)*img.get_width())
end_y = int((crop[3]/100.0)*img.get_height()) end_y = int((crop[3]/100.0)*img.get_height())
if sys.version_info[0] < 3:
img = img.new_subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y)
else:
img = img.subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y) img = img.subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y)
# Need to keep the ratio intact, otherwise scaled images look stretched # Need to keep the ratio intact, otherwise scaled images look stretched
@ -209,6 +213,9 @@ def resize_to_buffer(source, size, crop=None):
end_x = int((crop[2]/100.0)*img.get_width()) end_x = int((crop[2]/100.0)*img.get_width())
end_y = int((crop[3]/100.0)*img.get_height()) end_y = int((crop[3]/100.0)*img.get_height())
if sys.version_info[0] < 3:
img = img.new_subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y)
else:
img = img.subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y) img = img.subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y)
# Need to keep the ratio intact, otherwise scaled images look stretched # Need to keep the ratio intact, otherwise scaled images look stretched
@ -249,6 +256,9 @@ def resize_to_jpeg_buffer(source, size, crop=None):
end_x = int((crop[2]/100.0)*img.get_width()) end_x = int((crop[2]/100.0)*img.get_width())
end_y = int((crop[3]/100.0)*img.get_height()) end_y = int((crop[3]/100.0)*img.get_height())
if sys.version_info[0] < 3:
img = img.new_subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y)
else:
img = img.subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y) img = img.subpixbuf(start_x, start_y, end_x-start_x, end_y-start_y)
# Need to keep the ratio intact, otherwise scaled images look stretched # Need to keep the ratio intact, otherwise scaled images look stretched
@ -267,4 +277,3 @@ def resize_to_jpeg_buffer(source, size, crop=None):
except: except:
pass pass
return data return data