fix pixbuf saves and missing import
This commit is contained in:
parent
63d0c2dcf4
commit
4e16b113b3
4 changed files with 8 additions and 7 deletions
|
@ -421,7 +421,7 @@ def get_pixbuf_from_data(file_data, want_type = False):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if want_type:
|
if want_type:
|
||||||
typ = pixbufloader.get_format()['name']
|
typ = pixbufloader.get_format().get_name()
|
||||||
return pixbuf, typ
|
return pixbuf, typ
|
||||||
else:
|
else:
|
||||||
return pixbuf
|
return pixbuf
|
||||||
|
@ -828,14 +828,14 @@ def on_avatar_save_as_menuitem_activate(widget, jid, default_name=''):
|
||||||
|
|
||||||
# Save image
|
# Save image
|
||||||
try:
|
try:
|
||||||
pixbuf.save(file_path, image_format)
|
pixbuf.savev(file_path, image_format, [], [])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.debug('Error saving avatar: %s' % str(e))
|
log.debug('Error saving avatar: %s' % str(e))
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
new_file_path = '.'.join(file_path.split('.')[:-1]) + '.jpeg'
|
new_file_path = '.'.join(file_path.split('.')[:-1]) + '.jpeg'
|
||||||
def on_ok(file_path, pixbuf):
|
def on_ok(file_path, pixbuf):
|
||||||
pixbuf.save(file_path, 'jpeg')
|
pixbuf.savev(file_path, 'jpeg', [], [])
|
||||||
dialogs.ConfirmationDialog(_('Extension not supported'),
|
dialogs.ConfirmationDialog(_('Extension not supported'),
|
||||||
_('Image cannot be saved in %(type)s format. Save as '
|
_('Image cannot be saved in %(type)s format. Save as '
|
||||||
'%(new_filename)s?') % {'type': image_format,
|
'%(new_filename)s?') % {'type': image_format,
|
||||||
|
|
|
@ -2489,7 +2489,7 @@ class Interface:
|
||||||
extension = '.png'
|
extension = '.png'
|
||||||
path_to_original_file = path_to_file + extension
|
path_to_original_file = path_to_file + extension
|
||||||
try:
|
try:
|
||||||
pixbuf.save(path_to_original_file, typ)
|
pixbuf.savev(path_to_original_file, typ, [], [])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error('Error writing avatar file %s: %s' % (
|
log.error('Error writing avatar file %s: %s' % (
|
||||||
path_to_original_file, str(e)))
|
path_to_original_file, str(e)))
|
||||||
|
@ -2499,7 +2499,7 @@ class Interface:
|
||||||
path_to_normal_file = path_to_file + '_notif_size_colored' + \
|
path_to_normal_file = path_to_file + '_notif_size_colored' + \
|
||||||
extension
|
extension
|
||||||
try:
|
try:
|
||||||
pixbuf.save(path_to_normal_file, 'png')
|
pixbuf.savev(path_to_normal_file, 'png', [], [])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error('Error writing avatar file %s: %s' % \
|
log.error('Error writing avatar file %s: %s' % \
|
||||||
(path_to_original_file, str(e)))
|
(path_to_original_file, str(e)))
|
||||||
|
@ -2509,7 +2509,7 @@ class Interface:
|
||||||
if bwbuf:
|
if bwbuf:
|
||||||
path_to_bw_file = path_to_file + '_notif_size_bw' + extension
|
path_to_bw_file = path_to_file + '_notif_size_bw' + extension
|
||||||
try:
|
try:
|
||||||
bwbuf.save(path_to_bw_file, 'png')
|
bwbuf.savev(path_to_bw_file, 'png', [], [])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error('Error writing avatar file %s: %s' % \
|
log.error('Error writing avatar file %s: %s' % \
|
||||||
(path_to_original_file, str(e)))
|
(path_to_original_file, str(e)))
|
||||||
|
|
|
@ -150,7 +150,7 @@ class ProfileWindow:
|
||||||
if scaled_pixbuf:
|
if scaled_pixbuf:
|
||||||
path_to_file = os.path.join(gajim.TMP,
|
path_to_file = os.path.join(gajim.TMP,
|
||||||
'avatar_scaled.png')
|
'avatar_scaled.png')
|
||||||
scaled_pixbuf.save(path_to_file, 'png')
|
scaled_pixbuf.savev(path_to_file, 'png', [], [])
|
||||||
must_delete = True
|
must_delete = True
|
||||||
|
|
||||||
fd = open(path_to_file, 'rb')
|
fd = open(path_to_file, 'rb')
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
|
from gi.repository import Gdk
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
|
|
Loading…
Add table
Reference in a new issue