From 96d3452d320b6e6fa338d9f61c869641d801e1bd Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Fri, 20 Jul 2012 18:54:23 +0100 Subject: individually theme arrows heads/bars in thread view --- alot/defaults/default.theme | 8 +++++--- alot/defaults/theme.spec | 2 ++ alot/widgets.py | 20 ++++++++++++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) (limited to 'alot') diff --git a/alot/defaults/default.theme b/alot/defaults/default.theme index 402eb3ec..cdfe8665 100644 --- a/alot/defaults/default.theme +++ b/alot/defaults/default.theme @@ -1,9 +1,9 @@ [global] - footer = 'standout','','light green','dark blue','white','#006' - body = 'default','','default','default','default','default' + footer = 'standout','','light green,bold','dark blue','light green,bold','dark blue' + body = 'default','','default','default','dark red','default' notify_error = 'standout','','white','dark red','white','dark red' notify_normal = 'default','','light gray','dark gray','light gray','#68a' - prompt = 'default','','light gray','black','light gray','g10' + prompt = 'default','','light gray','black','light gray','black' tag = 'default','','brown','black','brown','default' tag_focus = 'standout, bold','','white','dark gray','#ffa','#68a' [help] @@ -19,6 +19,8 @@ line_even = 'default','','light gray','black','default','g3' line_odd = 'default','','light gray','black','default','default' [thread] + arrow_heads = '','','light red','','light red','' + arrow_bars = '','','dark red','','dark red','' attachment = 'default','','light gray','dark gray','light gray','dark gray' attachment_focus = 'underline','','light gray','light green','light gray','light green' body = 'default','','light gray','default','light gray','default' diff --git a/alot/defaults/theme.spec b/alot/defaults/theme.spec index 27ed7e48..176d7b8a 100644 --- a/alot/defaults/theme.spec +++ b/alot/defaults/theme.spec @@ -46,6 +46,8 @@ width = widthtuple(default=None) alignment = align(default='right') [thread] + arrow_heads = attrtriple + arrow_bars = attrtriple attachment = attrtriple attachment_focus = attrtriple body = attrtriple diff --git a/alot/widgets.py b/alot/widgets.py index 278d31e4..74b30e32 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -12,6 +12,7 @@ import alot.db.message as message from alot.db.attachment import Attachment import time from alot.db.utils import decode_header +from alot.settings.utils import resolve_att class AttrFlipWidget(urwid.AttrMap): @@ -467,6 +468,12 @@ class MessageWidget(urwid.WidgetWrap): self._filtered_headers = [k for k in displayed if k in self.mail] self._displayed_headers = None + bars = settings.get_theming_attribute('thread', 'arrow_bars') + self.arrow_bars_att = bars + heads = settings.get_theming_attribute('thread', 'arrow_heads') + self.arrow_heads_att = heads + logging.debug(self.arrow_heads_att) + self.rebuild() # this will build self.pile urwid.WidgetWrap.__init__(self, self.pile) @@ -501,12 +508,15 @@ class MessageWidget(urwid.WidgetWrap): bc = list() # box_columns if self.depth > 1: bc.append(0) - cols.append(self._get_spacer(self.bars_at[1:-1])) + spacer = self._get_spacer(self.bars_at[1:-1]) + cols.append(spacer) if self.depth > 0: if self.bars_at[-1]: - arrowhead = u'\u251c\u25b6' + arrowhead = [(self.arrow_bars_att, u'\u251c'), + (self.arrow_heads_att, u'\u25b6')] else: - arrowhead = u'\u2514\u25b6' + arrowhead = [(self.arrow_bars_att, u'\u2514'), + (self.arrow_heads_att, u'\u25b6')] cols.append(('fixed', 2, urwid.Text(arrowhead))) cols.append(self.sumw) line = urwid.Columns(cols, box_columns=bc) @@ -605,6 +615,7 @@ class MessageWidget(urwid.WidgetWrap): prefixchars.append(('fixed', 1, urwid.SolidFill(c))) spacer = urwid.Columns(prefixchars, box_columns=range(length)) + spacer = urwid.AttrMap(spacer, self.arrow_bars_att) return ('fixed', length, spacer) def _get_arrowhead_aligner(self): @@ -612,7 +623,8 @@ class MessageWidget(urwid.WidgetWrap): aligner = u'\u2502' else: aligner = ' ' - return ('fixed', 1, urwid.SolidFill(aligner)) + aligner = urwid.SolidFill(aligner) + return ('fixed', 1, urwid.AttrMap(aligner, self.arrow_bars_att)) def selectable(self): return True -- cgit v1.2.3