diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-02-06 17:08:00 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-02-06 17:11:05 +0100 |
commit | 48dac1d9089ce2a36c55dc4768b24293d1257a37 (patch) | |
tree | cf4e0c5751da8e7689269ea88b180b4dee3c3002 /alot/widgets | |
parent | 72ed7d40ac68d7e91f41e94fbcf6cb7a3e28433a (diff) |
db: rewrite the API for representing message trees
It should be cleaner and easier to use, and eventually replace the
custom tree walker in the thread display buffer.
Diffstat (limited to 'alot/widgets')
-rw-r--r-- | alot/widgets/search.py | 2 | ||||
-rw-r--r-- | alot/widgets/thread.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/alot/widgets/search.py b/alot/widgets/search.py index a4d22e82..4e612e8c 100644 --- a/alot/widgets/search.py +++ b/alot/widgets/search.py @@ -182,7 +182,7 @@ def prepare_subject_string(thread): def prepare_content_string(thread): - msgs = sorted(thread.get_messages().keys(), + msgs = sorted(thread.messages.values(), key=lambda msg: msg.date, reverse=True) lastcontent = ' '.join(m.get_body_text() for m in msgs) lastcontent = lastcontent.replace('^>.*$', '') diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index 47034bfe..97a34417 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -332,7 +332,7 @@ class ThreadTree(Tree): """ def __init__(self, thread): self._thread = thread - self.root = thread.get_toplevel_messages()[0].id + self.root = thread.toplevel_messages[0].id self._parent_of = {} self._first_child_of = {} self._last_child_of = {} @@ -347,7 +347,7 @@ class ThreadTree(Tree): odd = not odd last = None self._first_child_of[mid] = None - for reply in thread.get_replies_to(msg): + for reply in msg.replies: rid = reply.id if self._first_child_of[mid] is None: self._first_child_of[mid] = rid @@ -360,7 +360,7 @@ class ThreadTree(Tree): return odd last = None - for msg in thread.get_toplevel_messages(): + for msg in thread.toplevel_messages: mid = msg.id self._prev_sibling_of[mid] = last self._next_sibling_of[last] = mid |