Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 11-22-2015, 06:59 AM   #1
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 4,890
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, 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.
Terisa de morgan is offline   Reply With Quote
Old 11-22-2015, 07:33 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 33,068
Karma: 10034422
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.
kovidgoyal is offline   Reply With Quote
Old 11-22-2015, 07:36 AM   #3
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 4,890
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, 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
Terisa de morgan is offline   Reply With Quote
Old 11-22-2015, 03:12 PM   #4
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,320
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Terisa de morgan View Post
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
@Terisa de morgan - I hope that you're able to develop this
BetterRed is offline   Reply With Quote
Old 11-22-2015, 04:08 PM   #5
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 4,890
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, 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).
Terisa de morgan is offline   Reply With Quote
Old 11-22-2015, 05:50 PM   #6
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 14,737
Karma: 24696650
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE
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.
davidfor is offline   Reply With Quote
Old 11-22-2015, 09:34 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 33,068
Karma: 10034422
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.
kovidgoyal is offline   Reply With Quote
Old 11-23-2015, 03:38 AM   #8
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 4,890
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Yes, @kovid, you're right, and I'm trying to do that.
Terisa de morgan is offline   Reply With Quote
Old 11-23-2015, 04:16 AM   #9
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 4,890
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, 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.
Terisa de morgan is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 07:58 AM.


MobileRead.com is a privately owned, operated and funded community.