nothing part 2
This commit is contained in:
parent
33fb7ea8b4
commit
d10111675b
1 changed files with 52 additions and 50 deletions
|
@ -457,55 +457,57 @@ class Chat:
|
||||||
if not print_all_special:
|
if not print_all_special:
|
||||||
other_tag = ''
|
other_tag = ''
|
||||||
index = end # update index
|
index = end # update index
|
||||||
|
|
||||||
# == PRINT SPECIAL TEXT ==
|
#now print it
|
||||||
# make it CAPS (emoticons keys are all CAPS)
|
self.print_special_text(special_text, other_tag, conversation_buffer)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
return index, other_tag
|
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…
Add table
Reference in a new issue