From 95dcaa7fece3cf47c4f0640d0bdd561415cd3372 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 8 Nov 2011 20:51:48 +0100 Subject: [PATCH] =?UTF-8?q?Forgot=20those=20hardcoded=20values=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/windows.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/windows.py b/src/windows.py index c94de15e..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)) @@ -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))