![]() |
#16 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,770
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Well that would have been nice to know!
So do you use the QWebChannel.js or do you serialize and send back and forth across a pipe, or yourself? I will take a peek to try to understand your approach. That said, I really am not a javascript programmer (what I know about javascript you could put in a thimble) but luckily I have been able to adapt the javascript used in Sigil to get effectively a cfi (webpath) to synchronize scrolling between our CodeView and Preview. Take care, KevinH Quote:
|
|
![]() |
![]() |
![]() |
#17 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,364
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
web channel did not work for me because the browser has multiple web pages and it is not easy to know which page which channel belongs to, so I used a rather glorious hack
![]() And yeah JS is a pain, I ended up writing my own python like language that compiles to JS to make working with it tolerable. Th entire calibre content server and all the webengine code are written in it. https://github.com/kovidgoyal/rapydscript-ng |
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,770
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Gotta love that hack!
So to go from python to javascript you use pyqt5 to invoke runjavascript to send a json object to your own javascript routine preloaded in the page. Then to go the other way, javascript just changes the document title to add a message and a Qt signal titleChanged() is fired automatically which tells the python side to run a javascript to get the result from the document title tag resetting it back to normal. And since the document title is for informational purposes and not actually shown, everything just works! And this can work for any number of different webpages each with its own document title. Absolutely wonderful! No pipes, no shared memory, no extra signals, no QWebChannel, just a little extra javascript to read and manipulate the document title. Qt should pay you for this idea and then create an extra signal tied to an always *non-displayed* tag such as a qt:message tag stored in head or even a standard comment tag in head. Nicely done! |
![]() |
![]() |
![]() |
#19 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,364
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
thanks
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Style Sheet entry for a 'hanging' style | AThirstyMind | Kindle Formats | 6 | 12-10-2016 12:28 AM |
Search not filtering? | VelvetElvis | Library Management | 5 | 05-30-2014 05:12 AM |
Possible calibre filtering? | Glenndk | Calibre | 0 | 07-31-2010 01:34 PM |
Mobi TOC style vs ePub style? | phearlez | Kindle Formats | 3 | 04-11-2010 06:35 AM |
0.6.4 and filtering by tags | itimpi | Calibre | 3 | 08-01-2009 01:43 PM |