diff options
author | mathieui <mathieui@mathieui.net> | 2012-02-14 11:49:09 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-02-14 11:49:09 +0100 |
commit | b89cd8fd8322bf8aa23130398a0a70defcba708d (patch) | |
tree | cd3c785dc635940735b320538e3869de1e5ad799 /src/windows.py | |
parent | 0f5ba0a7119ab6d2aa61e436fa19a8046ffbf712 (diff) | |
download | poezio-b89cd8fd8322bf8aa23130398a0a70defcba708d.tar.gz poezio-b89cd8fd8322bf8aa23130398a0a70defcba708d.tar.bz2 poezio-b89cd8fd8322bf8aa23130398a0a70defcba708d.tar.xz poezio-b89cd8fd8322bf8aa23130398a0a70defcba708d.zip |
Fixes #2303 (add user_list_sort option)
Diffstat (limited to 'src/windows.py')
-rw-r--r-- | src/windows.py | 15 |
1 files changed, 12 insertions, 3 deletions
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 |