summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-02-15 15:20:34 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-02-15 15:20:34 +0100
commit68f784e5c233c4f9f8f3a02e99584f1b77fbec9b (patch)
tree8f5f825b79bdbb8f2292723152fbbd513ad94481
parent85d645b7d27a940c262d0a1e333c61754877155e (diff)
downloadpoezio-68f784e5c233c4f9f8f3a02e99584f1b77fbec9b.tar.gz
poezio-68f784e5c233c4f9f8f3a02e99584f1b77fbec9b.tar.bz2
poezio-68f784e5c233c4f9f8f3a02e99584f1b77fbec9b.tar.xz
poezio-68f784e5c233c4f9f8f3a02e99584f1b77fbec9b.zip
Make the resize faster by resizing each tab
only at its next refresh
-rw-r--r--src/core.py5
-rw-r--r--src/tabs.py16
2 files changed, 20 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py
index 98d2a7fa..4e837e4d 100644
--- a/src/core.py
+++ b/src/core.py
@@ -691,7 +691,10 @@ class Core(object):
"""
with resize_lock:
for tab in self.tabs:
- tab.resize()
+ # Each tab will be resized the next
+ # time it will be refresh()'ed
+ # Making the resize process faster
+ tab.need_resize = True
self.refresh_window()
def main_loop(self):
diff --git a/src/tabs.py b/src/tabs.py
index 3b25095d..8ac791d0 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -52,6 +52,7 @@ class Tab(object):
def __init__(self, core):
self.core = core # a pointer to core, to access its attributes (ugly?)
self._color_state = theme.COLOR_TAB_NORMAL
+ self.need_resize = False
self.nb = Tab.number
Tab.number += 1
self.size = (self.height, self.width) = self.core.stdscr.getmaxyx()
@@ -123,6 +124,7 @@ class Tab(object):
self.visible = False
else:
self.visible = True
+ self.need_resize = False
def refresh(self, tabs, informations, roster):
"""
@@ -298,6 +300,8 @@ class InfoTab(ChatTab):
def refresh(self, tabs, informations, _):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.info_win.refresh(informations)
self.tab_win.refresh(tabs, tabs[0])
self.input.refresh()
@@ -589,6 +593,8 @@ class MucTab(ChatTab, TabWithInfoWin):
def refresh(self, tabs, informations, _):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.topic_win.refresh(self._room.topic)
self.text_win.refresh(self._room)
self.v_separator.refresh()
@@ -719,6 +725,8 @@ class PrivateTab(ChatTab, TabWithInfoWin):
def refresh(self, tabs, informations, _):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.text_win.refresh(self._room)
self.info_header.refresh(self._room, self.text_win)
self.info_win.refresh(informations)
@@ -912,6 +920,8 @@ class RosterInfoTab(Tab):
def refresh(self, tabs, informations, roster):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.v_separator.refresh()
self.roster_win.refresh(roster)
self.contact_info_win.refresh(self.roster_win.get_selected_row())
@@ -1101,6 +1111,8 @@ class ConversationTab(ChatTab, TabWithInfoWin):
def refresh(self, tabs, informations, roster):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.text_win.refresh(self._room)
self.upper_bar.refresh(self.get_name(), roster.get_contact_by_jid(self.get_name()))
self.info_header.refresh(self.get_name(), roster.get_contact_by_jid(self.get_name()), self._room, self.text_win)
@@ -1193,6 +1205,8 @@ class MucListTab(Tab):
def refresh(self, tabs, informations, roster):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.upper_message.refresh()
self.list_header.refresh()
self.listview.refresh()
@@ -1341,6 +1355,8 @@ class SimpleTextTab(Tab):
def refresh(self, tabs, information, roster):
if not self.visible:
return
+ if self.need_resize:
+ self.resize()
self.text_win.refresh()
self.tab_win.refresh(tabs, tabs[0])
self.input.refresh()