summaryrefslogtreecommitdiff
path: root/src/windows
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-10-20 21:04:14 +0200
committermathieui <mathieui@mathieui.net>2014-10-20 21:21:04 +0200
commitf9734cde5623aaf701e222b00d5eebdf7a152772 (patch)
tree8f7b241df886d2c17eaee8f3630511631bf8cc3a /src/windows
parent7b01c62e07612a123f3ffe94583f51099e470c3b (diff)
downloadpoezio-f9734cde5623aaf701e222b00d5eebdf7a152772.tar.gz
poezio-f9734cde5623aaf701e222b00d5eebdf7a152772.tar.bz2
poezio-f9734cde5623aaf701e222b00d5eebdf7a152772.tar.xz
poezio-f9734cde5623aaf701e222b00d5eebdf7a152772.zip
Remove the (sometimes wrong) default values in the config.get() calls
Diffstat (limited to 'src/windows')
-rw-r--r--src/windows/funcs.py2
-rw-r--r--src/windows/info_bar.py16
-rw-r--r--src/windows/inputs.py2
-rw-r--r--src/windows/muc.py10
-rw-r--r--src/windows/roster_win.py16
-rw-r--r--src/windows/text_win.py8
6 files changed, 27 insertions, 27 deletions
diff --git a/src/windows/funcs.py b/src/windows/funcs.py
index 47011faf..d58d4683 100644
--- a/src/windows/funcs.py
+++ b/src/windows/funcs.py
@@ -20,7 +20,7 @@ def find_first_format_char(text, chars=None):
return pos
def truncate_nick(nick, size=None):
- size = size or config.get('max_nick_length', 25)
+ size = size or config.get('max_nick_length')
if size < 1:
size = 1
if nick and len(nick) > size:
diff --git a/src/windows/info_bar.py b/src/windows/info_bar.py
index 9917fa6a..cea4702f 100644
--- a/src/windows/info_bar.py
+++ b/src/windows/info_bar.py
@@ -25,10 +25,10 @@ class GlobalInfoBar(Win):
self._win.erase()
self.addstr(0, 0, "[", to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
- create_gaps = config.get('create_gaps', False)
- show_names = config.get('show_tab_names', False)
- show_nums = config.get('show_tab_numbers', True)
- use_nicks = config.get('use_tab_nicks', True)
+ create_gaps = config.get('create_gaps')
+ show_names = config.get('show_tab_names')
+ show_nums = config.get('show_tab_numbers')
+ use_nicks = config.get('use_tab_nicks')
# ignore any remaining gap tabs if the feature is not enabled
if create_gaps:
sorted_tabs = self.core.tabs[:]
@@ -38,7 +38,7 @@ class GlobalInfoBar(Win):
for nb, tab in enumerate(sorted_tabs):
if not tab: continue
color = tab.color
- if not config.get('show_inactive_tabs', True) and\
+ if not config.get('show_inactive_tabs') and\
color is get_theme().COLOR_TAB_NORMAL:
continue
try:
@@ -72,11 +72,11 @@ class VerticalGlobalInfoBar(Win):
height, width = self._win.getmaxyx()
self._win.erase()
sorted_tabs = [tab for tab in self.core.tabs if tab]
- if not config.get('show_inactive_tabs', True):
+ if not config.get('show_inactive_tabs'):
sorted_tabs = [tab for tab in sorted_tabs if\
tab.vertical_color != get_theme().COLOR_VERTICAL_TAB_NORMAL]
nb_tabs = len(sorted_tabs)
- use_nicks = config.get('use_tab_nicks', True)
+ use_nicks = config.get('use_tab_nicks')
if nb_tabs >= height:
for y, tab in enumerate(sorted_tabs):
if tab.vertical_color == get_theme().COLOR_VERTICAL_TAB_CURRENT:
@@ -92,7 +92,7 @@ class VerticalGlobalInfoBar(Win):
for y, tab in enumerate(sorted_tabs):
color = tab.vertical_color
- if not config.get('vertical_tab_list_sort', 'desc') != 'asc':
+ if not config.get('vertical_tab_list_sort') != 'asc':
y = height - y - 1
self.addstr(y, 0, "%2d" % tab.nb,
to_curses_attr(get_theme().COLOR_VERTICAL_TAB_NUMBER))
diff --git a/src/windows/inputs.py b/src/windows/inputs.py
index db339b77..8e1673e1 100644
--- a/src/windows/inputs.py
+++ b/src/windows/inputs.py
@@ -564,7 +564,7 @@ class HistoryInput(Input):
self.current_completed = ''
self.key_func['^R'] = self.toggle_search
self.search = False
- if config.get('separate_history', False):
+ if config.get('separate_history'):
self.history = list()
def toggle_search(self):
diff --git a/src/windows/muc.py b/src/windows/muc.py
index ce296e26..cd594c4c 100644
--- a/src/windows/muc.py
+++ b/src/windows/muc.py
@@ -34,11 +34,11 @@ class UserList(Win):
def refresh(self, users):
log.debug('Refresh: %s', self.__class__.__name__)
- if config.get("hide_user_list", False):
+ if config.get('hide_user_list'):
return # do not refresh if this win is hidden.
with g_lock:
self._win.erase()
- if config.get('user_list_sort', 'desc').lower() == 'asc':
+ if config.get('user_list_sort').lower() == 'asc':
y, x = self._win.getmaxyx()
y -= 1
users = sorted(users)
@@ -56,7 +56,7 @@ class UserList(Win):
self.addstr(y, 2,
poopt.cut_by_columns(user.nick, self.width - 2),
to_curses_attr(user.color))
- if config.get('user_list_sort', 'desc').lower() == 'asc':
+ if config.get('user_list_sort').lower() == 'asc':
y -= 1
else:
y += 1
@@ -64,12 +64,12 @@ class UserList(Win):
break
# draw indicators of position in the list
if self.pos > 0:
- if config.get('user_list_sort', 'desc').lower() == 'asc':
+ if config.get('user_list_sort').lower() == 'asc':
self.draw_plus(self.height-1)
else:
self.draw_plus(0)
if self.pos + self.height < len(users):
- if config.get('user_list_sort', 'desc').lower() == 'asc':
+ if config.get('user_list_sort').lower() == 'asc':
self.draw_plus(0)
else:
self.draw_plus(self.height-1)
diff --git a/src/windows/roster_win.py b/src/windows/roster_win.py
index d5f6d958..d98f27ce 100644
--- a/src/windows/roster_win.py
+++ b/src/windows/roster_win.py
@@ -95,13 +95,13 @@ class RosterWin(Win):
# This is a search
if roster.contact_filter:
self.roster_cache = []
- sort = config.get('roster_sort', 'jid:show') or 'jid:show'
+ sort = config.get('roster_sort') or 'jid:show'
for contact in roster.get_contacts_sorted_filtered(sort):
self.roster_cache.append(contact)
else:
- show_offline = config.get('roster_show_offline', False) or roster.contact_filter
- sort = config.get('roster_sort', 'jid:show') or 'jid:show'
- group_sort = config.get('roster_group_sort', 'name') or 'name'
+ show_offline = config.get('roster_show_offline') or roster.contact_filter
+ sort = config.get('roster_sort') or 'jid:show'
+ group_sort = config.get('roster_group_sort') or 'name'
self.roster_cache = []
# build the cache
for group in roster.get_groups(group_sort):
@@ -230,7 +230,7 @@ class RosterWin(Win):
self.addstr(y, 0, ' ')
self.addstr(theme.CHAR_STATUS, to_curses_attr(color))
- show_roster_sub = config.get('show_roster_subscriptions', '')
+ show_roster_sub = config.get('show_roster_subscriptions')
self.addstr(' ')
if resource:
@@ -238,7 +238,7 @@ class RosterWin(Win):
added += 4
if contact.ask:
added += len(get_theme().CHAR_ROSTER_ASKED)
- if config.get('show_s2s_errors', True) and contact.error:
+ if config.get('show_s2s_errors') and contact.error:
added += len(get_theme().CHAR_ROSTER_ERROR)
if contact.tune:
added += len(get_theme().CHAR_ROSTER_TUNE)
@@ -251,7 +251,7 @@ class RosterWin(Win):
if show_roster_sub in ('all', 'incomplete', 'to', 'from', 'both', 'none'):
added += len(theme.char_subscription(contact.subscription, keep=show_roster_sub))
- if not config.get('show_roster_jids', True) and contact.name:
+ if not config.get('show_roster_jids') and contact.name:
display_name = '%s' % contact.name
elif contact.name and contact.name != contact.bare_jid:
display_name = '%s (%s)' % (contact.name, contact.bare_jid)
@@ -269,7 +269,7 @@ class RosterWin(Win):
self.addstr(theme.char_subscription(contact.subscription, keep=show_roster_sub), to_curses_attr(theme.COLOR_ROSTER_SUBSCRIPTION))
if contact.ask:
self.addstr(get_theme().CHAR_ROSTER_ASKED, to_curses_attr(get_theme().COLOR_IMPORTANT_TEXT))
- if config.get('show_s2s_errors', True) and contact.error:
+ if config.get('show_s2s_errors') and contact.error:
self.addstr(get_theme().CHAR_ROSTER_ERROR, to_curses_attr(get_theme().COLOR_ROSTER_ERROR))
if contact.tune:
self.addstr(get_theme().CHAR_ROSTER_TUNE, to_curses_attr(get_theme().COLOR_ROSTER_TUNE))
diff --git a/src/windows/text_win.py b/src/windows/text_win.py
index de9b0625..4c6b9a18 100644
--- a/src/windows/text_win.py
+++ b/src/windows/text_win.py
@@ -19,7 +19,7 @@ from theming import to_curses_attr, get_theme, dump_tuple
class TextWin(Win):
- def __init__(self, lines_nb_limit=config.get('max_lines_in_memory', 2048)):
+ def __init__(self, lines_nb_limit=config.get('max_lines_in_memory')):
Win.__init__(self)
self.lines_nb_limit = lines_nb_limit
self.pos = 0
@@ -265,7 +265,7 @@ class TextWin(Win):
lines = self.built_lines[-self.height:]
else:
lines = self.built_lines[-self.height-self.pos:-self.pos]
- with_timestamps = config.get("show_timestamps", True)
+ with_timestamps = config.get("show_timestamps")
with g_lock:
self._win.move(0, 0)
self._win.erase()
@@ -405,7 +405,7 @@ class TextWin(Win):
def rebuild_everything(self, room):
self.built_lines = []
- with_timestamps = config.get("show_timestamps", True)
+ with_timestamps = config.get('show_timestamps')
for message in room.messages:
self.build_new_message(message, clean=False, timestamp=with_timestamps)
if self.separator_after is message:
@@ -418,7 +418,7 @@ class TextWin(Win):
Find a message, and replace it with a new one
(instead of rebuilding everything in order to correct a message)
"""
- with_timestamps = config.get("show_timestamps", True)
+ with_timestamps = config.get('show_timestamps')
for i in range(len(self.built_lines)-1, -1, -1):
if self.built_lines[i] and self.built_lines[i].msg.identifier == old_id:
index = i