Python PyQt5.QtWebEngineWidgets.QWebEnginePage() Examples

The following are 3 code examples of PyQt5.QtWebEngineWidgets.QWebEnginePage(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWebEngineWidgets , or try the search function .
Example #1
Source File: docwindow.py    From bluesky with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
            super(DocView, self).__init__(parent)

            class DocPage(QWebPage):
                def __init__(self, parent=None):
                    super(DocPage, self).__init__(parent)

                def acceptNavigationRequest(self, url, navtype, ismainframe):
                    if navtype == self.NavigationTypeLinkClicked:
                        if url.url()[:6].lower() == 'stack:':
                            DocWindow.app.stack(url.url()[6:].lower())
                            return False

                    return True
            self.page = DocPage()
            self.setPage(self.page) 
Example #2
Source File: simple_browser.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def add_tab(self, *args):
        webview = qtwe.QWebEngineView()
        tab_index = self.tabs.addTab(webview, 'New Tab')

        webview.urlChanged.connect(
            lambda x: self.tabs.setTabText(tab_index, x.toString()))
        webview.urlChanged.connect(
            lambda x: self.urlbar.setText(x.toString()))

        # make it so pop-up windows call this method
        webview.createWindow = self.add_tab

        # History
        webview.urlChanged.connect(self.update_history)

        # Profile
        page = qtwe.QWebEnginePage(self.profile)
        webview.setPage(page)

        # Add the finder script
        page.scripts().insert(self.finder_script)

        # set default content
        webview.setHtml(
            '<h1>Blank Tab</h1><p>It is a blank tab!</p>',
            qtc.QUrl('about:blank'))

        return webview 
Example #3
Source File: ybqt.py    From yiban-api with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super(LoginWindow, self).__init__()
        self.setupUi(self)
        profile = QtWebEngineWidgets.QWebEngineProfile(self.webEngineView)
        webpage = QtWebEngineWidgets.QWebEnginePage(profile, self.webEngineView)
        self.webEngineView.setPage(webpage)
        self.cookie_store = profile.cookieStore()
        self.cookie_store.cookieAdded.connect(self.onCookieAdded)
        self.cookies = dict()
        self.resetWebview()
        self.webEngineView.load(QtCore.QUrl("https://www.yiban.cn/login"))