diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2019-05-15 13:28:39 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-06-02 15:15:10 +0100 |
commit | 03b652c3b34c0478ed83a5176134a72d29d730cb (patch) | |
tree | 0f7bf516e5710b409b7b848056f70ae905fadbd4 /alot | |
parent | 6a5d37099b2224ecb332cf9e8a00d042bfe72e3d (diff) |
Only create MessageSummary initially
This will prevent the whole message from being read and interpreted
at the time we instantiate a MessageTree for display and instead only
create the (cheap!) summary widget.
When a user manually interacts with the Message widgets (for example by
unfolding/toggling source) then the content parts will anyway be
reassembled. The consequence of this patch is that loading large threads
should be much faster.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/widgets/thread.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py index bef80b45..20ed5ee2 100644 --- a/alot/widgets/thread.py +++ b/alot/widgets/thread.py @@ -169,7 +169,7 @@ class MessageTree(CollapsibleTree): self._default_headers_tree = None self.display_attachments = True self._attachments = None - self._maintree = SimpleTree(self._assemble_structure()) + self._maintree = SimpleTree(self._assemble_structure(True)) CollapsibleTree.__init__(self, self._maintree) def get_message(self): @@ -191,7 +191,10 @@ class MessageTree(CollapsibleTree): logging.debug('DHT %s', str(self._default_headers_tree)) logging.debug('MAINTREE %s', str(self._maintree._treelist)) - def _assemble_structure(self): + def _assemble_structure(self, summary_only=False): + if summary_only: + return [(self._get_summary(), None)] + mainstruct = [] if self.display_source: mainstruct.append((self._get_source(), None)) |