summaryrefslogtreecommitdiff
path: root/src/windows
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-10-31 19:15:57 +0100
committermathieui <mathieui@mathieui.net>2014-10-31 19:16:44 +0100
commit1c1ab3cb839e5509db52770e10c7190f844eb2e5 (patch)
treeb331060b3dc42651e61e4ccb2dfe6af5e2e97752 /src/windows
parentcedc5a6ec80a46437f42464415fd1806049c593d (diff)
parentea2b703bfd07d293ba9fdd85ac657275d43da2a7 (diff)
downloadpoezio-1c1ab3cb839e5509db52770e10c7190f844eb2e5.tar.gz
poezio-1c1ab3cb839e5509db52770e10c7190f844eb2e5.tar.bz2
poezio-1c1ab3cb839e5509db52770e10c7190f844eb2e5.tar.xz
poezio-1c1ab3cb839e5509db52770e10c7190f844eb2e5.zip
Merge branch 'master' of git.poez.io:poezio into slix
Conflicts: src/bookmark.py src/config.py src/connection.py src/core/commands.py src/core/core.py src/core/handlers.py src/windows/info_bar.py src/windows/muc.py src/windows/roster_win.py src/windows/text_win.py src/xhtml.py
Diffstat (limited to 'src/windows')
-rw-r--r--src/windows/funcs.py2
-rw-r--r--src/windows/info_bar.py17
-rw-r--r--src/windows/inputs.py2
-rw-r--r--src/windows/muc.py10
-rw-r--r--src/windows/roster_win.py14
-rw-r--r--src/windows/text_win.py10
6 files changed, 28 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 10225d5d..e66343c5 100644
--- a/src/windows/info_bar.py
+++ b/src/windows/info_bar.py
@@ -24,10 +24,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[:]
@@ -37,7 +37,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:
@@ -70,11 +70,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:
@@ -89,8 +89,7 @@ class VerticalGlobalInfoBar(Win):
sorted_tabs = sorted_tabs[pos-height//2 : pos+height//2]
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 afce3dd8..d345443b 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 02bc58ef..7e3541ba 100644
--- a/src/windows/muc.py
+++ b/src/windows/muc.py
@@ -34,10 +34,10 @@ 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.
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)
@@ -55,7 +55,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
@@ -63,12 +63,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 f9858a3a..6ecb6128 100644
--- a/src/windows/roster_win.py
+++ b/src/windows/roster_win.py
@@ -99,9 +99,9 @@ class RosterWin(Win):
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):
@@ -229,7 +229,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:
@@ -237,7 +237,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)
@@ -250,7 +250,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)
@@ -268,7 +268,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 86aea1ef..8a8f75ae 100644
--- a/src/windows/text_win.py
+++ b/src/windows/text_win.py
@@ -19,7 +19,9 @@ 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=None):
+ if lines_nb_limit is None:
+ lines_nb_limit = config.get('max_lines_in_memory')
Win.__init__(self)
self.lines_nb_limit = lines_nb_limit
self.pos = 0
@@ -265,7 +267,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")
self._win.move(0, 0)
self._win.erase()
for y, line in enumerate(lines):
@@ -402,7 +404,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:
@@ -415,7 +417,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