diff options
author | mathieui <mathieui@mathieui.net> | 2012-10-15 14:48:08 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-10-15 14:48:08 +0200 |
commit | 5006b649d685298400adfc4ae5aa553f889c2a2a (patch) | |
tree | b2451f633d16506e435c776089bfe327e1567fdf | |
parent | cbaa46929876de38b02747a1e6f58a23b562bb56 (diff) | |
download | poezio-5006b649d685298400adfc4ae5aa553f889c2a2a.tar.gz poezio-5006b649d685298400adfc4ae5aa553f889c2a2a.tar.bz2 poezio-5006b649d685298400adfc4ae5aa553f889c2a2a.tar.xz poezio-5006b649d685298400adfc4ae5aa553f889c2a2a.zip |
Prettify the /names command
-rw-r--r-- | src/tabs.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/tabs.py b/src/tabs.py index 1c58f0c9..f3424b56 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -934,36 +934,37 @@ class MucTab(ChatTab): color_participant = get_theme().COLOR_USER_PARTICIPANT[0] visitors, moderators, participants, others = [], [], [], [] aff = { - '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, + 'owner': get_theme().CHAR_AFFILIATION_OWNER, + 'admin': get_theme().CHAR_AFFILIATION_ADMIN, + 'member': get_theme().CHAR_AFFILIATION_MEMBER, + 'none': get_theme().CHAR_AFFILIATION_NONE, } for user in self.users: if user.role == 'visitor': - visitors.append((user.nick, aff[user.affiliation]())) + visitors.append((user, aff[user.affiliation])) elif user.role == 'participant': - participants.append((user.nick, aff[user.affiliation]())) + participants.append((user, aff[user.affiliation])) elif user.role == 'moderator': - moderators.append((user.nick, aff[user.affiliation]())) + moderators.append((user, aff[user.affiliation])) else: - others.append((user.nick, aff[user.affiliation]())) + others.append((user, aff[user.affiliation])) - message = 'Users: %s \n' % len(self.users) + buff = ['Users: %s \n' % len(self.users)] for moderator in moderators: - message += ' [%s] \x19%s}%s\x19o -' % (moderator[1], - color_moderator, moderator[0]) + buff.append('\x19%s}%s\x19o\x19%s}%s\x19o' % (color_moderator, + moderator[1], moderator[0].color[0], moderator[0].nick)) for participant in participants: - message += ' [%s] \x19%s}%s\x19o -' % (participant[1], - color_participant, participant[0]) + buff.append('\x19%s}%s\x19o\x19%s}%s\x19o' % (color_participant, + participant[1], participant[0].color[0], participant[0].nick)) for visitor in visitors: - message += ' [%s] \x19%s}%s\x19o -' % (visitor[1], - color_visitor, visitor[0]) + buf.append('\x19%s}%s\x19o\x19%s}%s\x19o' % (color_visitor, + visitor[1], visitor[0].color[0], visitor[0].nick)) for other in others: - message += ' [%s] \x19%s}%s\x19o -' % (other[1], - color_other, other[0]) - message = message[:-2] + buff.append('\x19%s}%s\x19o\x19%s}%s\x19o' % (color_other, + other[1], other[0].color[0], other[0].nick)) + buff.append('\n') + message = ' '.join(buff) self._text_buffer.add_message(message) self.text_win.refresh() |