One attempt at making a new tab button

This commit is contained in:
Micah Lee 2019-10-26 22:39:59 -07:00
parent 144985b1c1
commit 3ceab336f9
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 29 additions and 3 deletions

View File

@ -50,6 +50,16 @@ class GuiCommon:
self.css = {
# OnionShareGui styles
"tab_bar_new_tab": """
QTabBar::tab:last {
border: 0;
margin: 3px;
}""",
"tab_bar_new_tab_button": """
QToolButton {
font-weight: bold;
font-size: 20px;
}""",
"new_tab_button": """
QPushButton {
font-weight: bold;

View File

@ -97,10 +97,24 @@ class MainWindow(QtWidgets.QMainWindow):
# Tabs
self.tabs = QtWidgets.QTabWidget()
self.tabs.setStyleSheet(self.common.gui.css["tab_bar_new_tab"])
self.tabs.setMovable(True)
self.tabs.setTabsClosable(True)
self.tabs.setUsesScrollButtons(True)
# Start with one tab
self.tab = Tab(self.common, self.system_tray, self.status_bar, filenames)
self.tabs.addTab(self.tab, "New Tab")
# New tab button
new_tab_button = QtWidgets.QToolButton()
new_tab_button.setStyleSheet(self.common.gui.css["tab_bar_new_tab_button"])
new_tab_button.setText("+")
new_tab_button.setAutoRaise(True)
self.tabs.insertTab(0, QtWidgets.QWidget(), "")
self.tabs.tabBar().setTabButton(0, QtWidgets.QTabBar.RightSide, new_tab_button)
self.tabs.tabBar().setTabToolTip(0, strings._("gui_new_tab_tooltip"))
# 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)
# Layout
layout = QtWidgets.QVBoxLayout()

View File

@ -180,6 +180,8 @@
"hours_first_letter": "h",
"minutes_first_letter": "m",
"seconds_first_letter": "s",
"gui_new_tab": "New Tab",
"gui_new_tab_tooltip": "Open a new tab",
"gui_new_tab_share_button": "Share Files",
"gui_new_tab_share_description": "Choose files on your computer to send to someone else. The person or people who you want to send files to will need to use Tor Browser to download them from you.",
"gui_new_tab_receive_button": "Receive Files",