diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2019-05-25 12:36:17 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-06-03 15:33:11 +0100 |
commit | 544d035444252e532e39209d127f8c889b752adb (patch) | |
tree | 0ca942c0344678d6ae7dd8ccf361a14d62f9fa34 | |
parent | 8e0b2ff69268ef0bb1700ee5512048c7325fd9ed (diff) |
explicit expand method in MessageTrees
to make sure that all parts exist when messages are expanded
(see pydoc string)
-rw-r--r-- | alot/widgets/thread.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index 20ed5ee2..ce35b480 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -191,6 +191,19 @@ class MessageTree(CollapsibleTree): logging.debug('DHT %s', str(self._default_headers_tree)) logging.debug('MAINTREE %s', str(self._maintree._treelist)) + def expand(self, pos): + """ + overload CollapsibleTree.expand method to ensure all parts are present. + Initially, only the summary widget is created to avoid reading the + messafe file and thus speed up the creation of this object. Once we + expand = unfold the message, we need to make sure that body/attachments + exist. + """ + logging.debug("MT expand") + if not self._bodytree: + self.reassemble() + CollapsibleTree.expand(self, pos) + def _assemble_structure(self, summary_only=False): if summary_only: return [(self._get_summary(), None)] |