Merge pull request #770 from micahflee/history_ui

New UI to always show history
This commit is contained in:
Miguel Jacq 2018-09-20 13:21:38 +10:00 committed by GitHub
commit db73dbeb94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 14 additions and 46 deletions

View file

@ -78,7 +78,15 @@ class Mode(QtWidgets.QWidget):
# Layout
self.layout = QtWidgets.QVBoxLayout()
self.layout.addWidget(self.primary_action)
self.setLayout(self.layout)
# Hack to allow a minimum width on self.layout
min_width_widget = QtWidgets.QWidget()
min_width_widget.setMinimumWidth(450)
self.layout.addWidget(min_width_widget)
self.horizontal_layout_wrapper = QtWidgets.QHBoxLayout()
self.horizontal_layout_wrapper.addLayout(self.layout)
self.setLayout(self.horizontal_layout_wrapper)
def init(self):
"""

View file

@ -55,7 +55,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.setWindowTitle('OnionShare')
self.setWindowIcon(QtGui.QIcon(self.common.get_resource_path('images/logo.png')))
self.setMinimumWidth(450)
self.setMinimumWidth(850)
# Load settings
self.config = config
@ -205,9 +205,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.update_server_status_indicator()
# Wait 1ms for the event loop to finish, then adjust size
QtCore.QTimer.singleShot(1, self.adjustSize)
def share_mode_clicked(self):
if self.mode != self.MODE_SHARE:
self.common.log('OnionShareGui', 'share_mode_clicked')

View file

@ -46,19 +46,13 @@ class ReceiveMode(Mode):
self.server_status.web = self.web
self.server_status.update()
# Downloads
# Uploads
self.uploads = Uploads(self.common)
self.uploads_in_progress = 0
self.uploads_completed = 0
self.new_upload = False # For scrolling to the bottom of the uploads list
# 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/upload_window_gray.png')))
self.info_show_uploads.setCheckable(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(self.common.css['mode_info_label'])
@ -72,7 +66,6 @@ class ReceiveMode(Mode):
self.info_layout.addStretch()
self.info_layout.addWidget(self.info_in_progress_uploads_count)
self.info_layout.addWidget(self.info_completed_uploads_count)
self.info_layout.addWidget(self.info_show_uploads)
self.info_widget = QtWidgets.QWidget()
self.info_widget.setLayout(self.info_layout)
@ -86,6 +79,8 @@ class ReceiveMode(Mode):
# Layout
self.layout.insertWidget(0, self.receive_info)
self.layout.insertWidget(0, self.info_widget)
self.layout.addStretch()
self.horizontal_layout_wrapper.addWidget(self.uploads)
def get_stop_server_shutdown_timeout_text(self):
"""
@ -188,7 +183,6 @@ class ReceiveMode(Mode):
self.uploads_in_progress = 0
self.update_uploads_completed()
self.update_uploads_in_progress()
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/upload_window_gray.png')))
self.uploads.reset()
def update_uploads_completed(self):
@ -210,7 +204,6 @@ class ReceiveMode(Mode):
image = self.common.get_resource_path('images/share_in_progress_none.png')
else:
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_uploads_tooltip', True).format(self.uploads_in_progress))
@ -225,13 +218,3 @@ 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

@ -222,7 +222,6 @@ class Uploads(QtWidgets.QScrollArea):
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')))

View file

@ -79,12 +79,6 @@ class ShareMode(Mode):
self.info_label = QtWidgets.QLabel()
self.info_label.setStyleSheet(self.common.css['mode_info_label'])
self.info_show_downloads = QtWidgets.QToolButton()
self.info_show_downloads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_window_gray.png')))
self.info_show_downloads.setCheckable(True)
self.info_show_downloads.toggled.connect(self.downloads_toggled)
self.info_show_downloads.setToolTip(strings._('gui_downloads_window_tooltip', True))
self.info_in_progress_downloads_count = QtWidgets.QLabel()
self.info_in_progress_downloads_count.setStyleSheet(self.common.css['mode_info_label'])
@ -99,7 +93,6 @@ class ShareMode(Mode):
self.info_layout.addStretch()
self.info_layout.addWidget(self.info_in_progress_downloads_count)
self.info_layout.addWidget(self.info_completed_downloads_count)
self.info_layout.addWidget(self.info_show_downloads)
self.info_widget = QtWidgets.QWidget()
self.info_widget.setLayout(self.info_layout)
@ -116,6 +109,7 @@ class ShareMode(Mode):
# Layout
self.layout.insertLayout(0, self.file_selection)
self.layout.insertWidget(0, self.info_widget)
self.horizontal_layout_wrapper.addWidget(self.downloads)
# Always start with focus on file selection
self.file_selection.setFocus()
@ -315,16 +309,6 @@ class ShareMode(Mode):
# Resize window
self.adjustSize()
def downloads_toggled(self, checked):
"""
When the 'Show/hide downloads' button is toggled, show or hide the downloads window.
"""
self.common.log('ShareMode', 'toggle_downloads')
if checked:
self.downloads.show()
else:
self.downloads.hide()
def reset_info_counters(self):
"""
Set the info counters back to zero.
@ -333,7 +317,6 @@ class ShareMode(Mode):
self.downloads_in_progress = 0
self.update_downloads_completed()
self.update_downloads_in_progress()
self.info_show_downloads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_window_gray.png')))
self.downloads.reset()
def update_downloads_completed(self):
@ -355,7 +338,6 @@ class ShareMode(Mode):
image = self.common.get_resource_path('images/share_in_progress_none.png')
else:
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

@ -91,7 +91,6 @@ class Downloads(QtWidgets.QScrollArea):
self.setWindowTitle(strings._('gui_downloads', True))
self.setWidgetResizable(True)
self.setMaximumHeight(600)
self.setMinimumHeight(150)
self.setMinimumWidth(350)
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B