Beispiel #1
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)
Beispiel #2
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)