summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-07-20 18:54:23 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-07-20 18:54:23 +0100
commit96d3452d320b6e6fa338d9f61c869641d801e1bd (patch)
tree3520be0f89c7b8eb36a695402c88e6325609ad8e
parent903c0ad20ea55e7be525a2ab1f3d01c1aed93774 (diff)
individually theme arrows heads/bars in thread view
-rw-r--r--alot/defaults/default.theme8
-rw-r--r--alot/defaults/theme.spec2
-rw-r--r--alot/widgets.py20
-rwxr-xr-xextra/theme_convert.py2
4 files changed, 25 insertions, 7 deletions
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
diff --git a/extra/theme_convert.py b/extra/theme_convert.py
index 0873bd02..8a0d26ca 100755
--- a/extra/theme_convert.py
+++ b/extra/theme_convert.py
@@ -103,6 +103,8 @@ if __name__ == "__main__":
new['thread']['attachment'] = lookup(['thread','attachment'])
new['thread']['attachment_focus'] = lookup(['thread','attachment_focus'])
new['thread']['body'] = lookup(['thread','body'])
+ new['thread']['arrow_heads'] = lookup(['thread','body'])
+ new['thread']['arrow_bars'] = lookup(['thread','body'])
new['thread']['header'] = lookup(['thread','header'])
new['thread']['header_key'] = lookup(['thread','header_key'])
new['thread']['header_value'] = lookup(['thread','header_value'])