summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-06-30 19:36:32 +0200
committermathieui <mathieui@mathieui.net>2013-06-30 19:36:32 +0200
commitf8aa0f9826735aa254b89c6df902004318b5bf16 (patch)
tree1321f92481f027e8cea130fa29be0b1461a24742
parentbafecae0d3127c0b82926e2ed53f0f0450e20afc (diff)
downloadpoezio-f8aa0f9826735aa254b89c6df902004318b5bf16.tar.gz
poezio-f8aa0f9826735aa254b89c6df902004318b5bf16.tar.bz2
poezio-f8aa0f9826735aa254b89c6df902004318b5bf16.tar.xz
poezio-f8aa0f9826735aa254b89c6df902004318b5bf16.zip
Fix #2329 (display the info buffer in the muclisttab)
also fix some typos in the comments, and a refresh issue with the input
-rw-r--r--src/tabs.py32
-rw-r--r--src/windows.py24
2 files changed, 41 insertions, 15 deletions
diff --git a/src/tabs.py b/src/tabs.py
index b2c2e5af..eb5b2192 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -3332,7 +3332,6 @@ class ConversationTab(ChatTab):
self.text_win.resize(self.height-3-self.core.information_win_size - Tab.tab_win_height(), self.width, 1, 0)
self.info_header.resize(1, self.width, self.height-2-self.core.information_win_size - Tab.tab_win_height(), 0)
-
def get_text_window(self):
return self.text_win
@@ -3445,11 +3444,10 @@ class MucListTab(Tab):
Tab.__init__(self)
self.state = 'normal'
self.name = server
- self.upper_message = windows.Topic()
- self.upper_message.set_message('Chatroom list on server %s (Loading)' % self.name)
columns = ('node-part', 'name', 'users')
self.list_header = windows.ColumnHeaderWin(columns)
self.listview = windows.ListWin(columns)
+ self.info_header = windows.MucListInfoWin(_('Chatroom list on server %s (Loading)') % self.name)
self.default_help_message = windows.HelpText("ā€œjā€: join room.")
self.input = self.default_help_message
self.key_func["KEY_DOWN"] = self.move_cursor_down
@@ -3472,25 +3470,26 @@ class MucListTab(Tab):
if self.need_resize:
self.resize()
log.debug(' TAB Refresh: %s',self.__class__.__name__)
- self.upper_message.refresh()
+ self.info_header.refresh()
+ self.info_win.refresh()
+ self.refresh_tab_win()
self.list_header.refresh()
self.listview.refresh()
- self.refresh_tab_win()
self.input.refresh()
self.update_commands()
def resize(self):
- if not self.visible:
+ if self.core.information_win_size >= self.height-3 or not self.visible:
return
self.need_resize = False
- self.upper_message.resize(1, self.width, 0, 0)
+ self.info_header.resize(1, self.width, self.height-2-self.core.information_win_size - Tab.tab_win_height(), 0)
column_size = {'node-part': int(self.width*2/8) ,
'name': int(self.width*5/8),
'users': self.width-int(self.width*2/8)-int(self.width*5/8)}
self.list_header.resize_columns(column_size)
- self.list_header.resize(1, self.width, 1, 0)
+ self.list_header.resize(1, self.width, 0, 0)
self.listview.resize_columns(column_size)
- self.listview.resize(self.height-4, self.width, 2, 0)
+ self.listview.resize(self.height-3-self.core.information_win_size - Tab.tab_win_height(), self.width, 1, 0)
self.input.resize(1, self.width, self.height-1, 0)
def on_slash(self):
@@ -3514,8 +3513,8 @@ class MucListTab(Tab):
If there's an error (retrieving the values etc)
"""
self._error_message = _('Error: %(code)s - %(msg)s: %(body)s') % {'msg':msg, 'body':body, 'code':code}
- self.upper_message.set_message(self._error_message)
- self.upper_message.refresh()
+ self.info_header.message = self._error_message
+ self.info_header.refresh()
curses.doupdate()
def on_muc_list_item_received(self, iq):
@@ -3530,10 +3529,10 @@ class MucListTab(Tab):
'jid': item[0],
'name': item[2] or '' ,'users': ''} for item in iq['disco_items'].get_items()]
self.listview.add_lines(items)
- self.upper_message.set_message('Chatroom list on server %s' % self.name)
+ self.info_header.message = _('Chatroom list on server %s') % self.name
if self.core.current_tab() is self:
self.listview.refresh()
- self.upper_message.refresh()
+ self.info_header.refresh()
else:
self.state = 'highlight'
self.refresh_tab_win()
@@ -3556,6 +3555,7 @@ class MucListTab(Tab):
return
self.core.command_join(row['jid'])
+ @refresh_wrapper.always
def reset_help_message(self, _=None):
curses.curs_set(0)
self.input = self.default_help_message
@@ -3582,6 +3582,12 @@ class MucListTab(Tab):
if not raw and key in self.key_func:
return self.key_func[key]()
+ def on_info_win_size_changed(self):
+ if self.core.information_win_size >= self.height-3:
+ return
+ self.info_header.resize(1, self.width, self.height-2-self.core.information_win_size - Tab.tab_win_height(), 0)
+ self.listview.resize(self.height-3-self.core.information_win_size - Tab.tab_win_height(), self.width, 1, 0)
+
def on_lose_focus(self):
self.state = 'normal'
diff --git a/src/windows.py b/src/windows.py
index 76137d85..a270d732 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -431,7 +431,7 @@ class InfoWin(Win):
def print_scroll_position(self, window):
"""
- Print, link in Weechat, a -MORE(n)- where n
+ Print, like in Weechat, a -MORE(n)- where n
is the number of available lines to scroll
down
"""
@@ -461,7 +461,7 @@ class XMLInfoWin(InfoWin):
class PrivateInfoWin(InfoWin):
"""
- The live above the information window, displaying informations
+ The line above the information window, displaying informations
about the MUC user we are talking to
"""
def __init__(self):
@@ -488,6 +488,26 @@ class PrivateInfoWin(InfoWin):
if state:
self.addstr(' %s' % (state,), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
+class MucListInfoWin(InfoWin):
+ """
+ The live above the information window, displaying informations
+ about the muc server being listed
+ """
+ def __init__(self, message=''):
+ InfoWin.__init__(self)
+ self.message = message
+
+ def refresh(self, name=None):
+ log.debug('Refresh: %s',self.__class__.__name__)
+ with g_lock:
+ self._win.erase()
+ if name:
+ self.addstr(name, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
+ else:
+ self.addstr(self.message, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
+ self.finish_line(get_theme().COLOR_INFORMATION_BAR)
+ self._refresh()
+
class ConversationInfoWin(InfoWin):
"""
The line above the information window, displaying informations