summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-02-18 21:25:38 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2012-02-18 21:25:38 +0000
commit6ab5e6f77e99b7f713f5e02f22c4f77541fb239d (patch)
treeafe73d070be2719a19e17f7d91ec3afe0c67ac57
parentd841321bdc4607fcb7e2d73bb3f6ebbbf1eba9cb (diff)
use SettingsManager for tagwidget representation
-rw-r--r--alot/settings.py2
-rw-r--r--alot/widgets.py21
2 files changed, 8 insertions, 15 deletions
diff --git a/alot/settings.py b/alot/settings.py
index ef8b21e2..ada780da 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -133,7 +133,7 @@ class SettingsManager(object):
else:
normal = default_att
focussed = default_focus_att
- translated = None
+ translated = tag
return {'normal': normal, 'focussed': focussed, 'translated': translated}
diff --git a/alot/widgets.py b/alot/widgets.py
index 55065100..7c0d3e06 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -248,13 +248,12 @@ class TagWidget(urwid.AttrMap):
def __init__(self, tag, theme=''):
self.tag = tag
self.highlight = theme
- # TODO: replace
- self.translated = config.get('tag-translate', tag, fallback=tag)
+ representation = settings.get_tagstring_representation(tag)
+ self.translated = representation['translated']
self.txt = urwid.Text(self.translated.encode('utf-8'), wrap='clip')
- # TODO: replace
- normal = config.get_tag_theme(tag, highlight=theme)
- focus = config.get_tag_theme(tag, focus=True, highlight=theme)
- urwid.AttrMap.__init__(self, self.txt, normal, focus)
+ self.normal_att = representation['normal']
+ self.focus_att = representation['focussed']
+ urwid.AttrMap.__init__(self, self.txt, self.normal_att, self.focus_att)
def width(self):
# evil voodoo hotfix for double width chars that may
@@ -271,16 +270,10 @@ class TagWidget(urwid.AttrMap):
return self.tag
def set_focussed(self):
- # TODO: replace
- self.set_attr_map({None: config.get_tag_theme(
- self.tag, focus=True,
- highlight=self.highlight)})
+ self.set_attr_map({None: self.focus_att})
def set_unfocussed(self):
- # TODO: replace
- self.set_attr_map({None: config.get_tag_theme(
- self.tag,
- highlight=self.highlight)})
+ self.set_attr_map({None: self.normal_att})
class ChoiceWidget(urwid.Text):