From f9734cde5623aaf701e222b00d5eebdf7a152772 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 20 Oct 2014 21:04:14 +0200 Subject: Remove the (sometimes wrong) default values in the config.get() calls --- src/tabs/basetabs.py | 10 +++++----- src/tabs/muctab.py | 18 +++++++++--------- src/tabs/privatetab.py | 2 +- src/tabs/rostertab.py | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/tabs') diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 0fde624c..2f5db40a 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -139,7 +139,7 @@ class Tab(object): Returns 1 or 0, depending on if we are using the vertical tab list or not. """ - if config.get('enable_vertical_tab_list', False): + if config.get('enable_vertical_tab_list'): return 0 return 1 @@ -298,7 +298,7 @@ class Tab(object): return False def refresh_tab_win(self): - if config.get('enable_vertical_tab_list', False): + if config.get('enable_vertical_tab_list'): if self.left_tab_win and not self.size.core_degrade_x: self.left_tab_win.refresh() elif not self.size.core_degrade_y: @@ -476,7 +476,7 @@ class ChatTab(Tab): self.update_keys() # Get the logs - log_nb = config.get('load_log', 10) + log_nb = config.get('load_log') logs = self.load_logs(log_nb) if logs: @@ -537,7 +537,7 @@ class ChatTab(Tab): for word in txt.split(): if len(word) >= 4 and word not in words: words.append(word) - words.extend([word for word in config.get('words', '').split(':') if word]) + words.extend([word for word in config.get('words').split(':') if word]) self.input.auto_completion(words, ' ', quotify=False) def on_enter(self): @@ -825,7 +825,7 @@ class OneToOneTab(ChatTab): if attention or empty: features.append(_('attention requests (/attention)')) if (receipts or empty) \ - and config.get('request_message_receipts', True): + and config.get('request_message_receipts'): features.append(_('message delivery receipts')) if len(features) > 1: tail = features.pop() diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index bd8ed312..fb89b0fa 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -251,7 +251,7 @@ class MucTab(ChatTab): def completion_nick(self, the_input): """Completion for /nick""" nicks = [os.environ.get('USER'), - config.get('default_nick', ''), + config.get('default_nick'), self.core.get_bookmark_nickname(self.name)] nicks = [i for i in nicks if i] return the_input.auto_completion(nicks, '', quotify=False) @@ -801,7 +801,7 @@ class MucTab(ChatTab): Resize the whole window. i.e. all its sub-windows """ self.need_resize = False - if config.get("hide_user_list", False) or self.size.tab_degrade_x: + if config.get('hide_user_list') or self.size.tab_degrade_x: display_user_list = False text_width = self.width else: @@ -842,7 +842,7 @@ class MucTab(ChatTab): if self.need_resize: self.resize() log.debug(' TAB Refresh: %s', self.__class__.__name__) - if config.get("hide_user_list", False) or self.size.tab_degrade_x: + if config.get('hide_user_list') or self.size.tab_degrade_x: display_user_list = False else: display_user_list = True @@ -885,7 +885,7 @@ class MucTab(ChatTab): for user in sorted(self.users, key=compare_users, reverse=True): if user.nick != self.own_nick: word_list.append(user.nick) - after = config.get('after_completion', ',') + ' ' + after = config.get('after_completion') + ' ' input_pos = self.input.pos if ' ' not in self.input.get_text()[:input_pos] or ( self.input.last_completion and @@ -893,7 +893,7 @@ class MucTab(ChatTab): self.input.last_completion + after): add_after = after else: - if not config.get('add_space_after_completion', True): + if not config.get('add_space_after_completion'): add_after = '' else: add_after = ' ' @@ -905,7 +905,7 @@ class MucTab(ChatTab): self.send_composing_chat_state(empty_after) def get_nick(self): - if not config.get('show_muc_jid', True): + if not config.get('show_muc_jid'): return safeJID(self.name).user return self.name @@ -930,7 +930,7 @@ class MucTab(ChatTab): def on_gain_focus(self): self.state = 'current' if (self.text_win.built_lines and self.text_win.built_lines[-1] is None - and not config.get('show_useless_separator', False)): + and not config.get('show_useless_separator')): self.text_win.remove_line_separator() curses.curs_set(1) if self.joined and config.get_by_tabname('send_chat_states', @@ -940,7 +940,7 @@ class MucTab(ChatTab): def on_info_win_size_changed(self): if self.core.information_win_size >= self.height-3: return - if config.get("hide_user_list", False): + if config.get("hide_user_list"): text_width = self.width else: text_width = (self.width//10)*9 @@ -1476,7 +1476,7 @@ class MucTab(ChatTab): highlighted = True break if highlighted: - beep_on = config.get('beep_on', 'highlight private').split() + beep_on = config.get('beep_on').split() if 'highlight' in beep_on and 'message' not in beep_on: if not config.get_by_tabname('disable_beep', self.name): curses.beep() diff --git a/src/tabs/privatetab.py b/src/tabs/privatetab.py index f4fa10cf..4c01cd70 100644 --- a/src/tabs/privatetab.py +++ b/src/tabs/privatetab.py @@ -109,7 +109,7 @@ class PrivateTab(OneToOneTab): compare_users = lambda x: x.last_talked word_list = [user.nick for user in sorted(self.parent_muc.users, key=compare_users, reverse=True)\ if user.nick != self.own_nick] - after = config.get('after_completion', ',')+" " + after = config.get('after_completion') + ' ' input_pos = self.input.pos if ' ' not in self.input.get_text()[:input_pos] or (self.input.last_completion and\ self.input.get_text()[:input_pos] == self.input.last_completion + after): diff --git a/src/tabs/rostertab.py b/src/tabs/rostertab.py index 3d01046b..26f429d0 100644 --- a/src/tabs/rostertab.py +++ b/src/tabs/rostertab.py @@ -349,7 +349,7 @@ class RosterInfoTab(Tab): def callback(iq): if iq['type'] == 'result': self.core.information('Password updated', 'Account') - if config.get('password', ''): + if config.get('password'): config.silent_set('password', arg) else: self.core.information('Unable to change the password', 'Account') @@ -763,7 +763,7 @@ class RosterInfoTab(Tab): Show or hide offline contacts """ option = 'roster_show_offline' - value = config.get(option, False) + value = config.get(option) success = config.silent_set(option, str(not value)) roster.modified() if not success: -- cgit v1.2.3