we can now have animations in textview

This commit is contained in:
Yann Leboulanger 2005-06-18 15:57:06 +00:00
parent 8e94b98d6e
commit 8ac67fef09
3 changed files with 21 additions and 12 deletions

View File

@ -612,22 +612,27 @@ class Chat:
index = end # update index
#now print it
self.print_special_text(special_text, other_tags,
buffer)
self.print_special_text(special_text, other_tags, textview)
return index
def print_special_text(self, special_text, other_tags, buffer):
def print_special_text(self, special_text, other_tags, textview):
tags = []
use_other_tags = True
buffer = textview.get_buffer()
possible_emot_ascii_caps = special_text.upper() # emoticons keys are CAPS
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
#it's an emoticon
emot_ascii = possible_emot_ascii_caps
end_iter = buffer.get_end_iter()
buffer.insert_pixbuf(end_iter,
self.plugin.emoticons[emot_ascii])
anchor = buffer.create_child_anchor(end_iter)
w = gtk.Image()
w.set_from_file(self.plugin.emoticons[emot_ascii])
w.show()
textview.add_child_at_anchor(w, anchor)
# buffer.insert_pixbuf(end_iter,
# self.plugin.emoticons[emot_ascii])
elif special_text.startswith('mailto:'):
#it's a mail
tags.append('mail')

View File

@ -1691,9 +1691,13 @@ class ManageEmoticonsWindow:
img.set_from_file(image)
except:
return False
if img.get_storage_type() != gtk.IMAGE_PIXBUF:
t = img.get_storage_type()
if t == gtk.IMAGE_PIXBUF:
pix = img.get_pixbuf()
elif t == gtk.IMAGE_ANIMATION:
pix = img.get_animation().get_static_image()
else:
return False
pix = img.get_pixbuf()
if pix.get_width() > 24 or pix.get_height() > 24:
dialogs.ErrorDialog(_('Image is too big'), _('Image for emoticon has to be less than or equal to 24 pixels in width and 24 in height.')).get_response()

View File

@ -664,9 +664,8 @@ class Interface:
img.set_from_file(image)
except:
return False
if img.get_storage_type() == gtk.IMAGE_PIXBUF:
pix = img.get_pixbuf()
else:
t = img.get_storage_type()
if t != gtk.IMAGE_PIXBUF and t != gtk.IMAGE_ANIMATION:
return False
return True
@ -727,8 +726,9 @@ class Interface:
emot_file = gajim.config.get_per('emoticons', emot, 'path')
if not self.image_is_ok(emot_file):
continue
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
self.emoticons[emot] = pix
img = gtk.Image()
img.set_from_file(emot_file)
self.emoticons[emot] = emot_file
# update regular expressions
self.make_regexps()