mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Open a new tab to begin with, and open a new tab when the last tab is closed
This commit is contained in:
parent
df658a0e70
commit
bbc26473c4
@ -98,14 +98,11 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
# Tabs
|
||||
self.tabs = TabWidget(self.common, self.system_tray, self.status_bar)
|
||||
|
||||
# Start with a tab
|
||||
# new_tab = Tab(self.common, self.system_tray, self.status_bar, filenames)
|
||||
# self.tabs.insertTab(0, new_tab, strings._("gui_new_tab"))
|
||||
# self.tabs.setCurrentIndex(0)
|
||||
# Start with opening the first tab
|
||||
self.tabs.new_tab_clicked()
|
||||
|
||||
# Layout
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
# layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.addWidget(self.tabs)
|
||||
|
||||
central_widget = QtWidgets.QWidget()
|
||||
|
@ -105,6 +105,10 @@ class TabWidget(QtWidgets.QTabWidget):
|
||||
self.removeTab(index)
|
||||
del self.tabs[tab.tab_id]
|
||||
|
||||
# If the last tab is closed, open a new one
|
||||
if self.count() == 0:
|
||||
self.new_tab_clicked()
|
||||
|
||||
def resizeEvent(self, event):
|
||||
# Make sure to move new tab button on each resize
|
||||
super(TabWidget, self).resizeEvent(event)
|
||||
|
Loading…
Reference in New Issue
Block a user