View Single Post
Old 06-12-2011, 07:15 AM   #57
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Ok - the good news is this seems to fix the serialization of sending books to the device.

I can use Reading List to send new books to the Kindle, and I can now see that these books are listed as on_device in calibre when Create runs. Send Metadata runs after Create (it seems to get queued at the end of sync_to_device, but clearly the on_device status doesn't depend on send metadata which is good).

Thank you for all the investigation/updates to get this to work!

But now I think I have a bit of work to do on my code this week...

One problem is that I am displaying a dialog in my job_completed function that is causing calibre to crash. The issue is that within the job I instantiate a class (for messages) using the gui passed into the job - and I return that instantiated class and try to call its display method. calibre promptly warns me about pixmaps in a non-gui thread, missing parents, etc. and dies. So I need to re-arrange this code to only return the message strings to the job's parent and use the gui in the job's parent to present the dialog. Ah, if I had only coded it properly to begin with (Interesting that this didn't fall over with 0.8.5, just with the modified source)

Another problem, which I'm not sure if its mine or not, is that I if I run my plugin while the Kindle is not connected, I get:

Code:
Traceback (most recent call last):
  File "threading.py", line 530, in __bootstrap_inner
  File "/home/meme/Calibre-Source/calibre/src/calibre/gui2/device.py", line 262, in run
    self.device.set_progress_reporter(job.report_progress)
AttributeError: 'NoneType' object has no attribute 'set_progress_reporter'
I believe this is because I only check if the device is connected and the book details are loaded from within the job that's called. In other words, I don't check that the device is connected before I kick off a device create_job. Unfortunately even if I then connect the Kindle, my plugin's job stays waiting forever in the queue - and calibre doesn't seem to think there is a device connected anymore (no device connected message in the status bar, no Sync Now in Reading list, etc.)

I guess I can add a check to see if the device is connected before I kick off the job - but it seems to me it should be okay to do this and the job should queue until the device is connected? This behaviour is the same in 0.8.5.
meme is offline   Reply With Quote