From fff3d805a105722b85281654a2dfdf902c9c5cac Mon Sep 17 00:00:00 2001
From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13"
 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>
Date: Fri, 12 Feb 2010 22:32:58 +0000
Subject: show a color space to to show the show (aha.) of the users

---
 src/gui.py    |  2 ++
 src/window.py | 28 +++++++++++++++++++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)

(limited to 'src')

diff --git a/src/gui.py b/src/gui.py
index 38a98d38..fd3f7fe8 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -292,6 +292,8 @@ class Gui(object):
         curses.init_pair(11, curses.COLOR_WHITE, curses.COLOR_BLUE) # normal room
         curses.init_pair(12, curses.COLOR_WHITE, curses.COLOR_MAGENTA) # new message room
         curses.init_pair(13, curses.COLOR_WHITE, curses.COLOR_RED) # highlight room
+        curses.init_pair(14, curses.COLOR_WHITE, curses.COLOR_YELLOW)
+        curses.init_pair(15, curses.COLOR_WHITE, curses.COLOR_GREEN)
 
     def reset_curses(self):
 	curses.echo()
diff --git a/src/window.py b/src/window.py
index aa8cf5da..8ad1fc78 100644
--- a/src/window.py
+++ b/src/window.py
@@ -38,9 +38,16 @@ class UserList(Win):
         self.win.attron(curses.color_pair(2))
         self.win.vline(0, 0, curses.ACS_VLINE, self.height)
         self.win.attroff(curses.color_pair(2))
-        self.color_dict = {'moderator': 3,
+        self.color_role = {'moderator': 3,
                            'participant':2,
-                           'visitor':4}
+                           'visitor':4
+                           }
+        self.color_show = {'xa':12,
+                           'None':8,
+                           'dnd':13,
+                           'away':14,
+                           'chat':15
+                           }
 
     def refresh(self, users):
         if not self.visible:
@@ -49,12 +56,19 @@ class UserList(Win):
         y = 0
         for user in users:
             try:
-                color = self.color_dict[user.role]
+                role_col = self.color_role[user.role]
             except:
-                color = 1
-            self.win.attron(curses.color_pair(color))
-            self.win.addnstr(y, 1, user.nick, self.width-1)
-            self.win.attroff(curses.color_pair(color))
+                role_col = 1
+            try:
+                show_col = self.color_show[user.show]
+            except:
+                show_col = 8
+            self.win.attron(curses.color_pair(show_col))
+            self.win.addnstr(y, 0, " ", 1)
+            self.win.attroff(curses.color_pair(show_col))
+            self.win.attron(curses.color_pair(role_col))
+            self.win.addnstr(y, 1, user.nick, self.width-2)
+            self.win.attroff(curses.color_pair(role_col))
             y += 1
             if y == self.height:
                 break
-- 
cgit v1.2.3