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


Python QtWebKitWidgets.QWebView方法代码示例

本文整理汇总了Python中PyQt5.QtWebKitWidgets.QWebView方法的典型用法代码示例。如果您正苦于以下问题:Python QtWebKitWidgets.QWebView方法的具体用法?Python QtWebKitWidgets.QWebView怎么用?Python QtWebKitWidgets.QWebView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWebKitWidgets的用法示例。


在下文中一共展示了QtWebKitWidgets.QWebView方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupUi

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def setupUi(self, go2mapillaryDockWidgetBase):
        go2mapillaryDockWidgetBase.setObjectName(_fromUtf8("go2mapillaryDockWidgetBase"))
        go2mapillaryDockWidgetBase.resize(320, 260)
        self.dockWidgetContents = QtWidgets.QWidget()
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.dockWidgetContents.sizePolicy().hasHeightForWidth())
        self.dockWidgetContents.setSizePolicy(sizePolicy)
        self.dockWidgetContents.setMinimumSize(QtCore.QSize(320, 240))
        self.dockWidgetContents.setMaximumSize(QtCore.QSize(320, 240))
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.gridLayout = QtWidgets.QGridLayout(self.dockWidgetContents)
        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.webView = QtWebKitWidgets.QWebView(self.dockWidgetContents)
        self.webView.setUrl(QtCore.QUrl(_fromUtf8("about:blank")))
        self.webView.setObjectName(_fromUtf8("webView"))
        self.gridLayout.addWidget(self.webView, 0, 0, 1, 1)
        go2mapillaryDockWidgetBase.setWidget(self.dockWidgetContents)

        self.retranslateUi(go2mapillaryDockWidgetBase)
        QtCore.QMetaObject.connectSlotsByName(go2mapillaryDockWidgetBase) 
开发者ID:enricofer,项目名称:go2mapillary,代码行数:26,代码来源:mapillary_explorer_dockwidget_base.py

示例2: setupUi

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def setupUi(self, FmvAbout):
        FmvAbout.setObjectName("FmvAbout")
        FmvAbout.resize(643, 559)
        FmvAbout.setMinimumSize(QtCore.QSize(200, 250))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/imgFMV/images/Information.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        FmvAbout.setWindowIcon(icon)
        FmvAbout.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.verticalLayout = QtWidgets.QVBoxLayout(FmvAbout)
        self.verticalLayout.setObjectName("verticalLayout")
        self.webView = QtWebKitWidgets.QWebView(FmvAbout)
        self.webView.setProperty("url", QtCore.QUrl("about:blank"))
        self.webView.setObjectName("webView")
        self.verticalLayout.addWidget(self.webView)

        self.retranslateUi(FmvAbout)
        QtCore.QMetaObject.connectSlotsByName(FmvAbout) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:19,代码来源:ui_FmvAbout.py

示例3: __del__

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def __del__(self):
        # Explicitly releasing the page here seems to prevent some segfaults
        # when quitting.
        # Copied from:
        # https://code.google.com/p/webscraping/source/browse/webkit.py#325
        try:
            self.setPage(None)  # type: ignore[arg-type]
        except RuntimeError:
            # It seems sometimes Qt has already deleted the QWebView and we
            # get: RuntimeError: wrapped C/C++ object of type WebView has been
            # deleted
            pass 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:14,代码来源:webview.py

示例4: createWindow

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def createWindow(self, wintype):
        """Called by Qt when a page wants to create a new window.

        This function is called from the createWindow() method of the
        associated QWebPage, each time the page wants to create a new window of
        the given type. This might be the result, for example, of a JavaScript
        request to open a document in a new window.

        Args:
            wintype: This enum describes the types of window that can be
                     created by the createWindow() function.

                     QWebPage::WebBrowserWindow: The window is a regular web
                                                 browser window.
                     QWebPage::WebModalDialog: The window acts as modal dialog.

        Return:
            The new QWebView object.
        """
        debug_type = debug.qenum_key(QWebPage, wintype)
        log.webview.debug("createWindow with type {}".format(debug_type))
        if wintype == QWebPage.WebModalDialog:
            log.webview.warning("WebModalDialog requested, but we don't "
                                "support that!")
        tabbed_browser = objreg.get('tabbed-browser', scope='window',
                                    window=self.win_id)
        # pylint: disable=protected-access
        return tabbed_browser.tabopen(background=False)._widget 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:30,代码来源:webview.py

示例5: setupUi

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def setupUi(self, QHangupsBrowser):
        QHangupsBrowser.setObjectName("QHangupsBrowser")
        QHangupsBrowser.resize(600, 450)
        self.verticalLayout = QtWidgets.QVBoxLayout(QHangupsBrowser)
        self.verticalLayout.setObjectName("verticalLayout")
        self.browserWebView = QtWebKitWidgets.QWebView(QHangupsBrowser)
        self.browserWebView.setUrl(QtCore.QUrl("about:blank"))
        self.browserWebView.setObjectName("browserWebView")
        self.verticalLayout.addWidget(self.browserWebView)

        self.retranslateUi(QHangupsBrowser)
        QtCore.QMetaObject.connectSlotsByName(QHangupsBrowser) 
开发者ID:xmikos,项目名称:qhangups,代码行数:14,代码来源:ui_qhangupsbrowser.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def __init__(self, *args, **kw):
        url = kw.pop('url', None)
        first = False
        if not url:
            url = get_authenticated_url()
            first = True
        self.url = url
        self.closing = False

        super(QWebView, self).__init__(*args, **kw)
        self.setWindowTitle('Bitmask')
        self.bitmask_browser = NewPageConnector(self) if first else None
        self.loadPage(self.url)

        self.bridge = AppBridge(self) if first else None

        if self.bridge is not None and HAS_WEBENGINE:
            print "[+] registering python<->js bridge"
            channel = QWebChannel(self)
            channel.registerObject("bitmaskApp", self.bridge)
            self.page().setWebChannel(channel)

        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(":/mask-icon.png"),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.setWindowIcon(icon) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:29,代码来源:app.py

示例7: _stockInfoAct

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def _stockInfoAct(self):
        code, name = self._interface.getCodeName()
        if code is None: return

        browser = DyWebView()
        url = 'http://basic.10jqka.com.cn/32/{0}/'.format(code[:-3])
        browser.load(QUrl(url))

        browser.setWindowTitle(name)
        
        rect = QApplication.desktop().availableGeometry()
        taskBarHeight = QApplication.desktop().height() - rect.height()

        browser.resize(rect.width()//3 * 2, rect.height() - taskBarHeight)
        browser.move((rect.width() - browser.width())//2, 0)

        browser.show()

        self._browsers.append(browser) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:21,代码来源:DyStockSelectItemMenu.py

示例8: __init__

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def __init__(self):
    super(QWebView, self).__init__()
    self.ui = Ui_Form_mod()
    self.ui.setupUi(self)
    self.ui.initSystem(self)
    self.ui.screenMain(self)
    self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))

    if not fotoboxCfg['nopi']:
      GPIO.setmode(GPIO.BCM)

      GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)

      self.btnC1 = GPIO.HIGH
      self.btnC2 = GPIO.HIGH
      self.btnC3 = GPIO.HIGH
    
    #Key Poller
    self.timerKey = QTimer(self)
    self.timerKey.timeout.connect(self.buttonCheck)
    self.timerKey.start(25)
    self.btnB  = 1

    self.showFullScreen() 
开发者ID:adlerweb,项目名称:fotobox,代码行数:28,代码来源:fotobox.py

示例9: __init__

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)

        self.setAttribute(Qt.WA_TranslucentBackground, True)  # 设置父控件Widget背景透明
        self.setWindowFlags(Qt.FramelessWindowHint)  # 去掉边框
        palette = self.palette()
        palette.setBrush(QPalette.Base, Qt.transparent)  # 父控件背景透明
        self.setPalette(palette)

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)

        #         QWebSettings.globalSettings().setAttribute(
        #             QWebSettings.DeveloperExtrasEnabled, True)# web开发者工具

        self.webView = QWebView(self)  # 网页控件
        layout.addWidget(self.webView)
        self.webView.setContextMenuPolicy(Qt.NoContextMenu)  # 去掉右键菜单
        self.mainFrame = self.webView.page().mainFrame()

        self.mainFrame.setScrollBarPolicy(
            Qt.Vertical, Qt.ScrollBarAlwaysOff)  # 去掉滑动条
        self.mainFrame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)

        # 最大化
        rect = app.desktop().availableGeometry()
        self.resize(rect.size())
        self.webView.resize(rect.size()) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:30,代码来源:DreamTree.py

示例10: _stockInfoAct

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def _stockInfoAct(self):
        code, name = self.getRightClickCodeName()
        if code is None: return

        browser = DyWebView()
        url = 'http://basic.10jqka.com.cn/32/{0}/'.format(code[:-3])
        browser.load(QUrl(url))

        browser.setWindowTitle(name)
        
        rect = QApplication.desktop().availableGeometry()
        taskBarHeight = QApplication.desktop().height() - rect.height()

        browser.resize(rect.width()//3 * 2, rect.height() - taskBarHeight)
        browser.move((rect.width() - browser.width())//2, 0)

        browser.show()

        self._windows.append(browser) 
开发者ID:shakenetwork,项目名称:DevilYuan,代码行数:21,代码来源:DyStockTableWidget.py

示例11: setupUi

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def setupUi(self, Browser):
        Browser.setObjectName("Browser")
        Browser.resize(995, 615)
        self.verticalLayout = QtWidgets.QVBoxLayout(Browser)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.backButton = QtWidgets.QPushButton(Browser)
        self.backButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/1444613637_arrow-left-01.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.backButton.setIcon(icon)
        self.backButton.setObjectName("backButton")
        self.horizontalLayout.addWidget(self.backButton)
        self.nextButton = QtWidgets.QPushButton(Browser)
        self.nextButton.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/1444613630_arrow-right-01.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.nextButton.setIcon(icon1)
        self.nextButton.setObjectName("nextButton")
        self.horizontalLayout.addWidget(self.nextButton)
        self.urlBar = QtWidgets.QLineEdit(Browser)
        self.urlBar.setObjectName("urlBar")
        self.horizontalLayout.addWidget(self.urlBar)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.webView = QtWebKitWidgets.QWebView(Browser)
        self.webView.setMinimumSize(QtCore.QSize(0, 0))
        self.webView.setUrl(QtCore.QUrl("http://pl.pycon.org/2015/agenda.html"))
        self.webView.setObjectName("webView")
        self.verticalLayout.addWidget(self.webView)

        self.retranslateUi(Browser)
        QtCore.QMetaObject.connectSlotsByName(Browser) 
开发者ID:riklaunim,项目名称:django-examples,代码行数:36,代码来源:browser.py

示例12: show_docs

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def show_docs(self):
        self.docs = QWebView()
        self.docs.load(QUrl("https://pandapower.readthedocs.io"))
        self.docs.setWindowTitle("pandapower Documentation")
        self.docs.show() 
开发者ID:Tooblippe,项目名称:pandapower_gui,代码行数:7,代码来源:pandapower_gui.py

示例13: setupUi

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def setupUi(self, QHangupsConversationWidget):
        QHangupsConversationWidget.setObjectName("QHangupsConversationWidget")
        QHangupsConversationWidget.resize(600, 400)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(QHangupsConversationWidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.splitter = QtWidgets.QSplitter(QHangupsConversationWidget)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.setObjectName("splitter")
        self.messagesFrame = QtWidgets.QFrame(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(250)
        sizePolicy.setHeightForWidth(self.messagesFrame.sizePolicy().hasHeightForWidth())
        self.messagesFrame.setSizePolicy(sizePolicy)
        self.messagesFrame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.messagesFrame.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.messagesFrame.setObjectName("messagesFrame")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.messagesFrame)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.messagesWebView = QtWebKitWidgets.QWebView(self.messagesFrame)
        self.messagesWebView.setUrl(QtCore.QUrl("about:blank"))
        self.messagesWebView.setObjectName("messagesWebView")
        self.verticalLayout.addWidget(self.messagesWebView)
        self.frame = QtWidgets.QFrame(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
        self.frame.setSizePolicy(sizePolicy)
        self.frame.setMinimumSize(QtCore.QSize(0, 60))
        self.frame.setObjectName("frame")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
        self.horizontalLayout.setContentsMargins(0, -1, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.messageTextEdit = QtWidgets.QPlainTextEdit(self.frame)
        self.messageTextEdit.setObjectName("messageTextEdit")
        self.horizontalLayout.addWidget(self.messageTextEdit)
        self.sendButton = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sendButton.sizePolicy().hasHeightForWidth())
        self.sendButton.setSizePolicy(sizePolicy)
        self.sendButton.setObjectName("sendButton")
        self.horizontalLayout.addWidget(self.sendButton)
        self.verticalLayout_2.addWidget(self.splitter)

        self.retranslateUi(QHangupsConversationWidget)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversationWidget)
        QHangupsConversationWidget.setTabOrder(self.messageTextEdit, self.sendButton)
        QHangupsConversationWidget.setTabOrder(self.sendButton, self.messagesWebView) 
开发者ID:xmikos,项目名称:qhangups,代码行数:55,代码来源:ui_qhangupsconversationwidget.py

示例14: __init__

# 需要导入模块: from PyQt5 import QtWebKitWidgets [as 别名]
# 或者: from PyQt5.QtWebKitWidgets import QWebView [as 别名]
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.resize(600, 400)
        layout = QHBoxLayout(self)

        # 左侧
        widgetLeft = QWidget(self)
        layoutLeft = QVBoxLayout(widgetLeft)
        # 右侧
        self.widgetRight = QListWidget(
            self, minimumWidth=200, iconSize=QSize(150, 150))
        self.widgetRight.setViewMode(QListWidget.IconMode)
        layout.addWidget(widgetLeft)
        layout.addWidget(self.widgetRight)

        self.webView = QWebView()
        layoutLeft.addWidget(self.webView)

        # 截图方式一
        groupBox1 = QGroupBox('截图方式一', self)
        layout1 = QVBoxLayout(groupBox1)
        layout1.addWidget(QPushButton('截图1', self, clicked=self.onScreenShot1))
        layoutLeft.addWidget(groupBox1)

        # 截图方式二(采用js)
        groupBox2 = QGroupBox('截图方式二', self)
        layout2 = QVBoxLayout(groupBox2)
        self.codeEdit = QLineEdit(
            'body', groupBox2, placeholderText='请输入需要截图的元素、ID或者class:如body、#id .class')
        layout2.addWidget(self.codeEdit)
        self.btnMethod2 = QPushButton(
            '', self, clicked=self.onScreenShot2, enabled=False)
        layout2.addWidget(self.btnMethod2)
        layoutLeft.addWidget(groupBox2)

        # 开启开发人员工具
        QWebSettings.globalSettings().setAttribute(
            QWebSettings.DeveloperExtrasEnabled, True)
        self.webView.loadStarted.connect(self.onLoadStarted)
        self.webView.loadFinished.connect(self.onLoadFinished)
        self.webView.load(QUrl("https://pyqt5.com"))

        # 暴露接口和加载完成后执行jquery等一些库文件
        self.webView.page().mainFrame().javaScriptWindowObjectCleared.connect(
            self.populateJavaScriptWindowObject) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:47,代码来源:ScreenShotPage.py


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