mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
macOS seems to have close buttons that work on their own now
This commit is contained in:
parent
fa70368a8d
commit
0e2d2a1e46
@ -186,10 +186,6 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||||||
index = self.addTab(tab, strings._("gui_new_tab"))
|
index = self.addTab(tab, strings._("gui_new_tab"))
|
||||||
self.setCurrentIndex(index)
|
self.setCurrentIndex(index)
|
||||||
|
|
||||||
# In macOS, manually create a close button because tabs don't seem to have them otherwise
|
|
||||||
if self.common.platform == "Darwin":
|
|
||||||
self.macos_create_close_button(tab, index)
|
|
||||||
|
|
||||||
tab.init(mode_settings)
|
tab.init(mode_settings)
|
||||||
|
|
||||||
# Make sure the title is set
|
# Make sure the title is set
|
||||||
@ -218,10 +214,6 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||||||
index = self.addTab(settings_tab, strings._("gui_settings_window_title"))
|
index = self.addTab(settings_tab, strings._("gui_settings_window_title"))
|
||||||
self.setCurrentIndex(index)
|
self.setCurrentIndex(index)
|
||||||
|
|
||||||
# In macOS, manually create a close button because tabs don't seem to have them otherwise
|
|
||||||
if self.common.platform == "Darwin":
|
|
||||||
self.macos_create_close_button(settings_tab, index)
|
|
||||||
|
|
||||||
def open_tor_settings_tab(self):
|
def open_tor_settings_tab(self):
|
||||||
self.common.log("TabWidget", "open_tor_settings_tab")
|
self.common.log("TabWidget", "open_tor_settings_tab")
|
||||||
|
|
||||||
@ -244,10 +236,6 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||||||
)
|
)
|
||||||
self.setCurrentIndex(index)
|
self.setCurrentIndex(index)
|
||||||
|
|
||||||
# In macOS, manually create a close button because tabs don't seem to have them otherwise
|
|
||||||
if self.common.platform == "Darwin":
|
|
||||||
self.macos_create_close_button(self.tor_settings_tab, index)
|
|
||||||
|
|
||||||
def change_title(self, tab_id, title):
|
def change_title(self, tab_id, title):
|
||||||
shortened_title = title
|
shortened_title = title
|
||||||
if len(shortened_title) > 11:
|
if len(shortened_title) > 11:
|
||||||
@ -388,19 +376,6 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||||||
super(TabWidget, self).resizeEvent(event)
|
super(TabWidget, self).resizeEvent(event)
|
||||||
self.move_new_tab_button()
|
self.move_new_tab_button()
|
||||||
|
|
||||||
def macos_create_close_button(self, tab, index):
|
|
||||||
def close_tab():
|
|
||||||
self.tabBar().tabCloseRequested.emit(self.indexOf(tab))
|
|
||||||
|
|
||||||
close_button = QtWidgets.QPushButton()
|
|
||||||
close_button.setFlat(True)
|
|
||||||
close_button.setFixedWidth(40)
|
|
||||||
close_button.setIcon(
|
|
||||||
QtGui.QIcon(GuiCommon.get_resource_path("images/close_tab.png"))
|
|
||||||
)
|
|
||||||
close_button.clicked.connect(close_tab)
|
|
||||||
self.tabBar().setTabButton(index, QtWidgets.QTabBar.RightSide, tab.close_button)
|
|
||||||
|
|
||||||
def tor_is_connected(self):
|
def tor_is_connected(self):
|
||||||
for tab_id in self.tabs:
|
for tab_id in self.tabs:
|
||||||
if not (
|
if not (
|
||||||
|
Loading…
Reference in New Issue
Block a user