diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-05-24 13:14:33 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-05-24 14:01:09 +0200 |
commit | c8f3d99eab089d337e5fdcb8ff39efd6ab1aa5e9 (patch) | |
tree | f5e269b6d85d078e0ad43cfde1c36a56ecca0b0e /alot/buffers | |
parent | b1f6be9d1808406c94c5c033b50abb5f7517e82b (diff) |
Consistently use set/frozenset for tags.
Diffstat (limited to 'alot/buffers')
-rw-r--r-- | alot/buffers/taglist.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/alot/buffers/taglist.py b/alot/buffers/taglist.py index bb344c45..e8c8df33 100644 --- a/alot/buffers/taglist.py +++ b/alot/buffers/taglist.py @@ -13,8 +13,10 @@ class TagListBuffer(Buffer): modename = 'taglist' - def __init__(self, alltags=None): - self.tags = alltags or [] + _tags = None + + def __init__(self, tags): + self._tags = sorted(tags, key = str.lower) self.isinitialized = False self.rebuild() @@ -28,9 +30,7 @@ class TagListBuffer(Buffer): self.isinitialized = True lines = list() - displayedtags = sorted((t for t in self.tags if t), - key=str.lower) - for (num, b) in enumerate(displayedtags): + for (num, b) in enumerate(self._tags): if (num % 2) == 0: attr = settings.get_theming_attribute('taglist', 'line_even') else: @@ -50,7 +50,7 @@ class TagListBuffer(Buffer): self.taglist = urwid.ListBox(urwid.SimpleListWalker(lines)) self.body = self.taglist - self.taglist.set_focus(focusposition % len(displayedtags)) + self.taglist.set_focus(focusposition % len(self._tags)) def focus_first(self): """Focus the first line in the tag list.""" |