summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2011-01-02 15:50:01 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2011-01-02 15:50:01 +0000
commit11357165186dce6614b03399f025febd4c48183e (patch)
tree1001faabe80a6637d9ac89beb1131fca7395dd0c /src/windows.py
parent15f7340661e0ef4b375e54dabc1f3c1f6f885c38 (diff)
downloadpoezio-11357165186dce6614b03399f025febd4c48183e.tar.gz
poezio-11357165186dce6614b03399f025febd4c48183e.tar.bz2
poezio-11357165186dce6614b03399f025febd4c48183e.tar.xz
poezio-11357165186dce6614b03399f025febd4c48183e.zip
fix /list with new SleekXMPP xep_0030 version. Also add some error handling and a '(loading)' information while waiting for the answer
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/windows.py b/src/windows.py
index 315ef84d..682d6487 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -154,14 +154,19 @@ class UserList(Win):
class Topic(Win):
def __init__(self):
Win.__init__(self)
+ self._message = ''
def resize(self, height, width, y, x, stdscr):
self._resize(height, width, y, x, stdscr)
- def refresh(self, topic):
+ def refresh(self, topic=None):
with g_lock:
self._win.erase()
- self.addstr(0, 0, topic[:self.width-1], curses.color_pair(theme.COLOR_TOPIC_BAR))
+ if topic:
+ msg = topic[:self.width-1]
+ else:
+ msg = self._message[:self.width-1]
+ self.addstr(0, 0, msg, curses.color_pair(theme.COLOR_TOPIC_BAR))
(y, x) = self._win.getyx()
remaining_size = self.width - x
if remaining_size:
@@ -169,6 +174,9 @@ class Topic(Win):
curses.color_pair(theme.COLOR_INFORMATION_BAR))
self._refresh()
+ def set_message(self, message):
+ self._message = message
+
class GlobalInfoBar(Win):
def __init__(self):
Win.__init__(self)
@@ -1362,12 +1370,13 @@ class ListWin(Win):
return
self.lines += lines
self.refresh()
+ curses.doupdate()
def get_selected_row(self):
"""
Return the tuple representing the selected row
"""
- if self._selected_row is not None:
+ if self._selected_row is not None and self.lines:
return self.lines[self._selected_row]
return None