summaryrefslogtreecommitdiff
path: root/alot/widgets
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-01-26 18:18:21 +0100
committerAnton Khirnov <anton@khirnov.net>2021-01-26 18:18:21 +0100
commit8c7d464d1e31e5994623d0e3d4ad4f8216b6696e (patch)
tree760461872ab2a897a4fe97c13418adf0cbdfa99c /alot/widgets
parentfe1450cba0cc808dd843f327c4383930a78effca (diff)
widgets/global: move HeadersList to the only place where it is used
Diffstat (limited to 'alot/widgets')
-rw-r--r--alot/widgets/globals.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/alot/widgets/globals.py b/alot/widgets/globals.py
index 387797af..8b9b3065 100644
--- a/alot/widgets/globals.py
+++ b/alot/widgets/globals.py
@@ -226,49 +226,6 @@ class CompleteEdit(urwid.Edit):
return pos
-class HeadersList(urwid.WidgetWrap):
- """ renders a pile of header values as key/value list """
-
- 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))
- if gaps_attr is None:
- gaps_attr = key_attr
- pile = urwid.AttrMap(pile, gaps_attr)
- urwid.WidgetWrap.__init__(self, pile)
-
- def __str__(self):
- return str(self.headers)
-
- def _build_lines(self, lines):
- max_key_len = 1
- headerlines = []
- # calc max length of key-string
- for key, value in lines:
- if len(key) > max_key_len:
- max_key_len = len(key)
- for key, value in lines:
- # todo : even/odd
- keyw = ('fixed', max_key_len + 1,
- urwid.Text((self.key_attr, key)))
- valuew = urwid.Text((self.value_attr, value))
- line = urwid.Columns([keyw, valuew])
- headerlines.append(line)
- return headerlines
-
-
class TagWidget(urwid.AttrMap):
"""
text widget that renders a tagstring.