summaryrefslogtreecommitdiff
path: root/alot/widgets
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-04-19 17:15:18 +0200
committerAnton Khirnov <anton@khirnov.net>2020-04-19 17:15:18 +0200
commitb03af5b8640ae691e89d3ae42701c95100c8a336 (patch)
tree3b4710d9d18c5ce361f8c4863b26f94725772009 /alot/widgets
parent09eb3dd5f8465299e75fad5900614614e62bd537 (diff)
widgets/thread: configurable theming for crypto
Diffstat (limited to 'alot/widgets')
-rw-r--r--alot/widgets/thread.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py
index 5852967d..09dd15fe 100644
--- a/alot/widgets/thread.py
+++ b/alot/widgets/thread.py
@@ -156,30 +156,25 @@ class _MessageBodyWidget(urwid.WidgetWrap):
text_parts.append(desc + ' MIME part')
if mime_tree.is_signed and mime_tree.sig_valid:
- trust = 'trusted' if mime_tree.sig_trusted else 'untrusted'
- t = 'valid signature from: %s (%s)' % (mime_tree.signer_id, trust)
+ if mime_tree.sig_trusted:
+ trust = 'trusted'
+ attr_name = 'crypt_trusted'
+ else:
+ trust = 'untrusted'
+ attr_name = 'crypt_untrusted'
+
+ t = 'valid %s signature from "%s"' % (trust, mime_tree.signer_id)
text_parts.append(t)
+ else:
+ attr_name = 'crypt_unsigned'
if mime_tree.crypt_error:
text_parts.append('crypto processing error: ' + mime_tree.crypt_error)
-
- header = urwid.Columns([])
-
- div_down = urwid.Divider('↓')
- div_up = urwid.Divider('↑')
- hdr_sep = (div_down, ('weight', 1, False))
-
- header.contents.append(hdr_sep)
-
- for t in text_parts:
- header.contents.append((urwid.Text(t), ('pack', None, False)))
- header.contents.append(hdr_sep)
-
- footer = div_up
+ attr_name = 'crypt_invalid'
body = self._build_body(mime_tree.children[0])
-
- return urwid.Pile([header, body, footer])
+ attr = settings.get_theming_attribute('thread', attr_name)
+ return urwid.AttrMap(urwid.LineBox(body, title = ':'.join(text_parts)), attr)
def _render_plain_text(self, text):
attr_text = settings.get_theming_attribute('thread', 'body')