mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More QVariant porting
This commit is contained in:
parent
fc2842108c
commit
8518d8f7dc
@ -53,6 +53,7 @@ def detect_qvariant():
|
||||
'src/calibre/gui2/viewer/gestures.py': {'toPoint'},
|
||||
'src/calibre/utils/serve_coffee.py': {'toString()'},
|
||||
'src/calibre/gui2/job_indicator.py': {'toPoint'},
|
||||
'src/calibre/ebooks/pdf/render/engine.py': {'toRect'},
|
||||
}
|
||||
for path in all_py_files():
|
||||
if os.path.basename(path) in {
|
||||
|
@ -302,12 +302,12 @@ class PDFWriter(QObject):
|
||||
mjpath = P(u'viewer/mathjax').replace(os.sep, '/')
|
||||
if iswindows:
|
||||
mjpath = u'/' + mjpath
|
||||
if evaljs('''
|
||||
if bool(evaljs('''
|
||||
window.mathjax.base = %s;
|
||||
mathjax.check_for_math(); mathjax.math_present
|
||||
'''%(json.dumps(mjpath, ensure_ascii=False))).toBool():
|
||||
'''%(json.dumps(mjpath, ensure_ascii=False)))):
|
||||
self.log.debug('Math present, loading MathJax')
|
||||
while not evaljs('mathjax.math_loaded').toBool():
|
||||
while not bool(evaljs('mathjax.math_loaded')):
|
||||
self.loop.processEvents(self.loop.ExcludeUserInputEvents)
|
||||
evaljs('document.getElementById("MathJax_Message").style.display="none";')
|
||||
|
||||
@ -392,11 +392,14 @@ class PDFWriter(QObject):
|
||||
self.painter.save()
|
||||
mf.render(self.painter)
|
||||
self.painter.restore()
|
||||
nsl = evaljs('paged_display.next_screen_location()').toInt()
|
||||
self.doc.end_page()
|
||||
if not nsl[1] or nsl[0] <= 0:
|
||||
try:
|
||||
nsl = int(evaljs('paged_display.next_screen_location()'))
|
||||
except (TypeError, ValueError):
|
||||
break
|
||||
evaljs('window.scrollTo(%d, 0); paged_display.position_header_footer();'%nsl[0])
|
||||
self.doc.end_page()
|
||||
if nsl <= 0:
|
||||
break
|
||||
evaljs('window.scrollTo(%d, 0); paged_display.position_header_footer();'%nsl)
|
||||
if self.doc.errors_occurred:
|
||||
break
|
||||
col += 1
|
||||
|
@ -24,7 +24,7 @@ from calibre.ebooks.oeb.display.webview import load_html
|
||||
|
||||
def get_custom_size(opts):
|
||||
custom_size = None
|
||||
if opts.custom_size != None:
|
||||
if opts.custom_size is not None:
|
||||
width, sep, height = opts.custom_size.partition('x')
|
||||
if height:
|
||||
try:
|
||||
@ -274,9 +274,13 @@ class PDFWriter(QObject): # {{{
|
||||
self.current_page_num += 1
|
||||
self.first_page = False
|
||||
mf.render(self.painter)
|
||||
nsl = evaljs('paged_display.next_screen_location()').toInt()
|
||||
if not nsl[1] or nsl[0] <= 0: break
|
||||
evaljs('window.scrollTo(%d, 0)'%nsl[0])
|
||||
try:
|
||||
nsl = int(evaljs('paged_display.next_screen_location()'))
|
||||
except (TypeError, ValueError):
|
||||
break
|
||||
if nsl <= 0:
|
||||
break
|
||||
evaljs('window.scrollTo(%d, 0)'%nsl)
|
||||
|
||||
self.bridge_value = tuple(self.outline.anchor_map[self.current_item])
|
||||
evaljs('py_bridge.value = book_indexing.anchor_positions(py_bridge.value)')
|
||||
|
Loading…
x
Reference in New Issue
Block a user