summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/windows.py b/src/windows.py
index 9fa3e705..2253b871 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -367,14 +367,14 @@ class ConversationInfoWin(InfoWin):
The line above the information window, displaying informations
about the user we are talking to
"""
- color_show = {'xa':get_theme().COLOR_STATUS_XA,
- 'none':get_theme().COLOR_STATUS_ONLINE,
- '':get_theme().COLOR_STATUS_ONLINE,
- 'available':get_theme().COLOR_STATUS_ONLINE,
- 'dnd':get_theme().COLOR_STATUS_DND,
- 'away':get_theme().COLOR_STATUS_AWAY,
- 'chat':get_theme().COLOR_STATUS_CHAT,
- 'unavailable':get_theme().COLOR_STATUS_UNAVAILABLE
+ color_show = {'xa': lambda: get_theme().COLOR_STATUS_XA,
+ 'none': lambda: get_theme().COLOR_STATUS_ONLINE,
+ '': lambda: get_theme().COLOR_STATUS_ONLINE,
+ 'available': lambda: get_theme().COLOR_STATUS_ONLINE,
+ 'dnd': lambda: get_theme().COLOR_STATUS_DND,
+ 'away': lambda: get_theme().COLOR_STATUS_AWAY,
+ 'chat': lambda: get_theme().COLOR_STATUS_CHAT,
+ 'unavailable': lambda: get_theme().COLOR_STATUS_UNAVAILABLE
}
def __init__(self):
@@ -416,7 +416,7 @@ class ConversationInfoWin(InfoWin):
presence = "unavailable"
else:
presence = resource.get_presence()
- color = RosterWin.color_show[presence]
+ color = RosterWin.color_show[presence]()
self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self.addstr(" ", to_curses_attr(color))
self.addstr(']', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
@@ -634,7 +634,7 @@ class TextWin(Win):
self._win.attrset(0)
for y, line in enumerate(lines):
if not line:
- self.write_line_separator()
+ self.write_line_separator(y)
else:
self.write_text(y, (3 if line.msg.nickname else 1) + len(line.msg.str_time)+len(truncate_nick(line.msg.nickname) or ''), line.msg.txt[line.start_pos:line.end_pos])
if y != self.height-1:
@@ -642,8 +642,8 @@ class TextWin(Win):
self._win.attrset(0)
self._refresh()
- def write_line_separator(self):
- self.addnstr('- '*(self.width//2-1)+'-', self.width, to_curses_attr(get_theme().COLOR_NEW_TEXT_SEPARATOR))
+ def write_line_separator(self, y):
+ self.addnstr(y, 0, '- '*(self.width//2-1)+'-', self.width, to_curses_attr(get_theme().COLOR_NEW_TEXT_SEPARATOR))
def write_text(self, y, x, txt):
"""
@@ -1328,14 +1328,14 @@ class VerticalSeparator(Win):
self.rewrite_line()
class RosterWin(Win):
- color_show = {'xa':get_theme().COLOR_STATUS_XA,
- 'none':get_theme().COLOR_STATUS_ONLINE,
- '':get_theme().COLOR_STATUS_ONLINE,
- 'available':get_theme().COLOR_STATUS_ONLINE,
- 'dnd':get_theme().COLOR_STATUS_DND,
- 'away':get_theme().COLOR_STATUS_AWAY,
- 'chat':get_theme().COLOR_STATUS_CHAT,
- 'unavailable':get_theme().COLOR_STATUS_UNAVAILABLE
+ color_show = {'xa': lambda: get_theme().COLOR_STATUS_XA,
+ 'none': lambda: get_theme().COLOR_STATUS_ONLINE,
+ '': lambda: get_theme().COLOR_STATUS_ONLINE,
+ 'available': lambda: get_theme().COLOR_STATUS_ONLINE,
+ 'dnd':lambda: get_theme().COLOR_STATUS_DND,
+ 'away': lambda: get_theme().COLOR_STATUS_AWAY,
+ 'chat': lambda: get_theme().COLOR_STATUS_CHAT,
+ 'unavailable': lambda: get_theme().COLOR_STATUS_UNAVAILABLE
}
def __init__(self):
@@ -1473,7 +1473,7 @@ class RosterWin(Win):
else:
presence = resource.get_presence()
nb = ' (%s)' % (contact.get_nb_resources(),)
- color = RosterWin.color_show[presence]
+ color = RosterWin.color_show[presence]()
if contact.get_name():
display_name = '%s (%s)%s' % (contact.get_name(),
contact.get_bare_jid(), nb,)
@@ -1496,7 +1496,7 @@ class RosterWin(Win):
"""
Draw a specific resource line
"""
- color = RosterWin.color_show[resource.get_presence()]
+ color = RosterWin.color_show[resource.get_presence()]()
self.addstr(y, 4, " ", to_curses_attr(color))
if colored:
self.addstr(y, 6, resource.get_jid().full, to_curses_attr(get_theme().COLOR_SELECTED_ROW))