11-26-2013, 04:16 AM | #1 |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Running job on library change
For my Kobo Utilities plugin, I am adding an option to run a job when the device is connected. This will fetch the reading status of the books from the device and populate some custom columns. I have this working, but I realised it also needs to be run after changing to a new library.
Looking through the code of other plugins, the only thing I could find was library_changed. At first look, this seemed to be what I wanted. But, it gets called before the ondevice status has been updated for the new library. I am using this to decide which books need to have the reading status retrieved from the device. Have I missed something? Is there another signal or call a bit later that I can use? Or, can I get the list I need from within the job? The last time I looked at this, I couldn't, but that was before the new database engine. |
11-26-2013, 05:17 AM | #2 |
creator of calibre
Posts: 43,869
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
library_change is the only callback for changing libraries.
IIRC the on device column is populated in the GUI thread on library change, there for you should just be able to do this: Code:
def library_changed(self): QTimer.singleShot(0, self.do_work) def do_work(self): # the on device column should be populated here. |
Advert | |
|
11-26-2013, 06:26 AM | #3 |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
That works. Thanks.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't change library folder | Matsendrasana | Library Management | 19 | 11-21-2012 05:00 AM |
Change in removing library | Halo | Development | 13 | 07-09-2011 03:04 PM |
Sony Reader Library running, but Library doesn't show on screen | wyldmint | Sony Reader | 0 | 08-29-2010 01:59 AM |
Keep a beloved but low-paying job, or take a higher-paying job I might not love? | ficbot | Lounge | 26 | 07-18-2010 04:48 AM |
Change library path? | Slite | Calibre | 2 | 09-30-2008 10:52 AM |