From 561af013b1432fbb9b52d7f246be487347991687 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 24 Jan 2012 17:07:04 +0100 Subject: New participant list. Displaying the nick color, the affiliation, role, chatstate and status! --- src/windows.py | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'src/windows.py') 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) -- cgit v1.2.3 From 7ba606136293aa9b08cb1185e046cfdff7bf1589 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 25 Jan 2012 17:51:11 +0100 Subject: Add affiliation chars in the theme --- src/windows.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index 7d9194b2..89630a12 100644 --- a/src/windows.py +++ b/src/windows.py @@ -196,10 +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.symbol_affiliation = {'owner': lambda: get_theme().CHAR_AFFILIATION_OWNER, + 'admin': lambda: get_theme().CHAR_AFFILIATION_ADMIN, + 'member': lambda: get_theme().CHAR_AFFILIATION_MEMBER, + 'none': lambda: get_theme().CHAR_AFFILIATION_NONE, } self.color_show = {'xa': lambda: get_theme().COLOR_STATUS_XA, 'none': lambda: get_theme().COLOR_STATUS_NONE, '': lambda: get_theme().COLOR_STATUS_NONE, @@ -245,7 +245,7 @@ class UserList(Win): color = get_theme().COLOR_USER_NONE else: color = self.color_role[user.role]() - symbol = self.symbol_affiliation.get(user.affiliation) or '-' + symbol = self.symbol_affiliation.get(user.affiliation, lambda: '-')() self.addstr(y, 1, symbol, to_curses_attr(color)) def draw_status_chatstate(self, y, user): -- cgit v1.2.3 From 17fdd5d60618ebc1e84a966b89e57c43fc6dd53a Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 25 Jan 2012 18:14:07 +0100 Subject: Fixes #2316 --- src/windows.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index 89630a12..3a852ebc 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1667,8 +1667,6 @@ class ListWin(Win): if not lines: return self.lines += lines - self.refresh() - curses.doupdate() def get_selected_row(self): """ -- cgit v1.2.3 From 560390793d29728ea96e1a547424a28098dcb610 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 14 Feb 2012 00:33:29 +0100 Subject: Add 'joined' tab state, and rewrite the function handling the priorities --- src/windows.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index 3a852ebc..91363f26 100644 --- a/src/windows.py +++ b/src/windows.py @@ -310,7 +310,7 @@ class GlobalInfoBar(Win): for tab in sorted_tabs: color = tab.color if config.get('show_inactive_tabs', 'true') == 'false' and\ - color == get_theme().COLOR_TAB_NORMAL: + color is get_theme().COLOR_TAB_NORMAL: continue try: self.addstr("%s" % str(tab.nb), to_curses_attr(color)) @@ -342,7 +342,7 @@ class VerticalGlobalInfoBar(Win): sorted_tabs = sorted(self.core.tabs, key=comp) if config.get('show_inactive_tabs', 'true') == 'false': sorted_tabs = [tab for tab in sorted_tabs if\ - tab.vertical_color != get_theme().COLOR_VERTICAL_TAB_NORMAL] + tab.vertical_color is not get_theme().COLOR_VERTICAL_TAB_NORMAL] nb_tabs = len(sorted_tabs) if nb_tabs >= height: for y, tab in enumerate(sorted_tabs): -- cgit v1.2.3 From b89cd8fd8322bf8aa23130398a0a70defcba708d Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 14 Feb 2012 11:49:09 +0100 Subject: Fixes #2303 (add user_list_sort option) --- src/windows.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index 91363f26..542c027d 100644 --- a/src/windows.py +++ b/src/windows.py @@ -222,15 +222,24 @@ class UserList(Win): log.debug('Refresh: %s',self.__class__.__name__) with g_lock: self._win.erase() - y = 0 - users = sorted(users) + if config.get('user_list_sort', 'desc').lower() == 'asc': + y, x = self._win.getmaxyx() + y -= 1 + users = sorted(users, reverse=True) + else: + y = 0 + users = sorted(users) + if self.pos >= len(users) and self.pos != 0: self.pos = len(users)-1 for user in users[self.pos:]: 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 config.get('user_list_sort', 'desc').lower() == 'asc': + y -= 1 + else: + y += 1 if y == self.height: break # draw indicators of position in the list -- cgit v1.2.3