From ee04420a2e030cb4b5ac58471bed56ecc69d5ceb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Jun 2011 08:22:52 -0600 Subject: [PATCH] ... --- src/calibre/gui2/device.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index ab02a183c6..9f71c3088d 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -38,6 +38,10 @@ class DeviceJob(BaseJob): # {{{ BaseJob.__init__(self, description) self.func = func self.callback_on_done = done + if not isinstance(self.callback_on_done, (Dispatcher, + FunctionDispatcher)): + self.callback_on_done = FunctionDispatcher(self.callback_on_done) + self.args, self.kwargs = args, kwargs self.exception = None self.job_manager = job_manager @@ -259,7 +263,8 @@ class DeviceManager(Thread): # {{{ job = self.next() if job is not None: self.current_job = job - self.device.set_progress_reporter(job.report_progress) + if self.device is not None: + self.device.set_progress_reporter(job.report_progress) self.current_job.run() self.current_job = None else: