[hawke] show_ascii_formatting_chars advanced setting

This commit is contained in:
Nikos Kouremenos 2005-08-23 14:58:53 +00:00
parent e7b1247b38
commit 4aaa36fbae
2 changed files with 20 additions and 9 deletions

View file

@ -971,6 +971,7 @@ class Chat:
def print_special_text(self, special_text, other_tags, textview): def print_special_text(self, special_text, other_tags, textview):
tags = [] tags = []
use_other_tags = True use_other_tags = True
show_ascii_formatting_chars=gajim.config.get('show_ascii_formatting_chars')
buffer = textview.get_buffer() 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
@ -996,32 +997,41 @@ class Chat:
tags.append('bold') tags.append('bold')
if special_text[1] == '/': # it's also italic if special_text[1] == '/': # it's also italic
tags.append('italic') tags.append('italic')
special_text = special_text[2:-2] # remove */ /* if not show_ascii_formatting_chars:
special_text = special_text[2:-2] # remove */ /*
elif special_text[1] == '_': # it's also underlined elif special_text[1] == '_': # it's also underlined
tags.append('underline') tags.append('underline')
special_text = special_text[2:-2] # remove *_ _* if not show_ascii_formatting_chars:
special_text = special_text[2:-2] # remove *_ _*
else: else:
special_text = special_text[1:-1] # remove * * if not show_ascii_formatting_chars:
special_text = special_text[1:-1] # remove * *
elif special_text.startswith('/'): # it's an italic text elif special_text.startswith('/'): # it's an italic text
tags.append('italic') tags.append('italic')
if special_text[1] == '*': # it's also bold if special_text[1] == '*': # it's also bold
tags.append('bold') tags.append('bold')
special_text = special_text[2:-2] # remove /* */ if not show_ascii_formatting_chars:
special_text = special_text[2:-2] # remove /* */
elif special_text[1] == '_': # it's also underlined elif special_text[1] == '_': # it's also underlined
tags.append('underline') tags.append('underline')
special_text = special_text[2:-2] # remove /_ _/ if not show_ascii_formatting_chars:
special_text = special_text[2:-2] # remove /_ _/
else: else:
special_text = special_text[1:-1] # remove / / if not show_ascii_formatting_chars:
special_text = special_text[1:-1] # remove / /
elif special_text.startswith('_'): # it's an underlined text elif special_text.startswith('_'): # it's an underlined text
tags.append('underline') tags.append('underline')
if special_text[1] == '*': # it's also bold if special_text[1] == '*': # it's also bold
tags.append('bold') tags.append('bold')
special_text = special_text[2:-2] # remove _* *_ if not show_ascii_formatting_chars:
special_text = special_text[2:-2] # remove _* *_
elif special_text[1] == '/': # it's also italic elif special_text[1] == '/': # it's also italic
tags.append('italic') tags.append('italic')
special_text = special_text[2:-2] # remove _/ /_ if not show_ascii_formatting_chars:
special_text = special_text[2:-2] # remove _/ /_
else: else:
special_text = special_text[1:-1] # remove _ _ if not show_ascii_formatting_chars:
special_text = special_text[1:-1] # remove _ _
else: else:
#it's a url #it's a url
tags.append('url') tags.append('url')

View file

@ -77,6 +77,7 @@ class Config:
'use_speller': [ opt_bool, False ], 'use_speller': [ opt_bool, False ],
'print_time': [ opt_str, 'always' ], 'print_time': [ opt_str, 'always' ],
'useemoticons': [ opt_bool, True ], 'useemoticons': [ opt_bool, True ],
'show_ascii_formatting_chars': [ opt_bool, False ],
'sounds_on': [ opt_bool, True ], 'sounds_on': [ opt_bool, True ],
# 'aplay', 'play', 'esdplay', 'artsplay' detected first time only # 'aplay', 'play', 'esdplay', 'artsplay' detected first time only
'soundplayer': [ opt_str, '' ], 'soundplayer': [ opt_str, '' ],