本文整理汇总了Python中PyQt5.QtWebKitWidgets.QWebPage.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QWebPage.__init__方法的具体用法?Python QWebPage.__init__怎么用?Python QWebPage.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebKitWidgets.QWebPage
的用法示例。
在下文中一共展示了QWebPage.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, opts, log):
from calibre.gui2 import secure_web_page
self.log = log
QWebPage.__init__(self)
settings = self.settings()
secure_web_page(settings)
settings.setFontSize(QWebSettings.DefaultFontSize,
opts.pdf_default_font_size)
settings.setFontSize(QWebSettings.DefaultFixedFontSize,
opts.pdf_mono_font_size)
settings.setFontSize(QWebSettings.MinimumLogicalFontSize, 8)
settings.setFontSize(QWebSettings.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:
settings.setFontFamily(QWebSettings.StandardFont, std)
if opts.pdf_serif_family:
settings.setFontFamily(QWebSettings.SerifFont, opts.pdf_serif_family)
if opts.pdf_sans_family:
settings.setFontFamily(QWebSettings.SansSerifFont,
opts.pdf_sans_family)
if opts.pdf_mono_family:
settings.setFontFamily(QWebSettings.FixedFont, opts.pdf_mono_family)
示例2: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, log):
self.log = log
QWebPage.__init__(self)
self.js = None
self.evaljs = self.mainFrame().evaluateJavaScript
self.bridge_value = None
nam = self.networkAccessManager()
nam.setNetworkAccessible(nam.NotAccessible)
self.longjs_counter = 0
示例3: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self):
self.log = default_log
QWebPage.__init__(self)
self.js = None
self.evaljs = self.mainFrame().evaluateJavaScript
self.bridge_value = None
nam = self.networkAccessManager()
nam.setNetworkAccessible(nam.NotAccessible)
self.setLinkDelegationPolicy(self.DelegateAllLinks)
示例4: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, parent):
QWebPage.__init__(self, parent)
self.js_loader = None
self._footnote_data = ''
from calibre.gui2.viewer.documentview import apply_basic_settings
settings = self.settings()
apply_basic_settings(settings)
settings.setAttribute(QWebSettings.DeveloperExtrasEnabled, False)
self.setLinkDelegationPolicy(self.DelegateAllLinks)
self.mainFrame().javaScriptWindowObjectCleared.connect(self.add_window_objects)
self.add_window_objects()
示例5: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, parent):
QWebPage.__init__(self, parent)
settings = self.settings()
apply_settings(settings, config().parse())
settings.setMaximumPagesInCache(0)
secure_web_page(settings)
settings.setAttribute(settings.PrivateBrowsingEnabled, True)
settings.setAttribute(settings.LinksIncludedInFocusChain, False)
settings.setAttribute(settings.DeveloperExtrasEnabled, True)
settings.setDefaultTextEncoding('utf-8')
data = 'data:text/css;charset=utf-8;base64,'
css = '[data-in-split-mode="1"] [data-is-block="1"]:hover { cursor: pointer !important; border-top: solid 5px green !important }'
data += b64encode(css.encode('utf-8'))
settings.setUserStyleSheetUrl(QUrl(data))
self.setNetworkAccessManager(NetworkAccessManager(self))
self.setLinkDelegationPolicy(self.DelegateAllLinks)
self.mainFrame().javaScriptWindowObjectCleared.connect(self.init_javascript)
self.init_javascript()
示例6: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, opts, log):
self.log = log
QWebPage.__init__(self)
settings = self.settings()
settings.setFontSize(QWebSettings.DefaultFontSize, opts.pdf_default_font_size)
settings.setFontSize(QWebSettings.DefaultFixedFontSize, opts.pdf_mono_font_size)
settings.setFontSize(QWebSettings.MinimumLogicalFontSize, 8)
settings.setFontSize(QWebSettings.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:
settings.setFontFamily(QWebSettings.StandardFont, std)
if opts.pdf_serif_family:
settings.setFontFamily(QWebSettings.SerifFont, opts.pdf_serif_family)
if opts.pdf_sans_family:
settings.setFontFamily(QWebSettings.SansSerifFont, opts.pdf_sans_family)
if opts.pdf_mono_family:
settings.setFontFamily(QWebSettings.FixedFont, opts.pdf_mono_family)
self.longjs_counter = 0
示例7: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, log,
confirm_callback=None,
prompt_callback=None,
user_agent=USER_AGENT,
enable_developer_tools=False,
parent=None):
QWebPage.__init__(self, parent)
self.log = log
self.user_agent = user_agent if user_agent else USER_AGENT
self.confirm_callback = confirm_callback
self.prompt_callback = prompt_callback
self.setForwardUnsupportedContent(True)
self.unsupportedContent.connect(self.on_unsupported_content)
settings = self.settings()
if enable_developer_tools:
settings.setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
QWebSettings.enablePersistentStorage(os.path.join(cache_dir(),
'webkit-persistence'))
QWebSettings.setMaximumPagesInCache(0)
self.bridge_name = 'b' + uuid.uuid4().get_hex()
self.mainFrame().javaScriptWindowObjectCleared.connect(
self.add_window_objects)
self.dom_loaded = False
示例8: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self, parent):
QWebPage.__init__(self, parent)
示例9: __init__
# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
def __init__(self):
QWebPage.__init__(self)