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 09-13-2019, 09:26 PM   #31
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
I hope you haven't wasted any time on this yet. I think I may know what's wrong.
jackie_w is offline   Reply With Quote
Old 09-13-2019, 09:42 PM   #32
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: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
In The plugin you have a separate ui.py. All is needs to do is run

Code:
self.gui.job_manager.launch_gui_app('webengine-dialog', {'module':  'calibre_plugins_your_plugin_import_name.main',  'path': path_to_book})
Then in the main.py file have a function named

Code:
def main(path_to_book):
this can run the actual plugin with the webengine based UI
kovidgoyal is offline   Reply With Quote
Old 09-13-2019, 09:43 PM   #33
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by kovidgoyal View Post
@jackie here is a demo plugin that shows you how to run webengine in a separate process. Note that it only works with calibre version >= 3.99.4 which will be released in an hour or so. No need to mess around with calibre-debug anymore.

When its button is clicked it asks for a URL and then opens that in a QwebEngineView
Sorry I've only just seen your new post. Thanks for taking the time to write this

Are you suggesting I do this rather than eschwartz's cli_main() method?

Whatever the answer I will be experimenting with your new demo in case I need a QWebEngineView widget in a future UI plugin.

ETA: Oops! Cross-posted.
jackie_w is offline   Reply With Quote
Old 09-13-2019, 09:46 PM   #34
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: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Feel free to use either, whichever works better for you.
kovidgoyal is offline   Reply With Quote
Old 09-13-2019, 10:02 PM   #35
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by kovidgoyal View Post
Feel free to use either, whichever works better for you.
OK, will do. It's 3am so I'd better get some sleep and come back to it tomorrow.
jackie_w is offline   Reply With Quote
Old 09-14-2019, 01:42 PM   #36
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by kovidgoyal View Post
In The plugin you have a separate ui.py. All is needs to do is run

Code:
self.gui.job_manager.launch_gui_app('webengine-dialog', {'module':  'calibre_plugins_your_plugin_import_name.main',  'path': path_to_book})
Then in the main.py file have a function named

Code:
def main(path_to_book):
this can run the actual plugin with the webengine based UI
It's working, let joy be unconfined! I decided to use a hybrid solution which uses eschwartz's cli method if running standalone and your new 3.99.4 method when running from the calibre GUI.

I'd like to clarify something about the latter.

In the show_dialog called by genesis() I have
Code:
self.gui.job_manager.launch_gui_app('webengine-dialog',
    kwargs={
        'module':'calibre_plugins.scrambleebook_plugin.main',
        'path_to_ebook':path_to_ebook,
        'book_id':book_id,
        'from_calibre':True
        }
    )
and a separate main.py file in the plugin containing only a single function
Code:
def main(path_to_ebook, book_id, from_calibre)
Are the 2 red names constant or can you choose your own. I'm assuming they are constant?
jackie_w is offline   Reply With Quote
Old 09-14-2019, 06:42 PM   #37
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: 43,776
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
webengine-dialog is constant, you can override main, like this:

Code:
self.gui.job_manager.launch_gui_app('webengine-dialog',
    kwargs={
        'module':'calibre_plugins.scrambleebook_plugin.main',
        'func': 'some_name',
        'path_to_ebook':path_to_ebook,
        'book_id':book_id,
        'from_calibre':True
        }
    )

then replace main with some_name
kovidgoyal is offline   Reply With Quote
Old 09-14-2019, 07:00 PM   #38
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Thanks for the info.

Many thanks to both you and eschwartz for your patience nursing me through this
jackie_w is offline   Reply With Quote
Old 09-14-2019, 11:12 PM   #39
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Great, cool!

My rationale for tilting you at the run-plugin method is because you know, when all you have is a hammer, everything looks like a nail. But I like CLI interfaces, and it surely cannot hurt to have one (and it might come in handy for some people). So why not add both methods, indeed...
eschwartz is offline   Reply With Quote
Old 09-14-2019, 11:18 PM   #40
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
BTW I noticed when testing the standalone version of ScrambleEbook, that the gui window for the preview was appearing behind the main ScrambleEbook dialog. This occurred regardless of whether I ran calibre-debug scrambleebook.py, or whether I used my modified plugin with the cli_main method. I believe you need to raise() it.
eschwartz is offline   Reply With Quote
Old 09-15-2019, 08:40 AM   #41
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,171
Karma: 16228536
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by eschwartz View Post
BTW I noticed when testing the standalone version of ScrambleEbook, that the gui window for the preview was appearing behind the main ScrambleEbook dialog. This occurred regardless of whether I ran calibre-debug scrambleebook.py, or whether I used my modified plugin with the cli_main method. I believe you need to raise() it.
I didn't see this at all during testing. Is is a Win vs. Linux thing do you think?

Don't laugh but in my several years of dabbling with this GUI stuff I've never once coded a .raise_(). I noticed it was there in both your cli main.py and Kovid's run-as-extra-process main.py, so obviously I kept them in.

However, both main.py's are for calling the main parent dialog and I think you're talking about the child dialogs activated by a pushbutton. At the moment all of these are currently coded as 2-liners, e.g.
Code:
dlg = EbookScramblePreviewDlg(args)
dlg.exec_()
Are you suggesting this would fix the problem?
Code:
dlg = EbookScramblePreviewDlg(args)
dlg.exec_()
dlg.raise_()
jackie_w 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
calibre-sync: Automatically download books from your Calibre Content Server onto Kobo mishagale Related Tools 14 05-13-2019 05:18 PM
Calibre plus Moon + Reader Pro - How to Make Calibre Library Sync to My Shelf? bookiebabe Related Tools 5 02-09-2017 02:47 AM
Calibre Sync on Android stopped working properly with recent version of Calibre? khahoon Calibre 5 07-06-2013 08:14 AM
How do I import Calibre settings from regular Win Calibre to Calibre Portable? ABW Calibre 9 05-20-2013 02:34 PM
Can not start recoll from calibre /opt/calibre/lib/libz.so.1: no version information Satas Development 5 04-19-2013 11:22 PM


All times are GMT -4. The time now is 01:16 PM.


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