diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-02-08 20:54:38 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-02-19 16:00:44 +0100 |
commit | 279b8316341841dd32bdda5a21bb61fed8b9d1ef (patch) | |
tree | d35fd36b6a887351c4c9dd198e337b8148c34423 /alot/db/message.py | |
parent | d25d788bdcf91f4066ae8e80ef7aebe85213d4d3 (diff) |
thread: implement tree decorations
They were temporarily removed in the previous commit.
Still not working:
- theming for the decorations
- drawing the connector line properly for expanded messages
- configurable indentation
Diffstat (limited to 'alot/db/message.py')
-rw-r--r-- | alot/db/message.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/alot/db/message.py b/alot/db/message.py index 62b85788..4adb0816 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -41,6 +41,12 @@ class Message: """A list of replies to this message""" replies = None + """ + This message parent in the list (i.e. the message this message is a reply + to). None when this message is top-level. + """ + parent = None + def __init__(self, dbman, thread, msg, depth): """ :param dbman: db manager that is used for further lookups @@ -248,3 +254,13 @@ class Message: """tests if this messages is in the resultset for `querystring`""" searchfor = '( {} ) AND id:{}'.format(querystring, self.id) return self._dbman.count_messages(searchfor) > 0 + + def parents(self): + """ + A generator iterating over this message's parents up to the topmost + level. + """ + m = self.parent + while m: + yield m + m = m.parent |