summaryrefslogtreecommitdiff
path: root/src/window.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-10-04 00:27:40 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-10-04 00:27:40 +0000
commitd6bb19572e3a5557f1e125b68ec1676cced1448a (patch)
tree7e867c25344cf5e2398d02cdde11e0b86bfda600 /src/window.py
parent3ea295f8c78d74c7ce94db3271f0ce3464e4e0cb (diff)
downloadpoezio-d6bb19572e3a5557f1e125b68ec1676cced1448a.tar.gz
poezio-d6bb19572e3a5557f1e125b68ec1676cced1448a.tar.bz2
poezio-d6bb19572e3a5557f1e125b68ec1676cced1448a.tar.xz
poezio-d6bb19572e3a5557f1e125b68ec1676cced1448a.zip
contact information buffer in the roster tab (yet empty)
Diffstat (limited to 'src/window.py')
-rw-r--r--src/window.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/window.py b/src/window.py
index c10d3388..6f97f660 100644
--- a/src/window.py
+++ b/src/window.py
@@ -27,6 +27,9 @@ from config import config
from threading import Lock
+from contact import Contact
+from roster import RosterGroup
+
from message import Line
from tab import MIN_WIDTH, MIN_HEIGHT
@@ -1071,3 +1074,38 @@ class RosterWin(Win):
def get_selected_row(self):
return self.selected_row
+class ContactInfoWin(Win):
+ def __init__(self, height, width, y, x, parent_win, visible):
+ self.visible = visible
+ Win.__init__(self, height, width, y, x, parent_win)
+
+ def resize(self, height, width, y, x, stdscr, visible):
+ self._resize(height, width, y, x, stdscr, visible)
+ self.visible = visible
+
+ def draw_contact_info(self, contact):
+ """
+ draw the contact information
+ """
+ self.addnstr(0, 0, contact.get_jid().full, len(contact.get_jid().full), curses.color_pair(theme.COLOR_INFORMATION_BAR))
+ self.addnstr(' (%s)'%(contact.get_presence(),), len(contact.get_presence())+3, curses.color_pair(theme.COLOR_INFORMATION_BAR))
+ self.finish_line(theme.COLOR_INFORMATION_BAR)
+
+ def draw_group_info(self, group):
+ """
+ draw the group information
+ """
+ self.addnstr(0, 0, group.name, len(group.name), curses.color_pair(theme.COLOR_INFORMATION_BAR))
+ self.finish_line(theme.COLOR_INFORMATION_BAR)
+
+ def refresh(self, selected_row):
+ if not self.visible:
+ return
+ g_lock.acquire()
+ self.win.erase()
+ if isinstance(selected_row, RosterGroup):
+ self.draw_group_info(selected_row)
+ elif isinstance(selected_row, Contact):
+ self.draw_contact_info(selected_row)
+ self.win.refresh()
+ g_lock.release()