Beispiel #1
0
    def add_browser_tab(self):
        factory_func = partial(BrowserTabWidget.add_browser_tab, self)
        web_engine_view = WebEngineView(factory_func,
                                        self._window_factory_function)
        index = self.count()
        self._webengineviews.append(web_engine_view)
        title = 'Tab {}'.format(index + 1)
        self.addTab(web_engine_view, title)

        self.page = web_engine_view.page()  # hole
        #self.page = web_engine_view.QWebEngineProfile()  # hole
        self.page.titleChanged.connect(self._title_changed)
        self.page.iconChanged.connect(self._icon_changed)

        #self.downloadRequested = QWebEngineProfile.downloadRequested
        #print(QWebEngineProfile().downloadRequested)
        #self.downloadRequested = QWebEngineProfile().downloadRequested(self._download_requested)
        self.downloadRequested = self.page.profile().downloadRequested
        self.downloadRequested.connect(self._download_requested)
        #self.page.profile().downloadRequested.connect(self._download_requested)
        #QtWebEngineWidgets.QWebEngineProfile.downloadRequested(
        #    download).connect(self._download_requested)

        web_engine_view.urlChanged.connect(self._url_changed)
        web_engine_view.enabled_changed.connect(self._enabled_changed)
        self.setCurrentIndex(index)
        return web_engine_view
Beispiel #2
0
 def addBrowserTab(self):
     factoryFunc = partial(BrowserTabWidget.addBrowserTab, self)
     webEngineView = WebEngineView(factoryFunc, self._windowFactoryFunction)
     index = self.count()
     self._webengineviews.append(webEngineView)
     title = 'Tab {}'.format(index + 1)
     self.addTab(webEngineView, title)
     page = webEngineView.page()
     page.titleChanged.connect(self._titleChanged)
     page.iconChanged.connect(self._iconChanged)
     page.profile().downloadRequested.connect(self._downloadRequested)
     webEngineView.urlChanged.connect(self._urlChanged)
     webEngineView.enabledChanged.connect(self._enabledChanged)
     self.setCurrentIndex(index)
     return webEngineView