From 4aaa36fbaec09226bd30b6071d6e7b17df004d33 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Tue, 23 Aug 2005 14:58:53 +0000 Subject: [PATCH] [hawke] show_ascii_formatting_chars advanced setting --- src/chat.py | 28 +++++++++++++++++++--------- src/common/config.py | 1 + 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/chat.py b/src/chat.py index 5546b8cb4..d85182275 100644 --- a/src/chat.py +++ b/src/chat.py @@ -971,6 +971,7 @@ class Chat: def print_special_text(self, special_text, other_tags, textview): tags = [] use_other_tags = True + show_ascii_formatting_chars=gajim.config.get('show_ascii_formatting_chars') buffer = textview.get_buffer() possible_emot_ascii_caps = special_text.upper() # emoticons keys are CAPS @@ -996,32 +997,41 @@ class Chat: tags.append('bold') if special_text[1] == '/': # it's also 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 tags.append('underline') - special_text = special_text[2:-2] # remove *_ _* + if not show_ascii_formatting_chars: + special_text = special_text[2:-2] # remove *_ _* 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 tags.append('italic') if special_text[1] == '*': # it's also 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 tags.append('underline') - special_text = special_text[2:-2] # remove /_ _/ + if not show_ascii_formatting_chars: + special_text = special_text[2:-2] # remove /_ _/ 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 tags.append('underline') if special_text[1] == '*': # it's also 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 tags.append('italic') - special_text = special_text[2:-2] # remove _/ /_ + if not show_ascii_formatting_chars: + special_text = special_text[2:-2] # remove _/ /_ else: - special_text = special_text[1:-1] # remove _ _ + if not show_ascii_formatting_chars: + special_text = special_text[1:-1] # remove _ _ else: #it's a url tags.append('url') diff --git a/src/common/config.py b/src/common/config.py index 09fef4885..e860b3035 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -77,6 +77,7 @@ class Config: 'use_speller': [ opt_bool, False ], 'print_time': [ opt_str, 'always' ], 'useemoticons': [ opt_bool, True ], + 'show_ascii_formatting_chars': [ opt_bool, False ], 'sounds_on': [ opt_bool, True ], # 'aplay', 'play', 'esdplay', 'artsplay' detected first time only 'soundplayer': [ opt_str, '' ],