don't resize empty and animation icon.Fixes #7225

This commit is contained in:
Denis Fomin 2012-08-31 15:42:25 +04:00
parent 94bc66dfab
commit 3ec7e2eee4
1 changed files with 21 additions and 9 deletions

View File

@ -1042,6 +1042,13 @@ def make_jabber_state_images():
iconset = gajim.config.DEFAULT_ICONSET
gajim.config.set('iconset', iconset)
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
gajim.interface.jabber_state_images['16'] = load_iconset(path)
pixo, pixc = load_icons_meta()
gajim.interface.jabber_state_images['opened'] = load_iconset(path, pixo)
gajim.interface.jabber_state_images['closed'] = load_iconset(path, pixc)
path = os.path.join(helpers.get_iconset_path(iconset), '32x32')
gajim.interface.jabber_state_images['32'] = load_iconset(path)
@ -1052,18 +1059,23 @@ def make_jabber_state_images():
# Resize 32x32 icons to 24x24
for each in gajim.interface.jabber_state_images['32']:
img = gtk.Image()
pix = gajim.interface.jabber_state_images['32'][each].get_pixbuf()
scaled_pix = pix.scale_simple(24, 24, gtk.gdk.INTERP_BILINEAR)
pix = gajim.interface.jabber_state_images['32'][each]
pix_type = pix.get_storage_type()
if pix_type == gtk.IMAGE_ANIMATION:
animation = pix.get_animation()
pixbuf = animation.get_static_image()
elif pix_type == gtk.IMAGE_EMPTY:
pix = gajim.interface.jabber_state_images['16'][each]
pix_16_type = pix.get_storage_type()
if pix_16_type == gtk.IMAGE_ANIMATION:
animation = pix.get_animation()
pixbuf = animation.get_static_image()
else:
pixbuf = pix.get_pixbuf()
scaled_pix = pixbuf.scale_simple(24, 24, gtk.gdk.INTERP_BILINEAR)
img.set_from_pixbuf(scaled_pix)
gajim.interface.jabber_state_images['24'][each] = img
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
gajim.interface.jabber_state_images['16'] = load_iconset(path)
pixo, pixc = load_icons_meta()
gajim.interface.jabber_state_images['opened'] = load_iconset(path, pixo)
gajim.interface.jabber_state_images['closed'] = load_iconset(path, pixc)
def reload_jabber_state_images():
make_jabber_state_images()
gajim.interface.roster.update_jabber_state_images()