summaryrefslogtreecommitdiff
path: root/src/window.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-14 22:59:40 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-14 22:59:40 +0000
commitcdcfddcb2e7d4f215ce9940f25a8c57f2c58a919 (patch)
treeccc1ea62555f1460691b13ba28ca95e21462890f /src/window.py
parent534b39ae8d9023045e7f3c0bb616add17dbe6791 (diff)
downloadpoezio-cdcfddcb2e7d4f215ce9940f25a8c57f2c58a919.tar.gz
poezio-cdcfddcb2e7d4f215ce9940f25a8c57f2c58a919.tar.bz2
poezio-cdcfddcb2e7d4f215ce9940f25a8c57f2c58a919.tar.xz
poezio-cdcfddcb2e7d4f215ce9940f25a8c57f2c58a919.zip
avoid some crashes. Also fixes the line separator on new messages
Diffstat (limited to 'src/window.py')
-rw-r--r--src/window.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/window.py b/src/window.py
index c9576873..342e4156 100644
--- a/src/window.py
+++ b/src/window.py
@@ -41,6 +41,9 @@ class Win(object):
try:
self.win = parent_win.subwin(height, width, y, x)
except:
+ from common import debug
+ debug('%s %s %s %s %s\n' % (height, width, y, x, parent_win))
+ raise
# When resizing in a too little height (less than 3 lines)
# We don't need to resize the window, since this size
# just makes no sense
@@ -94,8 +97,14 @@ class UserList(Win):
self.win.erase()
y = 0
for user in sorted(users):
- role_col = self.color_role[user.role]
- show_col = self.color_show[user.show]
+ if not user.role in self.color_role:
+ role_col = theme.COLOR_USER_NONE
+ else:
+ role_col = self.color_role[user.role]
+ if not user.show in self.color_show:
+ show_col = theme.COLOR_STATUS_NONE
+ else:
+ show_col = self.color_show[user.show]
self.addstr(y, 0, theme.CHAR_STATUS, curses.color_pair(show_col))
self.addnstr(y, 1, user.nick, self.width-2, curses.color_pair(role_col))
y += 1