summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-07-16 22:18:33 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-07-16 22:18:33 +0100
commitc80a0d3c3bee504c611b563e87987cabc509489c (patch)
tree82864d2d06ab1eac6ce4374f0a64e02b496f0508
parent882705ba0173a1dca453130c0355be6481f27b6a (diff)
remove 'hidden' tag representation option
this makes hiding tags possible simply by making their 'translated' value the empty string. Note that this still sets the TagWidget.hidden property because those may not be displayed with width 0 (as any other widget) because it'd break urwid.
-rw-r--r--alot/buffers.py2
-rw-r--r--alot/settings/__init__.py11
-rw-r--r--alot/widgets.py2
3 files changed, 6 insertions, 9 deletions
diff --git a/alot/buffers.py b/alot/buffers.py
index 45c09df8..866e1491 100644
--- a/alot/buffers.py
+++ b/alot/buffers.py
@@ -395,7 +395,7 @@ class TagListBuffer(Buffer):
tw = widgets.TagWidget(b, attr, focus_att)
rows = [('fixed', tw.width(), tw)]
if tw.hidden:
- rows.append(urwid.Text('[hidden]'))
+ rows.append(urwid.Text(b + ' [hidden]'))
elif tw.translated is not b:
rows.append(urwid.Text('(%s)' % b))
line = urwid.Columns(rows, dividechars=1)
diff --git a/alot/settings/__init__.py b/alot/settings/__init__.py
index 60cf5c50..faae8904 100644
--- a/alot/settings/__init__.py
+++ b/alot/settings/__init__.py
@@ -261,7 +261,6 @@ class SettingsManager(object):
:normal: to :class:`urwid.AttrSpec` used if unfocussed
:focussed: to :class:`urwid.AttrSpec` used if focussed
:translated: to an alternative string representation
- :hidden: to a boolean
"""
colourmode = int(self._config.get('colourmode'))
theme = self._theme
@@ -306,9 +305,9 @@ class SettingsManager(object):
focus = resolve_att(colourpick(cfg['tags'][sec]['focus']),
fallback_focus)
- hidden = cfg['tags'][sec]['hidden'] or False
-
- translated = cfg['tags'][sec]['translated'] or tag
+ translated = cfg['tags'][sec]['translated']
+ if translated is None:
+ translated = tag
translation = cfg['tags'][sec]['translation']
if translation:
translated = re.sub(translation[0], translation[1], tag)
@@ -316,11 +315,9 @@ class SettingsManager(object):
else:
normal = fallback_normal
focus = fallback_focus
- hidden = False
translated = tag
- return {'normal': normal, 'focussed': focus,
- 'hidden': hidden, 'translated': translated}
+ return {'normal': normal, 'focussed': focus, 'translated': translated}
def get_hook(self, key):
"""return hook (`callable`) identified by `key`"""
diff --git a/alot/widgets.py b/alot/widgets.py
index b3223ad8..278d31e4 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -293,8 +293,8 @@ class TagWidget(urwid.AttrMap):
representation = settings.get_tagstring_representation(tag,
fallback_normal,
fallback_focus)
- self.hidden = representation['hidden']
self.translated = representation['translated']
+ self.hidden = self.translated == ''
self.txt = urwid.Text(self.translated, wrap='clip')
normal_att = representation['normal']
focus_att = representation['focussed']