diff options
author | dtk <dtk@gmx.de> | 2011-12-25 18:24:51 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-27 01:53:46 +0000 |
commit | 696d7748cc485bf34d11153531cd253c5ce51e27 (patch) | |
tree | 9ee0c14f8a9296c4cd9db2e0cdf378ec9e51a1bc /alot | |
parent | 9ac20b3589849c0286998a37807432b21418687b (diff) |
Enable themeing of authors string of unread mails
So far only the subject of unread mails could be themed individually. This
commit adds the ability to additionally theme the authors individually.
This is configured by specifying a highlighting level, where 1 corresponds to
the known themeing of the subject and 2 adds themed authors.
Cf issue #25.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/defaults/alot.rc | 10 | ||||
-rw-r--r-- | alot/widgets.py | 17 |
2 files changed, 21 insertions, 6 deletions
diff --git a/alot/defaults/alot.rc b/alot/defaults/alot.rc index e2833b0c..6c376888 100644 --- a/alot/defaults/alot.rc +++ b/alot/defaults/alot.rc @@ -26,8 +26,10 @@ display_content_in_threadline = False # headers that get displayed by default displayed_headers = From,To,Cc,Bcc,Subject -# highlight unread mails in search buffer by theming their subjects differently -highlight_unread_mails = True +# highlight unread mails in search buffer according to the specified level: +# 1: by theming their subjects +# 2: by additionally theming their authors +highlight_unread_mails = 1 # headers that are hidden in envelope buffers by default envelope_headers_blacklist = In-Reply-To,References @@ -215,8 +217,12 @@ bufferlist_results_odd_bg = default bufferlist_results_odd_fg = default search_thread_authors_bg = default search_thread_authors_fg = #6d6 +search_thread_authors_unread_bg = default +search_thread_authors_unread_fg = #6d6,bold search_thread_authors_focus_bg = #68a search_thread_authors_focus_fg = #8f6 +search_thread_authors_focus_unread_bg = #68a +search_thread_authors_focus_unread_fg = #8f6,bold search_thread_bg = default search_thread_content_bg = default search_thread_content_fg = #866 diff --git a/alot/widgets.py b/alot/widgets.py index ce96a03b..b3605cd9 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -123,7 +123,7 @@ class ThreadlineWidget(urwid.AttrMap): maxlength = config.getint('general', 'authors_maxlength') authorsstring = shorten_author_string(authors, maxlength) self.authors_w = urwid.AttrMap(urwid.Text(authorsstring), - 'search_thread_authors') + self.__get_authors_theme()) cols.append(('fixed', len(authorsstring), self.authors_w)) if self.thread: @@ -158,7 +158,7 @@ class ThreadlineWidget(urwid.AttrMap): 'search_thread_mailcount_focus'}) for tw in self.tag_widgets: tw.set_focussed() - self.authors_w.set_attr_map({None: 'search_thread_authors_focus'}) + self.authors_w.set_attr_map({None: self.__get_authors_theme(focus)}) self.subject_w.set_attr_map({None: self.__get_subject_theme(focus)}) if self.display_content: self.content_w.set_attr_map( @@ -168,7 +168,7 @@ class ThreadlineWidget(urwid.AttrMap): self.mailcount_w.set_attr_map({None: 'search_thread_mailcount'}) for tw in self.tag_widgets: tw.set_unfocussed() - self.authors_w.set_attr_map({None: 'search_thread_authors'}) + self.authors_w.set_attr_map({None: self.__get_authors_theme()}) self.subject_w.set_attr_map({None: self.__get_subject_theme()}) if self.display_content: self.content_w.set_attr_map({None: 'search_thread_content'}) @@ -188,7 +188,16 @@ class ThreadlineWidget(urwid.AttrMap): if focus: theme += '_focus' if self.thread.has_tag('unread') and \ - config.getboolean('general', 'highlight_unread_mails'): + (config.getint('general', 'highlight_unread_mails') >= 1): + theme += '_unread' + return theme + + def __get_authors_theme(self, focus=False): + theme = 'search_thread_authors' + if focus: + theme += '_focus' + if self.thread.has_tag('unread') and \ + (config.getint('general', 'highlight_unread_mails') >= 2): theme += '_unread' return theme |