From cdcfddcb2e7d4f215ce9940f25a8c57f2c58a919 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Tue, 14 Sep 2010 22:59:40 +0000 Subject: avoid some crashes. Also fixes the line separator on new messages --- src/gui.py | 2 ++ src/tab.py | 8 ++------ src/window.py | 13 +++++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui.py b/src/gui.py index 06627048..0df8be86 100644 --- a/src/gui.py +++ b/src/gui.py @@ -1172,6 +1172,8 @@ class Gui(object): sys.exit() def do_command(self, key): + if not key: + return from common import debug debug('do_command, %s, %s\n' % (key, self.current_tab())) res = self.current_tab().on_input(key) diff --git a/src/tab.py b/src/tab.py index 6dc60bb2..76115a13 100644 --- a/src/tab.py +++ b/src/tab.py @@ -271,9 +271,9 @@ class MucTab(Tab): def on_lose_focus(self): self._room.set_color_state(theme.COLOR_TAB_NORMAL) self._room.remove_line_separator() + self._room.add_line_separator() def on_gain_focus(self): - self._room.add_line_separator() self._room.set_color_state(theme.COLOR_TAB_CURRENT) def on_scroll_up(self): @@ -336,9 +336,9 @@ class PrivateTab(Tab): def on_lose_focus(self): self._room.set_color_state(theme.COLOR_TAB_NORMAL) self._room.remove_line_separator() + self._room.add_line_separator() def on_gain_focus(self): - self._room.add_line_separator() self._room.set_color_state(theme.COLOR_TAB_CURRENT) def on_scroll_up(self): @@ -353,9 +353,5 @@ class PrivateTab(Tab): self.info_header.resize(1, self.width, self.height-3-self.info_win_size, 0, stdscr, self.visible) self.info_win.resize(self.info_win_size, (self.width//10)*9, self.height-2-self.info_win_size, 0, stdscr, self.visible) - # self.text_win.resize(self.height-4-self.info_win_size, text_width, 1, 0, stdscr, self.visible) - # self.info_header.resize(1, (self.width//10)*9, self.height-3-self.info_win_size, 0, stdscr, self.visible) - # self.info_win.resize(self.info_win_size, (self.width//10)*9, self.height-2-self.info_win_size, 0, stdscr, self.visible) - def get_room(self): return self._room 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 -- cgit v1.2.3