Rename some images to reuse in ReceiveMode, and make new upload window button images

This commit is contained in:
Micah Lee 2018-05-04 17:57:30 -07:00
parent c77eba7f23
commit be36f3a4b6
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
10 changed files with 52 additions and 18 deletions

View File

@ -54,10 +54,10 @@ class ReceiveMode(Mode):
# Information about share, and show uploads button
self.info_show_uploads = QtWidgets.QToolButton()
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_window_gray.png')))
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/upload_window_gray.png')))
self.info_show_uploads.setCheckable(True)
#self.info_show_uploads.toggled.connect(self.downloads_toggled)
self.info_show_uploads.setToolTip(strings._('gui_downloads_window_tooltip', True))
self.info_show_uploads.toggled.connect(self.uploads_toggled)
self.info_show_uploads.setToolTip(strings._('gui_uploads_window_tooltip', True))
self.info_in_progress_uploads_count = QtWidgets.QLabel()
self.info_in_progress_uploads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
@ -146,9 +146,9 @@ class ReceiveMode(Mode):
Update the 'Downloads completed' info widget.
"""
if self.uploads_completed == 0:
image = self.common.get_resource_path('images/download_completed_none.png')
image = self.common.get_resource_path('images/share_completed_none.png')
else:
image = self.common.get_resource_path('images/download_completed.png')
image = self.common.get_resource_path('images/share_completed.png')
self.info_completed_uploads_count.setText('<img src="{0:s}" /> {1:d}'.format(image, self.uploads_completed))
self.info_completed_uploads_count.setToolTip(strings._('info_completed_downloads_tooltip', True).format(self.uploads_completed))
@ -157,10 +157,10 @@ class ReceiveMode(Mode):
Update the 'Downloads in progress' info widget.
"""
if self.uploads_in_progress == 0:
image = self.common.get_resource_path('images/download_in_progress_none.png')
image = self.common.get_resource_path('images/share_in_progress_none.png')
else:
image = self.common.get_resource_path('images/download_in_progress.png')
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_window_green.png')))
image = self.common.get_resource_path('images/share_in_progress.png')
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/upload_window_green.png')))
self.info_in_progress_uploads_count.setText('<img src="{0:s}" /> {1:d}'.format(image, self.uploads_in_progress))
self.info_in_progress_uploads_count.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(self.uploads_in_progress))
@ -175,3 +175,13 @@ class ReceiveMode(Mode):
# Resize window
self.adjustSize()
def uploads_toggled(self, checked):
"""
When the 'Show/hide uploads' button is toggled, show or hide the uploads window.
"""
self.common.log('ReceiveMode', 'toggle_uploads')
if checked:
self.uploads.show()
else:
self.uploads.hide()

View File

@ -21,16 +21,37 @@ from PyQt5 import QtCore, QtWidgets, QtGui
from onionshare import strings
class Uploads(QtWidgets.QWidget):
class Uploads(QtWidgets.QScrollArea):
"""
The uploads chunk of the GUI. This lists all of the active upload
progress bars, as well as information about each upload.
"""
def __init__(self, common):
super(Uploads, self).__init__()
self.common = common
self.layout = QtWidgets.QVBoxLayout()
self.layout.addStretch()
self.setLayout(self.layout)
self.uploads = {}
self.setWindowTitle(strings._('gui_uploads', True))
self.setWidgetResizable(True)
self.setMaximumHeight(600)
self.setMinimumHeight(150)
self.setMinimumWidth(350)
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
self.setWindowFlags(QtCore.Qt.Sheet | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.CustomizeWindowHint)
self.vbar = self.verticalScrollBar()
uploads_label = QtWidgets.QLabel(strings._('gui_uploads', True))
uploads_label.setStyleSheet('QLabel { font-weight: bold; font-size 14px; text-align: center; }')
self.no_uploads_label = QtWidgets.QLabel(strings._('gui_no_uploads', True))
self.uploads_layout = QtWidgets.QVBoxLayout()
widget = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout()
layout.addWidget(uploads_label)
layout.addWidget(self.no_uploads_label)
layout.addLayout(self.uploads_layout)
layout.addStretch()
widget.setLayout(layout)
self.setWidget(widget)

View File

@ -345,9 +345,9 @@ class ShareMode(Mode):
Update the 'Downloads completed' info widget.
"""
if self.downloads_completed == 0:
image = self.common.get_resource_path('images/download_completed_none.png')
image = self.common.get_resource_path('images/share_completed_none.png')
else:
image = self.common.get_resource_path('images/download_completed.png')
image = self.common.get_resource_path('images/share_completed.png')
self.info_completed_downloads_count.setText('<img src="{0:s}" /> {1:d}'.format(image, self.downloads_completed))
self.info_completed_downloads_count.setToolTip(strings._('info_completed_downloads_tooltip', True).format(self.downloads_completed))
@ -356,9 +356,9 @@ class ShareMode(Mode):
Update the 'Downloads in progress' info widget.
"""
if self.downloads_in_progress == 0:
image = self.common.get_resource_path('images/download_in_progress_none.png')
image = self.common.get_resource_path('images/share_in_progress_none.png')
else:
image = self.common.get_resource_path('images/download_in_progress.png')
image = self.common.get_resource_path('images/share_in_progress.png')
self.info_show_downloads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_window_green.png')))
self.info_in_progress_downloads_count.setText('<img src="{0:s}" /> {1:d}'.format(image, self.downloads_in_progress))
self.info_in_progress_downloads_count.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(self.downloads_in_progress))

View File

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 646 B

View File

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 437 B

View File

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 638 B

View File

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

View File

@ -183,5 +183,8 @@
"systray_close_server_message": "A user closed the server",
"systray_page_loaded_title": "OnionShare Page Loaded",
"systray_download_page_loaded_message": "A user loaded the download page",
"systray_upload_page_loaded_message": "A user loaded the upload page"
"systray_upload_page_loaded_message": "A user loaded the upload page",
"gui_uploads": "Upload History",
"gui_uploads_window_tooltip": "Show/hide uploads",
"gui_no_uploads": "No uploads yet."
}