diff options
author | Florent Le Coz <louiz@louiz.org> | 2012-01-24 17:07:04 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2012-01-26 10:05:37 +0100 |
commit | fc6db466f518b8b54f3ce23695d63c77b09e3891 (patch) | |
tree | 556d9b3653faa743e8b6a851b33bea222f1ff249 /src | |
parent | 7512001612a42cc46552a619d876c551e8ee51b1 (diff) | |
download | poezio-fc6db466f518b8b54f3ce23695d63c77b09e3891.tar.gz poezio-fc6db466f518b8b54f3ce23695d63c77b09e3891.tar.bz2 poezio-fc6db466f518b8b54f3ce23695d63c77b09e3891.tar.xz poezio-fc6db466f518b8b54f3ce23695d63c77b09e3891.zip |
New participant list. Displaying the nick color, the affiliation, role, chatstate and status!
Diffstat (limited to 'src')
-rw-r--r-- | src/tabs.py | 1 | ||||
-rw-r--r-- | src/windows.py | 49 |
2 files changed, 31 insertions, 19 deletions
diff --git a/src/tabs.py b/src/tabs.py index 53405db4..019fae30 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -678,6 +678,7 @@ class MucTab(ChatTab): for i, user in enumerate(sorted_users): user.color = colors[i % len(colors)] self.text_win.rebuild_everything(self._text_buffer) + self.user_win.refresh(self.users) self.text_win.refresh() self.input.refresh() diff --git a/src/windows.py b/src/windows.py index 1b833290..7d9194b2 100644 --- a/src/windows.py +++ b/src/windows.py @@ -196,6 +196,10 @@ class UserList(Win): 'none': lambda: get_theme().COLOR_USER_NONE, '': lambda: get_theme().COLOR_USER_NONE } + self.symbol_affiliation = {'owner': '~', + 'admin': '&', + 'member': '+', + 'none': '-'} self.color_show = {'xa': lambda: get_theme().COLOR_STATUS_XA, 'none': lambda: get_theme().COLOR_STATUS_NONE, '': lambda: get_theme().COLOR_STATUS_NONE, @@ -203,7 +207,6 @@ class UserList(Win): 'away': lambda: get_theme().COLOR_STATUS_AWAY, 'chat': lambda: get_theme().COLOR_STATUS_CHAT } - def scroll_up(self): self.pos += self.height-1 @@ -224,24 +227,9 @@ class UserList(Win): if self.pos >= len(users) and self.pos != 0: self.pos = len(users)-1 for user in users[self.pos:]: - if not user.role in self.color_role: - role_col = get_theme().COLOR_USER_NONE - else: - role_col = self.color_role[user.role]() - if not user.show in self.color_show: - show_col = get_theme().COLOR_STATUS_NONE - else: - show_col = self.color_show[user.show]() - if user.chatstate == 'composing': - char = get_theme().CHAR_CHATSTATE_COMPOSING - elif user.chatstate == 'active': - char = get_theme().CHAR_CHATSTATE_ACTIVE - elif user.chatstate == 'paused': - char = get_theme().CHAR_CHATSTATE_PAUSED - else: - char = get_theme().CHAR_STATUS - self.addstr(y, 0, char, to_curses_attr(show_col)) - self.addstr(y, 1, user.nick[:self.width-2], to_curses_attr(role_col)) + self.draw_role_affiliation(y, user) + self.draw_status_chatstate(y, user) + self.addstr(y, 2, user.nick[:self.width-2], to_curses_attr(user.color)) y += 1 if y == self.height: break @@ -252,6 +240,29 @@ class UserList(Win): self.draw_plus(self.height-1) self._refresh() + def draw_role_affiliation(self, y, user): + if not user.role in self.color_role: + color = get_theme().COLOR_USER_NONE + else: + color = self.color_role[user.role]() + symbol = self.symbol_affiliation.get(user.affiliation) or '-' + self.addstr(y, 1, symbol, to_curses_attr(color)) + + def draw_status_chatstate(self, y, user): + if not user.show in self.color_show: + show_col = get_theme().COLOR_STATUS_NONE + else: + show_col = self.color_show[user.show]() + if user.chatstate == 'composing': + char = get_theme().CHAR_CHATSTATE_COMPOSING + elif user.chatstate == 'active': + char = get_theme().CHAR_CHATSTATE_ACTIVE + elif user.chatstate == 'paused': + char = get_theme().CHAR_CHATSTATE_PAUSED + else: + char = get_theme().CHAR_STATUS + self.addstr(y, 0, char, to_curses_attr(show_col)) + def resize(self, height, width, y, x): with g_lock: self._resize(height, width, y, x) |