Adds UI/UX enhancements in different sections of tab layouts

This commit is contained in:
Saptak S 2020-08-30 19:23:23 +05:30
parent ddf1532eed
commit 12c7548c08
No known key found for this signature in database
GPG Key ID: 2D9B32E54C68A3FB
15 changed files with 75 additions and 19 deletions

View File

@ -77,8 +77,9 @@ class GuiCommon:
}""", }""",
"mode_header_label": """ "mode_header_label": """
QLabel { QLabel {
color: #333333; color: #4E064F;
font-size: 30px; font-size: 48px;
margin-bottom: 16px;
}""", }""",
"settings_button": """ "settings_button": """
QPushButton { QPushButton {
@ -216,6 +217,7 @@ class GuiCommon:
"new_tab_button_image": """ "new_tab_button_image": """
QLabel { QLabel {
padding: 30px; padding: 30px;
text-align: center;
} }
""", """,
"new_tab_button_text": """ "new_tab_button_text": """
@ -227,6 +229,13 @@ class GuiCommon:
color: #4e0d4e; color: #4e0d4e;
} }
""", """,
"new_tab_title_text": """
QLabel {
text-align: center;
color: #333333;
font-size: 28px;
}
""",
# Share mode and child widget styles # Share mode and child widget styles
"share_delete_all_files_button": """ "share_delete_all_files_button": """
QPushButton { QPushButton {
@ -254,12 +263,14 @@ class GuiCommon:
""", """,
"share_file_selection_drop_here_header_label": """ "share_file_selection_drop_here_header_label": """
QLabel { QLabel {
color: #333333; color: #4E064F;
font-size: 30px; font-size: 48px;
margin-bottom: 72px;
}""", }""",
"share_file_selection_drop_here_label": """ "share_file_selection_drop_here_label": """
QLabel { QLabel {
color: #666666; color: #666666;
margin-bottom: 48px;
}""", }""",
"share_file_selection_drop_count_label": """ "share_file_selection_drop_count_label": """
QLabel { QLabel {

View File

@ -97,7 +97,6 @@ class Mode(QtWidgets.QWidget):
# Note: It's up to the downstream Mode to add this to its layout # Note: It's up to the downstream Mode to add this to its layout
self.primary_action_layout = QtWidgets.QVBoxLayout() self.primary_action_layout = QtWidgets.QVBoxLayout()
self.primary_action_layout.addWidget(self.mode_settings_widget) self.primary_action_layout.addWidget(self.mode_settings_widget)
self.primary_action_layout.addWidget(self.server_status)
self.primary_action = QtWidgets.QWidget() self.primary_action = QtWidgets.QWidget()
self.primary_action.setLayout(self.primary_action_layout) self.primary_action.setLayout(self.primary_action_layout)

View File

@ -85,6 +85,7 @@ class ChatMode(Mode):
self.main_layout.addStretch() self.main_layout.addStretch()
self.main_layout.addWidget(header_label) self.main_layout.addWidget(header_label)
self.main_layout.addWidget(self.primary_action) self.main_layout.addWidget(self.primary_action)
self.main_layout.addWidget(self.server_status)
self.main_layout.addStretch() self.main_layout.addStretch()
self.main_layout.addWidget(MinimumWidthWidget(700)) self.main_layout.addWidget(MinimumWidthWidget(700))

View File

@ -47,11 +47,9 @@ class ReceiveMode(Mode):
QtGui.QImage(self.common.get_resource_path("images/mode_receive.png")) QtGui.QImage(self.common.get_resource_path("images/mode_receive.png"))
) )
) )
self.image_label.setFixedSize(300, 300) self.image_label.setFixedSize(250, 250)
image_layout = QtWidgets.QVBoxLayout() image_layout = QtWidgets.QVBoxLayout()
image_layout.addStretch()
image_layout.addWidget(self.image_label) image_layout.addWidget(self.image_label)
image_layout.addStretch()
self.image = QtWidgets.QWidget() self.image = QtWidgets.QWidget()
self.image.setLayout(image_layout) self.image.setLayout(image_layout)
@ -125,18 +123,26 @@ class ReceiveMode(Mode):
# Main layout # Main layout
self.main_layout = QtWidgets.QVBoxLayout() self.main_layout = QtWidgets.QVBoxLayout()
self.main_layout.addLayout(top_bar_layout)
self.main_layout.addStretch()
self.main_layout.addWidget(header_label) self.main_layout.addWidget(header_label)
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)
self.main_layout.addStretch() self.main_layout.addWidget(MinimumWidthWidget(525))
self.main_layout.addWidget(MinimumWidthWidget(700))
# Row layout
content_row = QtWidgets.QHBoxLayout()
content_row.addLayout(self.main_layout)
content_row.addWidget(self.image)
row_layout = QtWidgets.QVBoxLayout()
row_layout.addLayout(top_bar_layout)
row_layout.addStretch()
row_layout.addLayout(content_row)
row_layout.addWidget(self.server_status)
row_layout.addStretch()
# Column layout # Column layout
self.column_layout = QtWidgets.QHBoxLayout() self.column_layout = QtWidgets.QHBoxLayout()
self.column_layout.addWidget(self.image) self.column_layout.addLayout(row_layout)
self.column_layout.addLayout(self.main_layout)
self.column_layout.addWidget(self.history, stretch=1) self.column_layout.addWidget(self.history, stretch=1)
# Wrapper layout # Wrapper layout

View File

@ -165,6 +165,7 @@ class ShareMode(Mode):
# Wrapper layout # Wrapper layout
self.wrapper_layout = QtWidgets.QVBoxLayout() self.wrapper_layout = QtWidgets.QVBoxLayout()
self.wrapper_layout.addLayout(self.column_layout) self.wrapper_layout.addLayout(self.column_layout)
self.wrapper_layout.addWidget(self.server_status)
self.setLayout(self.wrapper_layout) self.setLayout(self.wrapper_layout)
# Always start with focus on file selection # Always start with focus on file selection

View File

@ -165,6 +165,7 @@ class WebsiteMode(Mode):
# Wrapper layout # Wrapper layout
self.wrapper_layout = QtWidgets.QVBoxLayout() self.wrapper_layout = QtWidgets.QVBoxLayout()
self.wrapper_layout.addLayout(self.column_layout) self.wrapper_layout.addLayout(self.column_layout)
self.wrapper_layout.addWidget(self.server_status)
self.setLayout(self.wrapper_layout) self.setLayout(self.wrapper_layout)
# Always start with focus on file selection # Always start with focus on file selection

View File

@ -36,7 +36,7 @@ from ..widgets import Alert
class NewTabButton(QtWidgets.QPushButton): class NewTabButton(QtWidgets.QPushButton):
def __init__(self, common, image_filename, text): def __init__(self, common, image_filename, title, text):
super(NewTabButton, self).__init__() super(NewTabButton, self).__init__()
self.common = common self.common = common
@ -49,17 +49,26 @@ class NewTabButton(QtWidgets.QPushButton):
QtGui.QImage(self.common.get_resource_path(image_filename)) QtGui.QImage(self.common.get_resource_path(image_filename))
) )
) )
self.image_label.setFixedSize(280, 280) self.image_label.setAlignment(QtCore.Qt.AlignCenter)
self.image_label.setStyleSheet(self.common.gui.css["new_tab_button_image"]) self.image_label.setStyleSheet(self.common.gui.css["new_tab_button_image"])
self.image_label.setGeometry(0, 0, self.width(), self.height()) self.image_label.setGeometry(0, 0, self.width(), 200)
self.image_label.show() self.image_label.show()
# Title
self.title_label = QtWidgets.QLabel(title, parent=self)
self.title_label.setAlignment(QtCore.Qt.AlignCenter)
self.title_label.setStyleSheet(self.common.gui.css["new_tab_title_text"])
self.title_label.setGeometry(
(self.width() - 250) / 2, self.height() - 100, 250, 30
)
self.title_label.show()
# Text # Text
self.text_label = QtWidgets.QLabel(text, parent=self) self.text_label = QtWidgets.QLabel(text, parent=self)
self.text_label.setAlignment(QtCore.Qt.AlignCenter) self.text_label.setAlignment(QtCore.Qt.AlignCenter)
self.text_label.setStyleSheet(self.common.gui.css["new_tab_button_text"]) self.text_label.setStyleSheet(self.common.gui.css["new_tab_button_text"])
self.text_label.setGeometry( self.text_label.setGeometry(
(self.width() - 200) / 2, self.height() - 40, 200, 30 (self.width() - 200) / 2, self.height() - 50, 200, 30
) )
self.text_label.show() self.text_label.show()
@ -96,11 +105,26 @@ class Tab(QtWidgets.QWidget):
# Start the OnionShare app # Start the OnionShare app
self.app = OnionShare(common, self.common.gui.onion, self.common.gui.local_only) self.app = OnionShare(common, self.common.gui.onion, self.common.gui.local_only)
# Onionshare logo
self.image_label = QtWidgets.QLabel()
self.image_label.setPixmap(
QtGui.QPixmap.fromImage(
QtGui.QImage(self.common.get_resource_path("images/logo_text.png"))
)
)
self.image_label.setFixedSize(160, 40)
image_layout = QtWidgets.QVBoxLayout()
image_layout.addWidget(self.image_label)
image_layout.addStretch()
self.image = QtWidgets.QWidget()
self.image.setLayout(image_layout)
# New tab buttons # New tab buttons
self.share_button = NewTabButton( self.share_button = NewTabButton(
self.common, self.common,
"images/mode_new_tab_share.png", "images/mode_new_tab_share.png",
strings._("gui_new_tab_share_button"), strings._("gui_new_tab_share_button"),
strings._("gui_main_page_share_button"),
) )
self.share_button.clicked.connect(self.share_mode_clicked) self.share_button.clicked.connect(self.share_mode_clicked)
@ -108,6 +132,7 @@ class Tab(QtWidgets.QWidget):
self.common, self.common,
"images/mode_new_tab_receive.png", "images/mode_new_tab_receive.png",
strings._("gui_new_tab_receive_button"), strings._("gui_new_tab_receive_button"),
strings._("gui_main_page_receive_button"),
) )
self.receive_button.clicked.connect(self.receive_mode_clicked) self.receive_button.clicked.connect(self.receive_mode_clicked)
@ -115,6 +140,7 @@ class Tab(QtWidgets.QWidget):
self.common, self.common,
"images/mode_new_tab_website.png", "images/mode_new_tab_website.png",
strings._("gui_new_tab_website_button"), strings._("gui_new_tab_website_button"),
strings._("gui_main_page_website_button"),
) )
self.website_button.clicked.connect(self.website_mode_clicked) self.website_button.clicked.connect(self.website_mode_clicked)
@ -122,6 +148,7 @@ class Tab(QtWidgets.QWidget):
self.common, self.common,
"images/mode_new_tab_chat.png", "images/mode_new_tab_chat.png",
strings._("gui_new_tab_chat_button"), strings._("gui_new_tab_chat_button"),
strings._("gui_main_page_chat_button"),
) )
self.chat_button.clicked.connect(self.chat_mode_clicked) self.chat_button.clicked.connect(self.chat_mode_clicked)
@ -143,8 +170,14 @@ class Tab(QtWidgets.QWidget):
new_tab_layout.addLayout(new_tab_bottom_layout) new_tab_layout.addLayout(new_tab_bottom_layout)
new_tab_layout.addStretch() new_tab_layout.addStretch()
new_tab_img_layout = QtWidgets.QHBoxLayout()
new_tab_img_layout.addWidget(self.image)
new_tab_img_layout.addStretch(1)
new_tab_img_layout.addLayout(new_tab_layout)
new_tab_img_layout.addStretch(2)
self.new_tab = QtWidgets.QWidget() self.new_tab = QtWidgets.QWidget()
self.new_tab.setLayout(new_tab_layout) self.new_tab.setLayout(new_tab_img_layout)
self.new_tab.show() self.new_tab.show()
# Layout # Layout

BIN
share/images/logo_text.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -188,6 +188,10 @@
"gui_new_tab_receive_button": "Receive Files", "gui_new_tab_receive_button": "Receive Files",
"gui_new_tab_website_button": "Host a Website", "gui_new_tab_website_button": "Host a Website",
"gui_new_tab_chat_button": "Chat Anonymously", "gui_new_tab_chat_button": "Chat Anonymously",
"gui_main_page_share_button": "Start Sharing",
"gui_main_page_receive_button": "Start Receiving",
"gui_main_page_website_button": "Start Hosting",
"gui_main_page_chat_button": "Start Chatting",
"gui_tab_name_share": "Share", "gui_tab_name_share": "Share",
"gui_tab_name_receive": "Receive", "gui_tab_name_receive": "Receive",
"gui_tab_name_website": "Website", "gui_tab_name_website": "Website",