diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-27 12:37:13 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-27 12:37:13 +0000 |
commit | 8bbc45b1137aa5206cee825a39cc3d2ca5895e13 (patch) | |
tree | 5ed9b35f8e09a30908b1f97fa12f2ba001683792 /alot/buffers.py | |
parent | 0ad44b46bc86258973fb16eeb21cbf89d37edb38 (diff) |
ThreadBuffer rebuilds to SolidFill if thread nonexistant
ThreadBuffer will display as urwid.SolidFill if the
displayed thread seized to exist. This could happen
for example if the last message of that thread has been
removed.
Diffstat (limited to 'alot/buffers.py')
-rw-r--r-- | alot/buffers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/alot/buffers.py b/alot/buffers.py index f3ed1eaf..a9ab8e41 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -6,6 +6,7 @@ import settings import commands from walker import PipeWalker from helper import shorten_author_string +from db import NonexistantObjectError class Buffer(object): @@ -228,7 +229,12 @@ class ThreadBuffer(Buffer): self._build_pile(acc, reply, msg, depth + 1) def rebuild(self): - self.thread.refresh() + try: + self.thread.refresh() + except NonexistantObjectError: + self.body = urwid.SolidFill() + self.message_count = 0 + return # depth-first traversing the thread-tree, thereby # 1) build a list of tuples (parentmsg, depth, message) in DF order # 2) create a dict that counts no. of direct replies per message @@ -255,7 +261,9 @@ class ThreadBuffer(Buffer): depth=depth, bars_at=bars) msglines.append(mwidget) + self.body = urwid.ListBox(msglines) + self.message_count = self.thread.get_total_messages() def get_selection(self): """returns focussed :class:`~alot.widgets.MessageWidget`""" |