eric6/WebBrowser/WebBrowserTabWidget.py

changeset 6999
f23e546a7eb9
parent 6942
2602857055c5
child 7201
6b42677d7043
equal deleted inserted replaced
6998:a63ca2373f44 6999:f23e546a7eb9
125 self.__closedTabsButton.setPopupMode(QToolButton.InstantPopup) 125 self.__closedTabsButton.setPopupMode(QToolButton.InstantPopup)
126 self.__closedTabsButton.setMenu(self.__closedTabsMenu) 126 self.__closedTabsButton.setMenu(self.__closedTabsMenu)
127 self.__closedTabsButton.setEnabled(False) 127 self.__closedTabsButton.setEnabled(False)
128 self.__rightCornerWidgetLayout.addWidget(self.__closedTabsButton) 128 self.__rightCornerWidgetLayout.addWidget(self.__closedTabsButton)
129 129
130 self.__closeButton = QToolButton(self) 130 self.setTabsClosable(True)
131 self.__closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) 131 self.tabCloseRequested.connect(self.closeBrowserAt)
132 self.__closeButton.setToolTip(
133 self.tr("Close the current web browser"))
134 self.__closeButton.setEnabled(False)
135 self.__closeButton.clicked.connect(self.closeBrowser)
136 self.__rightCornerWidgetLayout.addWidget(self.__closeButton)
137 if Preferences.getUI("SingleCloseButton") or \
138 not hasattr(self, 'setTabsClosable'):
139 self.__closeButton.show()
140 else:
141 self.setTabsClosable(True)
142 self.tabCloseRequested.connect(self.closeBrowserAt)
143 self.__closeButton.hide()
144 132
145 self.setCornerWidget(self.__rightCornerWidget, Qt.TopRightCorner) 133 self.setCornerWidget(self.__rightCornerWidget, Qt.TopRightCorner)
146 134
147 self.__newTabButton = QToolButton(self) 135 self.__newTabButton = QToolButton(self)
148 self.__newTabButton.setIcon(UI.PixmapCache.getIcon("plus.png")) 136 self.__newTabButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
458 if not background: 446 if not background:
459 self.setCurrentIndex(index) 447 self.setCurrentIndex(index)
460 448
461 self.__mainWindow.closeAct.setEnabled(True) 449 self.__mainWindow.closeAct.setEnabled(True)
462 self.__mainWindow.closeAllAct.setEnabled(True) 450 self.__mainWindow.closeAllAct.setEnabled(True)
463 self.__closeButton.setEnabled(True)
464 self.__navigationButton.setEnabled(True) 451 self.__navigationButton.setEnabled(True)
465 452
466 if not restoreSession: 453 if not restoreSession:
467 if not linkName: 454 if not linkName:
468 if Preferences.getWebBrowser("NewTabBehavior") == 0: 455 if Preferences.getWebBrowser("NewTabBehavior") == 0:
926 for browser in self.browsers(): 913 for browser in self.browsers():
927 browser.preferencesChanged() 914 browser.preferencesChanged()
928 915
929 for urlbar in self.__stackedUrlBar.urlBars(): 916 for urlbar in self.__stackedUrlBar.urlBars():
930 urlbar.preferencesChanged() 917 urlbar.preferencesChanged()
931
932 if Preferences.getUI("SingleCloseButton"):
933 self.setTabsClosable(False)
934 try:
935 self.tabCloseRequested.disconnect(self.closeBrowserAt)
936 except TypeError:
937 pass
938 self.__closeButton.show()
939 else:
940 self.setTabsClosable(True)
941 self.tabCloseRequested.connect(self.closeBrowserAt)
942 self.__closeButton.hide()
943 918
944 def __loadStarted(self, browser): 919 def __loadStarted(self, browser):
945 """ 920 """
946 Private method to handle the loadStarted signal. 921 Private method to handle the loadStarted signal.
947 922

eric ide

mercurial