fix pixbuf saves and missing import
This commit is contained in:
parent
63d0c2dcf4
commit
4e16b113b3
|
@ -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,
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue