diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2013-02-23 22:59:40 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-03-03 13:48:21 +0000 |
commit | 1daa3d8f083e9b4b032492af370c1f592427d145 (patch) | |
tree | d5fa6b6777abb93f6cddf1546c08a8564ad5bab4 /alot/widgets/thread.py | |
parent | 592842cd16cab7d420186645b0cf53085142946d (diff) |
add Attachment widgets to MessageTree
Diffstat (limited to 'alot/widgets/thread.py')
-rw-r--r-- | alot/widgets/thread.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index 23364115..c0b2d8d5 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -314,6 +314,7 @@ class MessageBodyWidget(urwid.AttrMap): att = settings.get_theming_attribute('thread', 'body') urwid.AttrMap.__init__(self, urwid.Text(bodytxt), att) + class DictList(SimpleTree): def __init__(self, content, key_attr, value_attr, gaps_attr=None): """ @@ -340,9 +341,10 @@ class DictList(SimpleTree): line = urwid.Columns([keyw, valuew]) if gaps_attr is not None: line = urwid.AttrMap(line, gaps_attr) - structure.append((line,None)) + structure.append((line, None)) SimpleTree.__init__(self, structure) + class MessageTree(CollapsibleTree): def __init__(self, message, odd=True): self._message = message @@ -351,12 +353,15 @@ class MessageTree(CollapsibleTree): headers = settings.get('displayed_headers') self.selected_headers_tree = self.construct_header_pile(headers) + mainstruct = [ + (self.selected_headers_tree, None), + (MessageBodyWidget(message), None), + ] + for a in self._message.get_attachments(): + mainstruct.insert(1, (AttachmentWidget(a), None)) structure = [ (MessageSummaryWidget(message, even=(not odd)), - [ - (self.selected_headers_tree, None), - (MessageBodyWidget(message), None), - ] + mainstruct ) ] CollapsibleTree.__init__(self, SimpleTree(structure)) @@ -391,7 +396,8 @@ class MessageTree(CollapsibleTree): if key in mail: if key.lower() in ['cc', 'bcc', 'to']: values = mail.get_all(key) - values = [decode_header(v, normalize=normalize) for v in values] + values = [decode_header( + v, normalize=normalize) for v in values] lines.append((key, ', '.join(values))) else: for value in mail.get_all(key): |