diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-01-12 16:45:40 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-01-12 16:45:40 +0100 |
commit | 7f6957b9063ee09878b5964e66e38d40328113af (patch) | |
tree | 7b42e61b4daf94e0344ea0adea5490b30ba73852 | |
parent | 9f514d8c7d6eb44109b324d76c709d6d51610f15 (diff) | |
download | poezio-7f6957b9063ee09878b5964e66e38d40328113af.tar.gz poezio-7f6957b9063ee09878b5964e66e38d40328113af.tar.bz2 poezio-7f6957b9063ee09878b5964e66e38d40328113af.tar.xz poezio-7f6957b9063ee09878b5964e66e38d40328113af.zip |
Avoid various crashes by denying the resize AND the refresh on too small size
-rw-r--r-- | src/core.py | 4 | ||||
-rw-r--r-- | src/tabs.py | 19 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py index 53728a5b..dc2bd47b 100644 --- a/src/core.py +++ b/src/core.py @@ -631,9 +631,8 @@ class Core(object): # Cancel the programmed software resize self.resize_timer.cancel() # add the new timer - self.resize_timer = threading.Timer(0.1, self.resize_window) + self.resize_timer = threading.Timer(0.2, self.resize_window) self.resize_timer.start() - # self.resize_window() def resize_window(self): """ @@ -699,7 +698,6 @@ class Core(object): """ curses.curs_set(1) curses.noecho() - # curses.raw() theme.init_colors() stdscr.keypad(True) diff --git a/src/tabs.py b/src/tabs.py index d1feffbb..845b50a8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -274,6 +274,8 @@ class InfoTab(ChatTab): def resize(self): Tab.resize(self) + if not self.visible: + return self.tab_win.resize(1, self.width, self.height-2, 0, self.core.stdscr) self.info_win.resize(self.height-2, self.width, 0, 0, self.core.stdscr) self.input.resize(1, self.width, self.height-1, 0, self.core.stdscr) @@ -529,6 +531,8 @@ class MucTab(ChatTab): Resize the whole window. i.e. all its sub-windows """ Tab.resize(self) + if not self.visible: + return text_width = (self.width//10)*9 self.topic_win.resize(1, self.width, 0, 0, self.core.stdscr) self.text_win.resize(self.height-4-self.core.information_win_size, text_width, 1, 0, self.core.stdscr) @@ -657,6 +661,8 @@ class PrivateTab(ChatTab): def resize(self): Tab.resize(self) + if not self.visible: + return self.text_win.resize(self.height-3-self.core.information_win_size, self.width, 0, 0, self.core.stdscr) self.text_win.rebuild_everything(self._room) self.info_header.resize(1, self.width, self.height-3-self.core.information_win_size, 0, self.core.stdscr) @@ -759,6 +765,8 @@ class RosterInfoTab(Tab): def resize(self): Tab.resize(self) + if not self.visible: + return roster_width = self.width//2 info_width = self.width-roster_width-1 self.v_separator.resize(self.height-2, 1, 0, roster_width, self.core.stdscr) @@ -1029,6 +1037,8 @@ class ConversationTab(ChatTab): def resize(self): Tab.resize(self) + if not self.visible: + return self.text_win.resize(self.height-4-self.core.information_win_size, self.width, 1, 0, self.core.stdscr) self.text_win.rebuild_everything(self._room) self.upper_bar.resize(1, self.width, 0, 0, self.core.stdscr) @@ -1125,6 +1135,8 @@ class MucListTab(Tab): self.resize() def refresh(self, tabs, informations, roster): + if not self.visible: + return self.upper_message.refresh() self.list_header.refresh() self.listview.refresh() @@ -1133,6 +1145,8 @@ class MucListTab(Tab): def resize(self): Tab.resize(self) + if not self.visible: + return self.upper_message.resize(1, self.width, 0, 0, self.core.stdscr) column_size = {'node-part': (self.width-5)//4, 'name': (self.width-5)//4*3, @@ -1255,11 +1269,16 @@ class SimpleTextTab(Tab): self.core.close_tab() def resize(self): + Tab.resize(self) + if not self.visible: + return self.text_win.resize(self.height-2, self.width, 0, 0, self.core.stdscr) self.tab_win.resize(1, self.width, self.height-2, 0, self.core.stdscr) self.input.resize(1, self.width, self.height-1, 0, self.core.stdscr) def refresh(self, tabs, information, roster): + if not self.visible: + return self.text_win.refresh() self.tab_win.refresh(tabs, tabs[0]) self.input.refresh() |