diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-11-10 08:51:19 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-11-10 08:51:19 +0000 |
commit | 317797552f9fee1ef47c8c6cdb649aa6e323323c (patch) | |
tree | c803b02a30d2aa7b917ddd847133430ce44678bf /alot/buffers.py | |
parent | b4f33e21ee09cd8673cc64114713d8507554b634 (diff) |
process termination part 1
Diffstat (limited to 'alot/buffers.py')
-rw-r--r-- | alot/buffers.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/alot/buffers.py b/alot/buffers.py index 8db5e44d..c3352289 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -19,8 +19,6 @@ Copyright (C) 2011 Patrick Totzke <patricktotzke@gmail.com> import urwid from notmuch.globals import NotmuchError -import multiprocessing - import widgets import settings import commands @@ -152,6 +150,7 @@ class SearchBuffer(Buffer): self.querystring = initialquery self.result_count = 0 self.isinitialized = False + self.proc = None # process that fills our pipe self.rebuild() Buffer.__init__(self, ui, self.body, 'search') @@ -166,14 +165,19 @@ class SearchBuffer(Buffer): #focusposition = 0 self.isinitialized = True + if self.proc: + if self.proc.is_alive(): + self.proc.terminate() + self.result_count = self.dbman.count_messages(self.querystring) try: - self.pipe = self.dbman.get_threads(self.querystring) + self.pipe, self.proc = self.dbman.get_threads(self.querystring) except NotmuchError: #TODO: this never happens for malformed queries self.ui.notify('malformed query string: %s' % self.querystring, 'error') - self.pipe = multiprocessing.Pipe(False) - self.pipe.put(None) + self.listbox = urwid.ListBox(self.threadlist) + self.body = self.listbox + return self.threadlist = PipeWalker(self.pipe, widgets.ThreadlineWidget, dbman=self.dbman) |