def update_icon_preview_cb(self, dialog, preview):
# Different widths make the dialog look really crappy as it resizes -
# constrain the width and adjust the height to keep perspective.
filename = dialog.get_preview_filename()
if filename is not None:
if os.path.isfile(filename):
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 320, -1)
if pixbuf is not None:
preview.set_from_pixbuf(pixbuf)
self.frame.show()
return
except GLib.Error as e:
print("Unable to generate preview for file '%s' - %s\n", filename, e.message)
preview.clear()
self.frame.hide()
评论列表
文章目录