11-22-2015, 06:59 AM | #1 |
Grand Sorcerer
Posts: 6,227
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Question about a plugin to finish
Hi,
I'm trying to make a plugin for automating some usual tasks I do when I process ebooks. I want to perform a task after the Count pages plugin finishes, and I launch the plugin inside my own plugin. My problem comes when I want to wait till the plugin finishes. As I launch it with load_actual_plugin, if I call to job_manager.has_jobs () no job is found. I try to sleep some time and check if the page column is fulfilled. This works only if I launch an auxiliary dialog, which does nothing, but Iif I don't launch that dialog I have a never ending loop, as it looks like the field is never updated (and no indication of job is included at the GUI). I can live with the auxiliary dialog, but I would like to know is there is a better method (yes, it's a rudimentary way buy I don't have a lot of knowledge of calibre this is my best approach). Thank you very much in advance. |
11-22-2015, 07:33 AM | #2 |
creator of calibre
Posts: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Dont use load actual plugin. Get a reference to another plugin via
self.gui.iactions which is where calibre stores plugins after loading them. As for waiting for the plugin job to finish it depends on the plugin and how it runs jobs. Note that simply loading the plugin will not run a job. You will need to call some thod in the plugin that actually does something. |
Advert | |
|
11-22-2015, 07:36 AM | #3 |
Grand Sorcerer
Posts: 6,227
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Thank you, I'll try this, and about creating job.. I'll have to see what has to be done, but I'm calling the method which is provided to invoke it from other plugins.
Thank you again. I'll update the thread if I'm able to do it... or not, and I need more help Last edited by Terisa de morgan; 11-22-2015 at 07:43 AM. Reason: Adding info |
11-22-2015, 03:12 PM | #4 | |
null operator (he/him)
Posts: 20,550
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
|
|
11-22-2015, 04:08 PM | #5 |
Grand Sorcerer
Posts: 6,227
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Thank you @BetterRed, I already know which the problem is, at least, (the job doesn't begin till my plugin gives control). Now I have to see if I'm able to find a solution (back to my plugin till the other job has finished).
|
Advert | |
|
11-22-2015, 05:50 PM | #6 |
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
|
My first thought was that you could start another job that prompts for attention. That way the count would run and then the job in your plugin would pop up. But, that will only work if the user has calibre set to run only one job at a time. I'm also not sure if the job will have all the context you need.
|
11-22-2015, 09:34 PM | #7 |
creator of calibre
Posts: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The right way to do this is to modify the count pages plugin to allow setting callbacks when the job is completed. So the function that launches a job in that plugin should be modified to take another function as a parameter, that will be called when the job is completed.
|
11-23-2015, 03:38 AM | #8 |
Grand Sorcerer
Posts: 6,227
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Yes, @kovid, you're right, and I'm trying to do that.
|
11-23-2015, 04:16 AM | #9 |
Grand Sorcerer
Posts: 6,227
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Ditto, thank you very much, a minor change at the Count Pages plugin and some changes at my plugin to update the database.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Editor plugin question | DiapDealer | Development | 2 | 07-28-2014 10:23 PM |
Calibre plugin question | Firestorm1 | Plugins | 3 | 12-20-2013 11:30 AM |
Another plugin dev question | DiapDealer | Plugins | 2 | 12-11-2010 01:46 PM |
Plugin Developer Question | KevinH | Plugins | 3 | 10-23-2010 08:17 PM |