diff options
author | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-10-12 18:01:48 (GMT) |
---|---|---|
committer | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-10-12 18:01:48 (GMT) |
commit | 687a3f79285868fc35e290196436b9c4ca1f842c (patch) | |
tree | 0f93afb99ff62d74e2aebe6107a202ac525d1ae9 /opds.py | |
parent | 831c52acea4ecd848b84e7ef62e8e98a02ca5483 (diff) |
Fix problems with threading which was causing downloads to choke
Diffstat (limited to 'opds.py')
-rw-r--r-- | opds.py | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -20,13 +20,14 @@ import feedparser import threading -import gobject, gtk +import gobject _FEEDBOOKS_URI = 'http://feedbooks.com/books/search.atom?query=' _INTERNETARCHIVE_URI = 'http://bookserver.archive.org/catalog/opensearch?q=' _REL_OPDS_ACQUISTION = u'http://opds-spec.org/acquisition' +gobject.threads_init() class DownloadThread(threading.Thread): def __init__(self, obj): @@ -36,11 +37,9 @@ class DownloadThread(threading.Thread): def _download(self): feedobj = feedparser.parse(self.obj._uri + self.obj._queryterm.replace(' ', '+')) - self.obj._feedobj = feedobj - gtk.gdk.threads_enter() + self.obj._feedobj = feedobj self.obj.emit('completed') - gtk.gdk.threads_leave() return False @@ -119,7 +118,7 @@ class QueryResult(gobject.GObject): def cancel(self): ''' Cancels the query job - ''' + ''' for d_thread in self.threads: d_thread.stop() |