nothing part 2
This commit is contained in:
parent
33fb7ea8b4
commit
d10111675b
|
@ -457,55 +457,57 @@ class Chat:
|
|||
if not print_all_special:
|
||||
other_tag = ''
|
||||
index = end # update index
|
||||
|
||||
# == PRINT SPECIAL TEXT ==
|
||||
# make it CAPS (emoticons keys are all CAPS)
|
||||
possible_emot_ascii_caps = special_text.upper()
|
||||
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
|
||||
#it's an emoticon
|
||||
tag = None
|
||||
emot_ascii = possible_emot_ascii_caps
|
||||
print 'emoticon:', emot_ascii
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
conversation_buffer.insert_pixbuf(end_iter, \
|
||||
self.plugin.emoticons[emot_ascii])
|
||||
#break # it used to be a return
|
||||
elif special_text.startswith('mailto:'):
|
||||
#it's a mail
|
||||
tag = 'mail'
|
||||
print tag
|
||||
elif self.plugin.sth_at_sth_dot_sth_re.match(special_text):
|
||||
#it's a mail
|
||||
tag = 'mail'
|
||||
print tag
|
||||
elif special_text.startswith('*') and special_text.endswith('*'):
|
||||
#it's a bold text
|
||||
tag = 'bold'
|
||||
special_text = special_text[1:-1] # remove * *
|
||||
print tag
|
||||
elif special_text.startswith('/') and special_text.endswith('/'):
|
||||
#it's an italic text
|
||||
tag = 'italic'
|
||||
special_text = special_text[1:-1] # remove / /
|
||||
print tag
|
||||
elif special_text.startswith('_') and special_text.endswith('_'):
|
||||
#it's an underlined text
|
||||
tag = 'underline'
|
||||
special_text = special_text[1:-1] # remove _ _
|
||||
print tag
|
||||
else:
|
||||
#it's a url
|
||||
tag = 'url'
|
||||
print tag
|
||||
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
if tag is not None:
|
||||
if tag in ['bold', 'italic', 'underline'] and other_tag:
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter,\
|
||||
special_text, other_tag, tag)
|
||||
else:
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter,\
|
||||
special_text, tag)
|
||||
|
||||
|
||||
#now print it
|
||||
self.print_special_text(special_text, other_tag, conversation_buffer)
|
||||
|
||||
return index, other_tag
|
||||
|
||||
def print_special_text(self, special_text, other_tag, conversation_buffer):
|
||||
# == PRINT SPECIAL TEXT ==
|
||||
# make it CAPS (emoticons keys are all CAPS)
|
||||
possible_emot_ascii_caps = special_text.upper()
|
||||
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
|
||||
#it's an emoticon
|
||||
tag = None
|
||||
emot_ascii = possible_emot_ascii_caps
|
||||
print 'emoticon:', emot_ascii
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
conversation_buffer.insert_pixbuf(end_iter, \
|
||||
self.plugin.emoticons[emot_ascii])
|
||||
elif special_text.startswith('mailto:'):
|
||||
#it's a mail
|
||||
tag = 'mail'
|
||||
print tag
|
||||
elif self.plugin.sth_at_sth_dot_sth_re.match(special_text):
|
||||
#it's a mail
|
||||
tag = 'mail'
|
||||
print tag
|
||||
elif special_text.startswith('*') and special_text.endswith('*'):
|
||||
#it's a bold text
|
||||
tag = 'bold'
|
||||
special_text = special_text[1:-1] # remove * *
|
||||
print tag
|
||||
elif special_text.startswith('/') and special_text.endswith('/'):
|
||||
#it's an italic text
|
||||
tag = 'italic'
|
||||
special_text = special_text[1:-1] # remove / /
|
||||
print tag
|
||||
elif special_text.startswith('_') and special_text.endswith('_'):
|
||||
#it's an underlined text
|
||||
tag = 'underline'
|
||||
special_text = special_text[1:-1] # remove _ _
|
||||
print tag
|
||||
else:
|
||||
#it's a url
|
||||
tag = 'url'
|
||||
print tag
|
||||
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
if tag is not None:
|
||||
if tag in ['bold', 'italic', 'underline'] and other_tag:
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter,\
|
||||
special_text, other_tag, tag)
|
||||
else:
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter,\
|
||||
special_text, tag)
|
||||
|
|
Loading…
Reference in New Issue