diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-09-06 17:11:50 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-09-06 17:11:50 +0100 |
commit | 189a30aa5e6e681c0e7cea657e997e655dd42b96 (patch) | |
tree | 5c30d66d02f36d00291d6986b1d027c9a9ff28e2 /alot/widgets | |
parent | a58e32f1fc1318e762acb9e6ac990eb3e846a8b9 (diff) |
don't hardcode gaps attribute in HeadersList widget
cf issue #513
Diffstat (limited to 'alot/widgets')
-rw-r--r-- | alot/widgets/globals.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/alot/widgets/globals.py b/alot/widgets/globals.py index 940db187..db99ccbb 100644 --- a/alot/widgets/globals.py +++ b/alot/widgets/globals.py @@ -130,13 +130,24 @@ class CompleteEdit(urwid.Edit): class HeadersList(urwid.WidgetWrap): """ renders a pile of header values as key/value list """ - def __init__(self, headerslist, key_attr, value_attr): + def __init__(self, headerslist, key_attr, value_attr, gaps_attr=None): + """ + :param headerslist: list of key/value pairs to display + :type headerslist: list of (str, str) + :param key_attr: theming attribute to use for keys + :type key_attr: urwid.AttrSpec + :param value_attr: theming attribute to use for values + :type value_attr: urwid.AttrSpec + :param gaps_attr: theming attribute to wrap lines in + :type gaps_attr: urwid.AttrSpec + """ self.headers = headerslist self.key_attr = key_attr self.value_attr = value_attr pile = urwid.Pile(self._build_lines(headerslist)) - att = settings.get_theming_attribute('thread', 'header') - pile = urwid.AttrMap(pile, att) + if gaps_attr is None: + gaps_attr = key_attr + pile = urwid.AttrMap(pile, gaps_attr) urwid.WidgetWrap.__init__(self, pile) def __str__(self): |