From 2f8f4eccb8fe9bc8b34f47c80c9e963866f21628 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 28 Nov 2011 16:46:20 +0100 Subject: Curses operations must operate within the lock --- src/windows.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index 81153239..80a8bbb1 100644 --- a/src/windows.py +++ b/src/windows.py @@ -660,8 +660,8 @@ class TextWin(Win): lines = self.built_lines[-self.height:] else: lines = self.built_lines[-self.height-self.pos:-self.pos] - self._win.move(0, 0) with g_lock: + self._win.move(0, 0) self._win.erase() for y, line in enumerate(lines): if line: -- cgit v1.2.3 From 1e8383c3e3ba717b45d69a978361bbae34f8fd39 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 29 Nov 2011 00:18:31 +0100 Subject: =?UTF-8?q?Fix=20a=20traceback=20when=20using=20^W=20with=20xhtml-?= =?UTF-8?q?im=20(it=20does=20not=20work=20perfectly=20as=20it=20should,=20?= =?UTF-8?q?but=20it=20doesn=E2=80=99t=20crash=20anymore,=20at=20least)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 80a8bbb1..f2ffc8a7 100644 --- a/src/windows.py +++ b/src/windows.py @@ -852,9 +852,9 @@ class Input(Win): if not len(self.text) or self.pos == 0: return separators = string.punctuation+' ' - while self.pos > 0 and self.text[self.pos+self.line_pos-1] in separators: + while self.pos <= len(self.text) and self.pos > 0 and self.text[self.pos+self.line_pos-1] in separators: self.key_backspace() - while self.pos > 0 and self.text[self.pos+self.line_pos-1] not in separators: + while self.pos <= len(self.text) and self.pos > 0 and self.text[self.pos+self.line_pos-1] not in separators: self.key_backspace() return True -- cgit v1.2.3 From cb32f6d30a1974f05b5378acc6fe46fcf0d53f4d Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 30 Nov 2011 23:25:22 +0100 Subject: show_tab_names option lets you display the name of the tabs in the horizontal bar --- src/windows.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index f2ffc8a7..a13efdf5 100644 --- a/src/windows.py +++ b/src/windows.py @@ -303,6 +303,8 @@ class GlobalInfoBar(Win): continue try: self.addstr("%s" % str(tab.nb), to_curses_attr(color)) + if config.get('show_tab_names', 'false') == 'true': + self.addstr(" %s" % str(tab.get_name()), to_curses_attr(color)) self.addstr("|", to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) except: # end of line break -- cgit v1.2.3 From 02099123b0f2272954e91b737f50a797e4df0420 Mon Sep 17 00:00:00 2001 From: manfraid Date: Thu, 8 Dec 2011 16:22:43 +0100 Subject: Fixe 2104 --- src/windows.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index a13efdf5..6c3c8b5c 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1642,6 +1642,12 @@ class ListWin(Win): """ Sort the list by the given column, ascendant or descendant """ + if asc: + self.lines.sort(key=lambda x: x[col_name]) + else: + self.lines.sort(key=lambda x: x[col_name],reverse=True) + self.refresh() + curses.doupdate() pass # TODO def add_lines(self, lines): @@ -1741,6 +1747,9 @@ class ColumnHeaderWin(Win): Win.__init__(self) self._columns = columns self._columns_sizes = {} + self._column_sel = '' + self._column_order = '' + self._column_order_asc = False def resize_columns(self, dic): self._columns_sizes = dic @@ -1755,12 +1764,65 @@ class ColumnHeaderWin(Win): x = 0 for col in self._columns: txt = col + if col in self._column_order: + if self._column_order_asc: + txt += get_theme().CHAR_COLUMN_ASC + else: + txt += get_theme().CHAR_COLUMN_DESC + #⇓⇑↑↓⇧⇩▲▼ size = self._columns_sizes[col] txt += ' ' * (size-len(txt)) - self.addstr(0, x, txt, to_curses_attr(get_theme().COLOR_COLUMN_HEADER)) + if col in self._column_sel: + self.addstr(0, x, txt, to_curses_attr(get_theme().COLOR_COLUMN_HEADER_SEL)) + else: + self.addstr(0, x, txt, to_curses_attr(get_theme().COLOR_COLUMN_HEADER)) x += size self._refresh() + def sel_column(self,dic): + self._column_sel = dic + + def get_sel_column(self): + return self._column_sel + + def set_order(self,order): + self._column_order = self._column_sel + self._column_order_asc = order + + def get_order(self): + if self._column_sel == self._column_order: + return self._column_order_asc + else: + return False + + def sel_column_left(self): + if self._column_sel in self._columns: + index = self._columns.index(self._column_sel) + if index > 1: + index = index -1 + else: + index = 0 + else: + index = 0 + self._column_sel = self._columns[index] + self.refresh() + return + + def sel_column_right(self): + if self._column_sel in self._columns: + index = self._columns.index(self._column_sel) + if index < len(self._columns)-2: + index = index +1 + else: + index = len(self._columns) -1 + else: + index = len(self._columns) - 1 + self._column_sel = self._columns[index] + self.refresh() + return + + + class SimpleTextWin(Win): def __init__(self, text): Win.__init__(self) -- cgit v1.2.3 From a25b39777c69698163d80575aa623004ed465d2b Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 9 Dec 2011 13:56:14 +0100 Subject: Fix sorting columns when a room has no name. (we use '' instead of None) --- src/windows.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/windows.py') diff --git a/src/windows.py b/src/windows.py index 6c3c8b5c..1b833290 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1648,7 +1648,6 @@ class ListWin(Win): self.lines.sort(key=lambda x: x[col_name],reverse=True) self.refresh() curses.doupdate() - pass # TODO def add_lines(self, lines): """ -- cgit v1.2.3 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