From 4e16b113b34fa805b07fd7c9ff77efe9fd7d0705 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Mon, 31 Dec 2012 19:38:32 +0400 Subject: [PATCH] fix pixbuf saves and missing import --- src/gtkgui_helpers.py | 6 +++--- src/gui_interface.py | 6 +++--- src/profile_window.py | 2 +- src/vcard.py | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 79f11591b..016342435 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -421,7 +421,7 @@ def get_pixbuf_from_data(file_data, want_type = False): return None if want_type: - typ = pixbufloader.get_format()['name'] + typ = pixbufloader.get_format().get_name() return pixbuf, typ else: return pixbuf @@ -828,14 +828,14 @@ def on_avatar_save_as_menuitem_activate(widget, jid, default_name=''): # Save image try: - pixbuf.save(file_path, image_format) + pixbuf.savev(file_path, image_format, [], []) except Exception, e: log.debug('Error saving avatar: %s' % str(e)) if os.path.exists(file_path): os.remove(file_path) new_file_path = '.'.join(file_path.split('.')[:-1]) + '.jpeg' def on_ok(file_path, pixbuf): - pixbuf.save(file_path, 'jpeg') + pixbuf.savev(file_path, 'jpeg', [], []) dialogs.ConfirmationDialog(_('Extension not supported'), _('Image cannot be saved in %(type)s format. Save as ' '%(new_filename)s?') % {'type': image_format, diff --git a/src/gui_interface.py b/src/gui_interface.py index 403c95693..156ac5587 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -2489,7 +2489,7 @@ class Interface: extension = '.png' path_to_original_file = path_to_file + extension try: - pixbuf.save(path_to_original_file, typ) + pixbuf.savev(path_to_original_file, typ, [], []) except Exception, e: log.error('Error writing avatar file %s: %s' % ( path_to_original_file, str(e))) @@ -2499,7 +2499,7 @@ class Interface: path_to_normal_file = path_to_file + '_notif_size_colored' + \ extension try: - pixbuf.save(path_to_normal_file, 'png') + pixbuf.savev(path_to_normal_file, 'png', [], []) except Exception, e: log.error('Error writing avatar file %s: %s' % \ (path_to_original_file, str(e))) @@ -2509,7 +2509,7 @@ class Interface: if bwbuf: path_to_bw_file = path_to_file + '_notif_size_bw' + extension try: - bwbuf.save(path_to_bw_file, 'png') + bwbuf.savev(path_to_bw_file, 'png', [], []) except Exception, e: log.error('Error writing avatar file %s: %s' % \ (path_to_original_file, str(e))) diff --git a/src/profile_window.py b/src/profile_window.py index 058b7295d..2e698284b 100644 --- a/src/profile_window.py +++ b/src/profile_window.py @@ -150,7 +150,7 @@ class ProfileWindow: if scaled_pixbuf: path_to_file = os.path.join(gajim.TMP, 'avatar_scaled.png') - scaled_pixbuf.save(path_to_file, 'png') + scaled_pixbuf.savev(path_to_file, 'png', [], []) must_delete = True fd = open(path_to_file, 'rb') diff --git a/src/vcard.py b/src/vcard.py index 242316e5f..4adf4f961 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -33,6 +33,7 @@ from gi.repository import Gtk from gi.repository import GObject +from gi.repository import Gdk import base64 import time import locale