summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-04-18 03:34:51 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-04-18 03:34:51 +0200
commitd913e715133756bcab123b2373b25a905707042f (patch)
treedbf4d3fc2eab6110237b4c48d192336d6a8c41cb
parent3aa6e891a5be995f39b4364f8fe525ef9db6262b (diff)
downloadpoezio-d913e715133756bcab123b2373b25a905707042f.tar.gz
poezio-d913e715133756bcab123b2373b25a905707042f.tar.bz2
poezio-d913e715133756bcab123b2373b25a905707042f.tar.xz
poezio-d913e715133756bcab123b2373b25a905707042f.zip
Refresh optimization on chatstates
-rw-r--r--src/core.py15
-rw-r--r--src/tabs.py23
2 files changed, 17 insertions, 21 deletions
diff --git a/src/core.py b/src/core.py
index 861e9144..65bd59be 100644
--- a/src/core.py
+++ b/src/core.py
@@ -298,7 +298,8 @@ class Core(object):
return False
tab.chatstate = state
if tab == self.current_tab():
- self.refresh_window()
+ tab.refresh_info_header()
+ self.doupdate()
return True
def on_chatstate_private_conversation(self, message, state):
@@ -307,7 +308,8 @@ class Core(object):
return
tab.chatstate = state
if tab == self.current_tab():
- self.refresh_window()
+ tab.refresh_info_header()
+ self.doupdate()
return True
def on_chatstate_groupchat_conversation(self, message, state):
@@ -317,7 +319,9 @@ class Core(object):
if tab and tab.get_room() and tab.get_room().get_user_by_name(nick):
tab.get_room().get_user_by_name(nick).chatstate = state
if tab == self.current_tab():
- self.refresh_window()
+ tab.user_win.refresh(tab._room.users)
+ tab.input.refresh()
+ self.doupdate()
def open_new_form(self, form, on_cancel, on_send, **kwargs):
"""
@@ -510,7 +514,7 @@ class Core(object):
if conversation is self.current_tab():
self.refresh_window()
else:
- self.current_tab().tab_win.refresh()
+ self.refresh_tab_win()
def focus_tab_named(self, tab_name):
for tab in self.tabs:
@@ -558,7 +562,7 @@ class Core(object):
logger.log_message(jid.bare, remote_nick, body)
if self.current_tab() is not conversation:
conversation.set_color_state(theme.COLOR_TAB_PRIVATE)
- self.current_tab().tab_win.refresh()
+ self.refresh_tab_win()
else:
self.refresh_window()
@@ -1434,5 +1438,4 @@ class Core(object):
def doupdate(self):
if not self.running:
return
- self.current_tab().just_before_refresh()
curses.doupdate()
diff --git a/src/tabs.py b/src/tabs.py
index cd2d0c49..36688a8c 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -420,9 +420,6 @@ class InfoTab(ChatTab):
def on_info_win_size_changed(self):
return
- def just_before_refresh(self):
- return
-
class MucTab(ChatTab):
"""
The tab containing a multi-user-chat room.
@@ -766,9 +763,6 @@ class MucTab(ChatTab):
self.info_header.resize(1, self.width, self.height-3-self.core.information_win_size, 0)
self.user_win.resize(self.height-3-self.core.information_win_size-1, self.width-text_width-1, 1, text_width+1)
- def just_before_refresh(self):
- return
-
def handle_presence(self, presence):
from_nick = presence['from'].resource
from_room = presence['from'].bare
@@ -1022,6 +1016,10 @@ class PrivateTab(ChatTab):
self.tab_win.refresh()
self.input.refresh()
+ def refresh_info_header(self):
+ self.info_header.refresh(self._room, self.text_win, self.chatstate)
+ self.input.refresh()
+
def get_color_state(self):
if self._room.color_state == theme.COLOR_TAB_NORMAL or\
self._room.color_state == theme.COLOR_TAB_CURRENT:
@@ -1078,9 +1076,6 @@ class PrivateTab(ChatTab):
def get_text_window(self):
return self.text_win
- def just_before_refresh(self):
- return
-
def rename_user(self, old_nick, new_nick):
"""
The user changed her nick in the corresponding muc: update the tab’s name and
@@ -1393,9 +1388,6 @@ class RosterInfoTab(Tab):
self.reset_help_message()
return False
- def just_before_refresh(self):
- return
-
def on_close(self):
return
@@ -1467,6 +1459,10 @@ class ConversationTab(ChatTab):
self.tab_win.refresh()
self.input.refresh()
+ def refresh_info_header(self):
+ self.info_header.refresh(self.get_name(), roster.get_contact_by_jid(self.get_name()), self._room, self.text_win, self.chatstate)
+ self.input.refresh()
+
def get_color_state(self):
if self.color_state == theme.COLOR_TAB_NORMAL or\
self.color_state == theme.COLOR_TAB_CURRENT:
@@ -1523,9 +1519,6 @@ class ConversationTab(ChatTab):
def get_text_window(self):
return self.text_win
- def just_before_refresh(self):
- return
-
def on_close(self):
Tab.on_close(self)
if config.get('send_chat_states', 'true') == 'true':