we can now have animations in textview
This commit is contained in:
parent
8e94b98d6e
commit
8ac67fef09
3 changed files with 21 additions and 12 deletions
15
src/chat.py
15
src/chat.py
|
@ -612,22 +612,27 @@ class Chat:
|
||||||
index = end # update index
|
index = end # update index
|
||||||
|
|
||||||
#now print it
|
#now print it
|
||||||
self.print_special_text(special_text, other_tags,
|
self.print_special_text(special_text, other_tags, textview)
|
||||||
buffer)
|
|
||||||
|
|
||||||
return index
|
return index
|
||||||
|
|
||||||
def print_special_text(self, special_text, other_tags, buffer):
|
def print_special_text(self, special_text, other_tags, textview):
|
||||||
tags = []
|
tags = []
|
||||||
use_other_tags = True
|
use_other_tags = True
|
||||||
|
buffer = textview.get_buffer()
|
||||||
|
|
||||||
possible_emot_ascii_caps = special_text.upper() # emoticons keys are CAPS
|
possible_emot_ascii_caps = special_text.upper() # emoticons keys are CAPS
|
||||||
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
|
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
|
||||||
#it's an emoticon
|
#it's an emoticon
|
||||||
emot_ascii = possible_emot_ascii_caps
|
emot_ascii = possible_emot_ascii_caps
|
||||||
end_iter = buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
buffer.insert_pixbuf(end_iter,
|
anchor = buffer.create_child_anchor(end_iter)
|
||||||
self.plugin.emoticons[emot_ascii])
|
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:'):
|
elif special_text.startswith('mailto:'):
|
||||||
#it's a mail
|
#it's a mail
|
||||||
tags.append('mail')
|
tags.append('mail')
|
||||||
|
|
|
@ -1691,9 +1691,13 @@ class ManageEmoticonsWindow:
|
||||||
img.set_from_file(image)
|
img.set_from_file(image)
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
if img.get_storage_type() != gtk.IMAGE_PIXBUF:
|
t = img.get_storage_type()
|
||||||
return False
|
if t == gtk.IMAGE_PIXBUF:
|
||||||
pix = img.get_pixbuf()
|
pix = img.get_pixbuf()
|
||||||
|
elif t == gtk.IMAGE_ANIMATION:
|
||||||
|
pix = img.get_animation().get_static_image()
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
if pix.get_width() > 24 or pix.get_height() > 24:
|
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()
|
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()
|
||||||
|
|
10
src/gajim.py
10
src/gajim.py
|
@ -664,9 +664,8 @@ class Interface:
|
||||||
img.set_from_file(image)
|
img.set_from_file(image)
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
if img.get_storage_type() == gtk.IMAGE_PIXBUF:
|
t = img.get_storage_type()
|
||||||
pix = img.get_pixbuf()
|
if t != gtk.IMAGE_PIXBUF and t != gtk.IMAGE_ANIMATION:
|
||||||
else:
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -727,8 +726,9 @@ class Interface:
|
||||||
emot_file = gajim.config.get_per('emoticons', emot, 'path')
|
emot_file = gajim.config.get_per('emoticons', emot, 'path')
|
||||||
if not self.image_is_ok(emot_file):
|
if not self.image_is_ok(emot_file):
|
||||||
continue
|
continue
|
||||||
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
|
img = gtk.Image()
|
||||||
self.emoticons[emot] = pix
|
img.set_from_file(emot_file)
|
||||||
|
self.emoticons[emot] = emot_file
|
||||||
|
|
||||||
# update regular expressions
|
# update regular expressions
|
||||||
self.make_regexps()
|
self.make_regexps()
|
||||||
|
|
Loading…
Add table
Reference in a new issue