当前位置: 首页>>代码示例>>Python>>正文


Python QWebPage.__init__方法代码示例

本文整理汇总了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)
开发者ID:rlugojr,项目名称:calibre,代码行数:27,代码来源:writer.py

示例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
开发者ID:Aliminator666,项目名称:calibre,代码行数:11,代码来源:stats.py

示例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)
开发者ID:AtulKumar2,项目名称:calibre,代码行数:11,代码来源:location.py

示例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()
开发者ID:rlugojr,项目名称:calibre,代码行数:13,代码来源:footnote.py

示例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()
开发者ID:rlugojr,项目名称:calibre,代码行数:21,代码来源:preview.py

示例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
开发者ID:timpalpant,项目名称:calibre,代码行数:23,代码来源:from_html.py

示例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
开发者ID:GaryMMugford,项目名称:calibre,代码行数:26,代码来源:browser.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
 def __init__(self, parent):
     QWebPage.__init__(self, parent)
开发者ID:geraldmwangi,项目名称:mod-app,代码行数:4,代码来源:mod_remote.py

示例9: __init__

# 需要导入模块: from PyQt5.QtWebKitWidgets import QWebPage [as 别名]
# 或者: from PyQt5.QtWebKitWidgets.QWebPage import __init__ [as 别名]
 def __init__(self):
     QWebPage.__init__(self)
开发者ID:Moondee,项目名称:Artemis,代码行数:4,代码来源:entrypoint_identifier.py


注:本文中的PyQt5.QtWebKitWidgets.QWebPage.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。