From 186803d9a97d7efb089acc470b98293b7e472db5 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 23 Mar 2014 00:15:01 +0100 Subject: Fix formatting, some typos, and unused code, and add docstrings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - No idea why subclasses of ConversationTab were working before (info_header was overriden with None in __init__) - Or why the date parsing worked (“Exeception”) - Some more reformatting with pylint indications - Document each module in the tabs module --- src/tabs/muclisttab.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/tabs/muclisttab.py') diff --git a/src/tabs/muclisttab.py b/src/tabs/muclisttab.py index 0fe27307..c5b2a205 100644 --- a/src/tabs/muclisttab.py +++ b/src/tabs/muclisttab.py @@ -1,3 +1,9 @@ +""" +A MucListTab is a tab listing the rooms on a conference server. + +It has no functionnality except scrolling the list, and allowing the +user to join the rooms. +""" from gettext import gettext as _ import logging @@ -18,6 +24,7 @@ class MucListTab(Tab): """ plugin_commands = {} plugin_keys = {} + def __init__(self, server): Tab.__init__(self) self.state = 'normal' @@ -47,7 +54,7 @@ class MucListTab(Tab): def refresh(self): if self.need_resize: self.resize() - log.debug(' TAB Refresh: %s',self.__class__.__name__) + log.debug(' TAB Refresh: %s', self.__class__.__name__) self.info_header.refresh() self.info_win.refresh() self.refresh_tab_win() @@ -61,7 +68,7 @@ class MucListTab(Tab): return self.need_resize = False self.info_header.resize(1, self.width, self.height-2-self.core.information_win_size - Tab.tab_win_height(), 0) - column_size = {'node-part': int(self.width*2/8) , + column_size = {'node-part': int(self.width*2/8), 'name': int(self.width*5/8), 'users': self.width-int(self.width*2/8)-int(self.width*5/8)} self.list_header.resize_columns(column_size) @@ -105,7 +112,7 @@ class MucListTab(Tab): return items = [{'node-part': safeJID(item[0]).user if safeJID(item[0]).server == self.name else safeJID(item[0]).bare, 'jid': item[0], - 'name': item[2] or '' ,'users': ''} for item in iq['disco_items'].get_items()] + 'name': item[2] or '', 'users': ''} for item in iq['disco_items'].get_items()] self.listview.add_lines(items) self.info_header.message = _('Chatroom list on server %s') % self.name if self.core.current_tab() is self: @@ -118,11 +125,15 @@ class MucListTab(Tab): def sort_by(self): if self.list_header.get_order(): - self.listview.sort_by_column(col_name=self.list_header.get_sel_column(),asc=False) + self.listview.sort_by_column( + col_name=self.list_header.get_sel_column(), + asc=False) self.list_header.set_order(False) self.list_header.refresh() else: - self.listview.sort_by_column(col_name=self.list_header.get_sel_column(),asc=True) + self.listview.sort_by_column( + col_name=self.list_header.get_sel_column(), + asc=True) self.list_header.set_order(True) self.list_header.refresh() curses.doupdate() -- cgit v1.2.3