More PyQt nonsense

Some more enums that werent previous migrated
This commit is contained in:
Kovid Goyal 2021-11-21 17:21:50 +05:30
parent 8eb7706b8a
commit 22bc316836
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 11 deletions

View File

@ -17,7 +17,7 @@ from qt.core import (
QApplication, QMarginsF, QObject, QPageLayout, Qt, QTimer, QUrl, pyqtSignal, sip
)
from qt.webengine import (
QWebEnginePage, QWebEngineProfile, QWebEngineUrlRequestInterceptor
QWebEnginePage, QWebEngineProfile, QWebEngineUrlRequestInterceptor, QWebEngineSettings
)
from calibre import detect_ncpus, human_readable, prepare_string_for_xml
@ -150,24 +150,24 @@ class Renderer(QWebEnginePage):
self.settle_time = 0
self.wait_for_title = None
s = self.settings()
s.setAttribute(s.JavascriptEnabled, True)
s.setFontSize(s.DefaultFontSize, int(opts.pdf_default_font_size))
s.setFontSize(s.DefaultFixedFontSize, int(opts.pdf_mono_font_size))
s.setFontSize(s.MinimumLogicalFontSize, 8)
s.setFontSize(s.MinimumFontSize, 8)
s.setAttribute(QWebEngineSettings.WebAttribute.JavascriptEnabled, True)
s.setFontSize(QWebEngineSettings.FontSize.DefaultFontSize, int(opts.pdf_default_font_size))
s.setFontSize(QWebEngineSettings.FontSize.DefaultFixedFontSize, int(opts.pdf_mono_font_size))
s.setFontSize(QWebEngineSettings.FontSize.MinimumLogicalFontSize, 8)
s.setFontSize(QWebEngineSettings.FontSize.MinimumFontSize, 8)
std = {
'serif': opts.pdf_serif_family,
'sans' : opts.pdf_sans_family,
'mono' : opts.pdf_mono_family
}.get(opts.pdf_standard_font, opts.pdf_serif_family)
if std:
s.setFontFamily(s.StandardFont, std)
s.setFontFamily(QWebEngineSettings.FontFamily.StandardFont, std)
if opts.pdf_serif_family:
s.setFontFamily(s.SerifFont, opts.pdf_serif_family)
s.setFontFamily(QWebEngineSettings.FontFamily.SerifFont, opts.pdf_serif_family)
if opts.pdf_sans_family:
s.setFontFamily(s.SansSerifFont, opts.pdf_sans_family)
s.setFontFamily(QWebEngineSettings.FontFamily.SansSerifFont, opts.pdf_sans_family)
if opts.pdf_mono_family:
s.setFontFamily(s.FixedFont, opts.pdf_mono_family)
s.setFontFamily(QWebEngineSettings.FontFamily.FixedFont, opts.pdf_mono_family)
self.titleChanged.connect(self.title_changed)
self.loadStarted.connect(self.load_started)

View File

@ -73,7 +73,7 @@ def get_page_size(opts, for_comic=False):
if opts.custom_size is not None:
page_size = parse_pdf_page_size(opts.custom_size, opts.unit, opts.output_profile.dpi)
if page_size is None:
page_size = QPageSize(getattr(QPageSize, opts.paper_size.capitalize()))
page_size = QPageSize(getattr(QPageSize.PageSizeId, opts.paper_size.capitalize()))
return page_size