View Single Post
Old 09-09-2019, 11:28 PM   #3
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,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by kovidgoyal View Post
@jackie_w: That is because webengine is not useable in the main calibre program only the editor/viewer. This is because it is very resource intensive and Qt requires that it be imported before starting the appication. Since the main GUI does not use it, I do not import it, which also means it cant be imported in any plugins. What does scrambleebook use it for? There are two possible workarounds, it is is not something that requires sophisticated HTML support then QTextBrowser can be used, otherwise you have to run it in a separate process.
I don't know what counts as 'sophisticated'. Doesn't sound much like me.

It's a utility to preview a page from an original container object alongside the same page from the scrambled container object, so that a user can confirm nothing is readily identifiable before posting to MR. See the 2nd screenshot at the bottom of this post.

Cols 1 & 3 (beige), were originally QWebView widgets displaying pre- & post-scramble versions of the container name user-highlighted in col 2 (white). The webview widgets are styled using the container CSS file(s) referenced in the page <head> <link>s.

I think these would be the relevant bits of code:
Code:
from calibre.ebooks.oeb.display.webview import load_html

    def webview_refresh(self, name):
        name_orig = self.revfmap.get(name, name)
        abspath_orig = self.orig.name_to_abspath(name_orig)
        abspath = self.ebook.name_to_abspath(name)
        
        load_html(abspath, self.webview_scram)
        load_html(abspath_orig, self.webview_orig)
I suspect my ability to give them a beige background (so that it's more obvious where images start/end) will also be lost as I was using the webview.settings().setUserStyleSheetUrl() technique you used in the old calibre Viewer prefs. Even if I had access to QWebEngineView it doesn't seem to have a setUserStyleSheetUrl option.
jackie_w is offline   Reply With Quote