summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py46
1 files changed, 37 insertions, 9 deletions
diff --git a/src/tabs.py b/src/tabs.py
index ef4f9803..4ed8a335 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -69,6 +69,17 @@ STATE_COLORS = {
# 'attention': lambda: get_theme().COLOR_TAB_ATTENTION,
}
+VERTICAL_STATE_COLORS = {
+ 'disconnected': lambda: get_theme().COLOR_VERTICAL_TAB_DISCONNECTED,
+ 'message': lambda: get_theme().COLOR_VERTICAL_TAB_NEW_MESSAGE,
+ 'highlight': lambda: get_theme().COLOR_VERTICAL_TAB_HIGHLIGHT,
+ 'private': lambda: get_theme().COLOR_VERTICAL_TAB_PRIVATE,
+ 'normal': lambda: get_theme().COLOR_VERTICAL_TAB_NORMAL,
+ 'current': lambda: get_theme().COLOR_VERTICAL_TAB_CURRENT,
+# 'attention': lambda: get_theme().COLOR_VERTICAL_TAB_ATTENTION,
+ }
+
+
STATE_PRIORITY = {
'normal': -1,
'current': -1,
@@ -107,6 +118,13 @@ class Tab(object):
return Tab.tab_core.tab_win
@property
+ def left_tab_win(self):
+ if not Tab.tab_core:
+ Tab.tab_core = singleton.Singleton(core.Core)
+ return Tab.tab_core.left_tab_win
+
+
+ @property
def info_win(self):
return self.core.information_win
@@ -115,6 +133,10 @@ class Tab(object):
return STATE_COLORS[self._state]()
@property
+ def vertical_color(self):
+ return VERTICAL_STATE_COLORS[self._state]()
+
+ @property
def state(self):
return self._state
@@ -135,6 +157,7 @@ class Tab(object):
Tab.visible = False
else:
Tab.visible = True
+ windows.Win._tab_win = scr
def complete_commands(self, the_input):
"""
@@ -202,6 +225,11 @@ class Tab(object):
else:
return False
+ def refresh_tab_win(self):
+ self.tab_win.refresh()
+ if self.left_tab_win:
+ self.left_tab_win.refresh()
+
def refresh(self):
"""
Called on each screen refresh (when something has changed)
@@ -892,7 +920,7 @@ class MucTab(ChatTab):
self.v_separator.refresh()
self.user_win.refresh(self.users)
self.info_header.refresh(self, self.text_win)
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.info_win.refresh()
self.input.refresh()
@@ -1064,7 +1092,7 @@ class MucTab(ChatTab):
if from_nick == self.own_nick: # we are banned
self.disconnect()
self.core.disable_private_tabs(self.name)
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.core.doupdate()
if by:
kick_msg = _('\x191}%(spec)s \x193}You\x195} have been banned by \x194}%(by)s') % {'spec': get_theme().CHAR_KICK, 'by':by}
@@ -1091,7 +1119,7 @@ class MucTab(ChatTab):
if from_nick == self.own_nick: # we are kicked
self.disconnect()
self.core.disable_private_tabs(self.name)
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.core.doupdate()
if by:
kick_msg = _('\x191}%(spec)s \x193}You\x195} have been kicked by \x193}%(by)s') % {'spec': get_theme().CHAR_KICK, 'by':by}
@@ -1119,7 +1147,7 @@ class MucTab(ChatTab):
# We are now out of the room. Happens with some buggy (? not sure) servers
self.disconnect()
self.core.disable_private_tabs(from_room)
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.core.doupdate()
hide_exit_join = config.get('hide_exit_join', -1) if config.get('hide_exit_join', -1) >= -1 else -1
if hide_exit_join == -1 or user.has_talked_since(hide_exit_join):
@@ -1377,7 +1405,7 @@ class PrivateTab(ChatTab):
self.text_win.refresh()
self.info_header.refresh(self.name, self.text_win, self.chatstate)
self.info_win.refresh()
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.input.refresh()
def refresh_info_header(self):
@@ -1853,7 +1881,7 @@ class RosterInfoTab(Tab):
self.roster_win.refresh(roster)
self.contact_info_win.refresh(self.roster_win.get_selected_row())
self.information_win.refresh()
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.input.refresh()
def get_name(self):
@@ -2118,7 +2146,7 @@ class ConversationTab(ChatTab):
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.text_win, self.chatstate, ConversationTab.additional_informations)
self.info_win.refresh()
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.input.refresh()
def refresh_info_header(self):
@@ -2231,7 +2259,7 @@ class MucListTab(Tab):
self.upper_message.refresh()
self.list_header.refresh()
self.listview.refresh()
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.input.refresh()
self.update_commands()
@@ -2379,7 +2407,7 @@ class SimpleTextTab(Tab):
self.resize()
log.debug(' TAB Refresh: %s'%self.__class__.__name__)
self.text_win.refresh()
- self.tab_win.refresh()
+ self.refresh_tab_win()
self.input.refresh()
def on_lose_focus(self):