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/basetabs.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/tabs/basetabs.py') diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 86ba9e1f..5e38775b 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -1,9 +1,16 @@ """ -A Tab object is a way to organize various Windows (see windows.py) -around the screen at once. -A tab is then composed of multiple Buffers. -Each Tab object has different refresh() and resize() methods, defining how its -Windows are displayed, resized, etc. +Module for the base Tabs + +The root class Tab defines the generic interface and attributes of a +tab. A tab organizes various Windows around the screen depending +of the tab specificity. If the tab shows messages, it will also +reference a buffer containing the messages. + +Each subclass should redefine its own refresh() and resize() method +according to its windows. + +This module also defines ChatTabs, the parent class for all tabs +revolving around chats. """ from gettext import gettext as _ @@ -33,6 +40,7 @@ from theming import get_theme MIN_WIDTH = 42 MIN_HEIGHT = 6 +# getters for tab colors (lambdas, so that they are dynamic) STATE_COLORS = { 'disconnected': lambda: get_theme().COLOR_TAB_DISCONNECTED, 'scrolled': lambda: get_theme().COLOR_TAB_SCROLLED, @@ -44,7 +52,6 @@ STATE_COLORS = { 'current': lambda: get_theme().COLOR_TAB_CURRENT, 'attention': lambda: get_theme().COLOR_TAB_ATTENTION, } - VERTICAL_STATE_COLORS = { 'disconnected': lambda: get_theme().COLOR_VERTICAL_TAB_DISCONNECTED, 'scrolled': lambda: get_theme().COLOR_VERTICAL_TAB_SCROLLED, @@ -58,6 +65,8 @@ VERTICAL_STATE_COLORS = { } +# priority of the different tab states when using Alt+e +# higher means more priority, < 0 means not selectable STATE_PRIORITY = { 'normal': -1, 'current': -1, @@ -465,7 +474,7 @@ class ChatTab(Tab): identifier=identifier, jid=jid) - def modify_message(self, txt, old_id, new_id, user=None,jid=None, nickname=None): + def modify_message(self, txt, old_id, new_id, user=None, jid=None, nickname=None): self.log_message(txt, nickname, typ=1) message = self._text_buffer.modify_message(txt, old_id, new_id, time=time, user=user, jid=jid) if message: @@ -663,4 +672,3 @@ class ChatTab(Tab): def scroll_separator(self): self.text_win.scroll_to_separator() - -- cgit v1.2.3