summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/buffers.py7
-rw-r--r--alot/commands/globals.py6
-rw-r--r--alot/ui.py13
-rw-r--r--alot/widgets.py29
-rwxr-xr-xsetup.py1
5 files changed, 35 insertions, 21 deletions
diff --git a/alot/buffers.py b/alot/buffers.py
index 8e5d4c77..43982369 100644
--- a/alot/buffers.py
+++ b/alot/buffers.py
@@ -71,10 +71,11 @@ class BufferlistBuffer(Buffer):
for (num, b) in enumerate(displayedbuffers):
line = widgets.BufferlineWidget(b)
if (num % 2) == 0:
- attr = 'bufferlist_results_even'
+ attr = settings.get_theming_attribute('bufferlist', 'results_even')
else:
- attr = 'bufferlist_results_odd'
- buf = urwid.AttrMap(line, attr, 'bufferlist_focus')
+ attr = settings.get_theming_attribute('bufferlist', 'results_odd')
+ focus_att = settings.get_theming_attribute('bufferlist', 'focus')
+ buf = urwid.AttrMap(line, attr, focus_att)
num = urwid.Text('%3d:' % self.index_of(b))
lines.append(urwid.Columns([('fixed', 4, num), buf]))
self.bufferlist = urwid.ListBox(urwid.SimpleListWalker(lines))
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 81385456..48f52cb0 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -414,9 +414,11 @@ class HelpCommand(Command):
ckey = 'cancel'
titletext = 'Bindings Help (%s cancels)' % ckey
+ text_att = settings.get_theming_attribute('help', 'text')
+ title_att = settings.get_theming_attribute('help', 'title')
box = widgets.DialogBox(body, titletext,
- bodyattr='help_text',
- titleattr='help_title')
+ bodyattr=text_att,
+ titleattr=title_att)
# put promptwidget as overlay on main widget
overlay = urwid.Overlay(box, ui.mainframe, 'center',
diff --git a/alot/ui.py b/alot/ui.py
index 99678a7d..f2ac65cf 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -94,7 +94,6 @@ class UI(object):
self.mainframe = urwid.Frame(urwid.SolidFill())
self.inputwrap = InputWrap(self, self.mainframe)
self.mainloop = urwid.MainLoop(self.inputwrap,
- config.get_palette(), #todo: remove
handle_mouse=False,
event_loop=urwid.TwistedEventLoop(),
unhandled_input=self.unhandeled_input)
@@ -171,7 +170,8 @@ class UI(object):
('fixed', len(prefix), leftpart),
('weight', 1, editpart),
])
- both = urwid.AttrMap(both, 'global_prompt')
+ att = settings.get_theming_attribute('global', 'prompt')
+ both = urwid.AttrMap(both, att)
# put promptwidget as overlay on main widget
overlay = urwid.Overlay(both, oldroot,
@@ -315,7 +315,8 @@ class UI(object):
], dividechars=1)
else: # above
both = urwid.Pile([msgpart, choicespart])
- both = urwid.AttrMap(both, 'prompt', 'prompt')
+ att = settings.get_theming_attribute('global', 'prompt')
+ both = urwid.AttrMap(both, att, att)
# put promptwidget as overlay on main widget
overlay = urwid.Overlay(both, oldroot,
@@ -349,7 +350,8 @@ class UI(object):
"""
def build_line(msg, prio):
cols = urwid.Columns([urwid.Text(msg)])
- return urwid.AttrMap(cols, 'global_notify_' + prio)
+ att = settings.get_theming_attribute('global', 'notify_' + prio)
+ return urwid.AttrMap(cols, att)
msgs = [build_line(message, priority)]
if not self.notificationbar:
@@ -422,7 +424,8 @@ class UI(object):
columns = urwid.Columns([
footerleft,
('fixed', len(righttxt), footerright)])
- return urwid.AttrMap(columns, 'global_footer')
+ footer_att = settings.get_theming_attribute('global', 'footer')
+ return urwid.AttrMap(columns, footer_att)
def apply_command(self, cmd):
"""
diff --git a/alot/widgets.py b/alot/widgets.py
index da3e4d73..01e7363e 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -77,8 +77,9 @@ class ThreadlineWidget(urwid.AttrMap):
self.tag_widgets = []
self.display_content = settings.get('display_content_in_threadline')
self.rebuild()
- urwid.AttrMap.__init__(self, self.columns,
- 'search_thread', 'search_thread_focus')
+ normal = settings.get_theming_attribute('search', 'thread')
+ focussed = settings.get_theming_attribute('search', 'thread_focus')
+ urwid.AttrMap.__init__(self, self.columns, normal, focussed)
def rebuild(self):
cols = []
@@ -563,9 +564,9 @@ class MessageSummaryWidget(urwid.WidgetWrap):
self.message = message
self.even = even
if even:
- attr = 'thread_summary_even'
+ attr = settings.get_theming_attribute('thread', 'summary_even')
else:
- attr = 'thread_summary_odd'
+ attr = settings.get_theming_attribute('thread', 'summary_odd')
cols = []
sumstr = self.__str__()
@@ -578,8 +579,9 @@ class MessageSummaryWidget(urwid.WidgetWrap):
tag_widgets.sort(tag_cmp, lambda tag_widget: tag_widget.translated)
for tag_widget in tag_widgets:
cols.append(('fixed', tag_widget.width(), tag_widget))
+ focus_att = settings.get_theming_attribute('thread', 'summary_focus')
line = urwid.AttrMap(urwid.Columns(cols, dividechars=1), attr,
- 'thread_summary_focus')
+ focus_att)
urwid.WidgetWrap.__init__(self, line)
def __str__(self):
@@ -609,7 +611,8 @@ class HeadersList(urwid.WidgetWrap):
def __init__(self, headerslist):
self.headers = headerslist
pile = urwid.Pile(self._build_lines(headerslist))
- pile = urwid.AttrMap(pile, 'thread_header')
+ att = settings.get_theming_attribute('thread', 'header')
+ pile = urwid.AttrMap(pile, att)
urwid.WidgetWrap.__init__(self, pile)
def __str__(self):
@@ -618,6 +621,8 @@ class HeadersList(urwid.WidgetWrap):
def _build_lines(self, lines):
max_key_len = 1
headerlines = []
+ key_att = settings.get_theming_attribute('thread', 'header_key')
+ value_att = settings.get_theming_attribute('thread', 'header_value')
#calc max length of key-string
for key, value in lines:
if len(key) > max_key_len:
@@ -625,8 +630,8 @@ class HeadersList(urwid.WidgetWrap):
for key, value in lines:
##todo : even/odd
keyw = ('fixed', max_key_len + 1,
- urwid.Text(('thread_header_key', key)))
- valuew = urwid.Text(('thread_header_value', value))
+ urwid.Text((key_att, key)))
+ valuew = urwid.Text((value_att, value))
line = urwid.Columns([keyw, valuew])
headerlines.append(line)
return headerlines
@@ -642,7 +647,8 @@ class MessageBodyWidget(urwid.AttrMap):
def __init__(self, msg):
bodytxt = message.extract_body(msg)
- urwid.AttrMap.__init__(self, urwid.Text(bodytxt), 'thread_body')
+ att = settings.get_theming_attribute('thread', 'body')
+ urwid.AttrMap.__init__(self, urwid.Text(bodytxt), att)
class AttachmentWidget(urwid.WidgetWrap):
@@ -658,9 +664,10 @@ class AttachmentWidget(urwid.WidgetWrap):
self.attachment = attachment
if not isinstance(attachment, message.Attachment):
self.attachment = message.Attachment(self.attachment)
+ att = settings.get_theming_attribute('thread', 'attachment')
+ focus_att = settings.get_theming_attribute('thread', 'attachment_focus')
widget = urwid.AttrMap(urwid.Text(self.attachment.__str__()),
- 'thread_attachment',
- 'thread_attachment_focus')
+ att, focus_att)
urwid.WidgetWrap.__init__(self, widget)
def get_attachment(self):
diff --git a/setup.py b/setup.py
index d6e6b4e0..98ee78f6 100755
--- a/setup.py
+++ b/setup.py
@@ -14,6 +14,7 @@ setup(name='alot',
packages=['alot', 'alot.commands'],
package_data={'alot': [
'defaults/alot.rc', # only old-style default values
+ 'defaults/alot.rc.new',
'defaults/alot.rc.spec',
'defaults/notmuch.rc.spec',
'defaults/default.theme', # default theme