Add purple headers to each mode

This commit is contained in:
Micah Lee 2019-10-27 15:21:46 -07:00
parent bbc26473c4
commit cb83fca6bc
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
7 changed files with 37 additions and 17 deletions

View File

@ -50,33 +50,26 @@ class GuiCommon:
self.css = { self.css = {
# OnionShareGui styles # OnionShareGui styles
"tab_bar_new_tab_button": """ "tab_widget_new_tab_button": """
QPushButton { QPushButton {
font-weight: bold; font-weight: bold;
font-size: 20px; font-size: 20px;
}""", }""",
"new_tab_button": """ "mode_new_tab_button": """
QPushButton { QPushButton {
font-weight: bold; font-weight: bold;
font-size: 30px; font-size: 30px;
color: #601f61; color: #601f61;
}""", }""",
"mode_switcher_selected_style": """ "mode_header_label": """
QPushButton { QLabel {
color: #ffffff; color: #ffffff;
background-color: #4e064f; background-color: #4e064f;
border: 0; border: 0;
border-right: 1px solid #69266b;
font-weight: bold; font-weight: bold;
font-size: 18px;
border-radius: 0; border-radius: 0;
}""", padding: 10px 0 10px 0;
"mode_switcher_unselected_style": """
QPushButton {
color: #ffffff;
background-color: #601f61;
border: 0;
font-weight: normal;
border-radius: 0;
}""", }""",
"settings_button": """ "settings_button": """
QPushButton { QPushButton {

View File

@ -75,6 +75,19 @@ class Mode(QtWidgets.QWidget):
self.web_thread = None self.web_thread = None
self.startup_thread = None self.startup_thread = None
# Header
# Note: It's up to the downstream Mode to add this to its layout
self.header_label = QtWidgets.QLabel()
self.header_label.setStyleSheet(self.common.gui.css["mode_header_label"])
self.header_label.setAlignment(QtCore.Qt.AlignHCenter)
header_layout = QtWidgets.QVBoxLayout()
header_layout.setContentsMargins(0, 0, 0, 0)
header_layout.addWidget(self.header_label)
self.header = QtWidgets.QWidget()
self.header.setLayout(header_layout)
# Server status # Server status
self.server_status = ServerStatus( self.server_status = ServerStatus(
self.common, self.qtapp, self.app, None, self.local_only self.common, self.qtapp, self.app, None, self.local_only

View File

@ -38,6 +38,9 @@ class ReceiveMode(Mode):
# Create the Web object # Create the Web object
self.web = Web(self.common, True, "receive") self.web = Web(self.common, True, "receive")
# Header
self.header_label.setText(strings._("gui_new_tab_receive_button"))
# Server status # Server status
self.server_status.set_mode("receive") self.server_status.set_mode("receive")
self.server_status.server_started_finished.connect(self.update_primary_action) self.server_status.server_started_finished.connect(self.update_primary_action)
@ -86,6 +89,7 @@ class ReceiveMode(Mode):
# Main layout # Main layout
self.main_layout = QtWidgets.QVBoxLayout() self.main_layout = QtWidgets.QVBoxLayout()
self.main_layout.addWidget(self.header)
self.main_layout.addLayout(top_bar_layout) self.main_layout.addLayout(top_bar_layout)
self.main_layout.addWidget(receive_warning) self.main_layout.addWidget(receive_warning)
self.main_layout.addWidget(self.primary_action) self.main_layout.addWidget(self.primary_action)

View File

@ -47,6 +47,9 @@ class ShareMode(Mode):
# Create the Web object # Create the Web object
self.web = Web(self.common, True, "share") self.web = Web(self.common, True, "share")
# Header
self.header_label.setText(strings._("gui_new_tab_share_button"))
# File selection # File selection
self.file_selection = FileSelection(self.common, self) self.file_selection = FileSelection(self.common, self)
if self.filenames: if self.filenames:
@ -118,6 +121,7 @@ class ShareMode(Mode):
# Main layout # Main layout
self.main_layout = QtWidgets.QVBoxLayout() self.main_layout = QtWidgets.QVBoxLayout()
self.main_layout.addWidget(self.header)
self.main_layout.addLayout(top_bar_layout) self.main_layout.addLayout(top_bar_layout)
self.main_layout.addLayout(self.file_selection) self.main_layout.addLayout(self.file_selection)
self.main_layout.addWidget(self.primary_action) self.main_layout.addWidget(self.primary_action)

View File

@ -49,6 +49,9 @@ class WebsiteMode(Mode):
# Create the Web object # Create the Web object
self.web = Web(self.common, True, "website") self.web = Web(self.common, True, "website")
# Header
self.header_label.setText(strings._("gui_new_tab_website_button"))
# File selection # File selection
self.file_selection = FileSelection(self.common, self) self.file_selection = FileSelection(self.common, self)
if self.filenames: if self.filenames:
@ -120,6 +123,7 @@ class WebsiteMode(Mode):
# Main layout # Main layout
self.main_layout = QtWidgets.QVBoxLayout() self.main_layout = QtWidgets.QVBoxLayout()
self.main_layout.addWidget(self.header)
self.main_layout.addLayout(top_bar_layout) self.main_layout.addLayout(top_bar_layout)
self.main_layout.addLayout(self.file_selection) self.main_layout.addLayout(self.file_selection)
self.main_layout.addWidget(self.primary_action) self.main_layout.addWidget(self.primary_action)

View File

@ -57,13 +57,13 @@ class Tab(QtWidgets.QWidget):
# New tab widget # New tab widget
share_button = QtWidgets.QPushButton(strings._("gui_new_tab_share_button")) share_button = QtWidgets.QPushButton(strings._("gui_new_tab_share_button"))
share_button.setStyleSheet(self.common.gui.css["new_tab_button"]) share_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"])
share_description = QtWidgets.QLabel(strings._("gui_new_tab_share_description")) share_description = QtWidgets.QLabel(strings._("gui_new_tab_share_description"))
share_description.setWordWrap(True) share_description.setWordWrap(True)
share_button.clicked.connect(self.share_mode_clicked) share_button.clicked.connect(self.share_mode_clicked)
receive_button = QtWidgets.QPushButton(strings._("gui_new_tab_receive_button")) receive_button = QtWidgets.QPushButton(strings._("gui_new_tab_receive_button"))
receive_button.setStyleSheet(self.common.gui.css["new_tab_button"]) receive_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"])
receive_button.clicked.connect(self.receive_mode_clicked) receive_button.clicked.connect(self.receive_mode_clicked)
receive_description = QtWidgets.QLabel( receive_description = QtWidgets.QLabel(
strings._("gui_new_tab_receive_description") strings._("gui_new_tab_receive_description")
@ -71,7 +71,7 @@ class Tab(QtWidgets.QWidget):
receive_description.setWordWrap(True) receive_description.setWordWrap(True)
website_button = QtWidgets.QPushButton(strings._("gui_new_tab_website_button")) website_button = QtWidgets.QPushButton(strings._("gui_new_tab_website_button"))
website_button.setStyleSheet(self.common.gui.css["new_tab_button"]) website_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"])
website_button.clicked.connect(self.website_mode_clicked) website_button.clicked.connect(self.website_mode_clicked)
website_description = QtWidgets.QLabel( website_description = QtWidgets.QLabel(
strings._("gui_new_tab_website_description") strings._("gui_new_tab_website_description")

View File

@ -47,7 +47,9 @@ class TabWidget(QtWidgets.QTabWidget):
self.new_tab_button.setAutoFillBackground(True) self.new_tab_button.setAutoFillBackground(True)
self.new_tab_button.setFixedSize(30, 30) self.new_tab_button.setFixedSize(30, 30)
self.new_tab_button.clicked.connect(self.new_tab_clicked) self.new_tab_button.clicked.connect(self.new_tab_clicked)
self.new_tab_button.setStyleSheet(self.common.gui.css["tab_bar_new_tab_button"]) self.new_tab_button.setStyleSheet(
self.common.gui.css["tab_widget_new_tab_button"]
)
self.new_tab_button.setToolTip(strings._("gui_new_tab_tooltip")) self.new_tab_button.setToolTip(strings._("gui_new_tab_tooltip"))
# Use a custom tab bar # Use a custom tab bar