예제 #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
예제 #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
예제 #3
0
    def __init__(self, windowFactoryFunction):
        super(BrowserTabWidget, self).__init__()
        self.setTabsClosable(True)
        self._windowFactoryFunction = windowFactoryFunction
        self._webengineviews = []
        self.currentChanged.connect(self._currentChanged)
        self.tabCloseRequested.connect(self.handleTabCloseRequest)
        self._actionsEnabled = {}
        for webAction in WebEngineView.webActions():
            self._actionsEnabled[webAction] = False

        tabBar = self.tabBar()
        tabBar.setSelectionBehaviorOnRemove(QTabBar.SelectPreviousTab)
        tabBar.setContextMenuPolicy(Qt.CustomContextMenu)
        tabBar.customContextMenuRequested.connect(self._handleTabContextMenu)
예제 #4
0
    def __init__(self, window_factory_function):
        super(BrowserTabWidget, self).__init__()

        #self.page = None #hole
        self.downloadRequested = None  #hole

        self.setTabsClosable(True)
        self._window_factory_function = window_factory_function
        self._webengineviews = []
        self._history_windows = {}  # map WebengineView to HistoryWindow
        self.currentChanged.connect(self._current_changed)
        self.tabCloseRequested.connect(self.handle_tab_close_request)
        self._actions_enabled = {}
        for web_action in WebEngineView.web_actions():
            self._actions_enabled[web_action] = False

        tab_bar = self.tabBar()
        tab_bar.setSelectionBehaviorOnRemove(QTabBar.SelectPreviousTab)
        tab_bar.setContextMenuPolicy(Qt.CustomContextMenu)
        tab_bar.customContextMenuRequested.connect(
            self._handle_tab_context_menu)
예제 #5
0
 def _updateActions(self, index):
     if index >= 0 and index < len(self._webengineviews):
         view = self._webengineviews[index]
         for webAction in WebEngineView.webActions():
             enabled = view.isWebActionEnabled(webAction)
             self._checkEmitEnabledChanged(webAction, enabled)
예제 #6
0
 def _zoom_out(self):
     new_zoom = self._tab_widget.zoom_factor() / 1.5
     if (new_zoom >= WebEngineView.minimum_zoom_factor()):
         self._tab_widget.set_zoom_factor(new_zoom)
         self._update_zoom_label()
예제 #7
0
 def _zoom_in(self):
     new_zoom = self._tab_widget.zoom_factor() * 1.5
     if (new_zoom <= WebEngineView.maximum_zoom_factor()):
         self._tab_widget.set_zoom_factor(new_zoom)
         self._update_zoom_label()
예제 #8
0
 def _zoomOut(self):
     newZoom = self._tabWidget.zoomFactor() / 1.5
     if (newZoom >= WebEngineView.minimumZoomFactor()):
         self._tabWidget.setZoomFactor(newZoom)
         self._updateZoomLabel()
예제 #9
0
 def _zoomIn(self):
     newZoom = self._tabWidget.zoomFactor() * 1.5
     if (newZoom <= WebEngineView.maximumZoomFactor()):
         self._tabWidget.setZoomFactor(newZoom)
         self._updateZoomLabel()
예제 #10
0
 def _zoom_out(self):
     new_zoom = self._tab_widget.zoom_factor() / 1.5
     if (new_zoom >= WebEngineView.minimum_zoom_factor()):
         self._tab_widget.set_zoom_factor(new_zoom)
         self._update_zoom_label()
예제 #11
0
 def _zoom_in(self):
     new_zoom = self._tab_widget.zoom_factor() * 1.5
     if (new_zoom <= WebEngineView.maximum_zoom_factor()):
         self._tab_widget.set_zoom_factor(new_zoom)
         self._update_zoom_label()
예제 #12
0
 def _update_actions(self, index):
     if index >= 0 and index < len(self._webengineviews):
         view = self._webengineviews[index]
         for web_action in WebEngineView.web_actions():
             enabled = view.is_web_action_enabled(web_action)
             self._check_emit_enabled_changed(web_action, enabled)