Make receive mode info widget show when server is stated, hide when it is not started

This commit is contained in:
Micah Lee 2018-05-04 15:53:34 -07:00
parent 3cdd546bd3
commit ed28fdf123
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 41 additions and 24 deletions

View File

@ -51,6 +51,8 @@ class Mode(QtWidgets.QWidget):
self.filenames = filenames
self.setMinimumWidth(450)
# The web object gets created in init()
self.web = None

View File

@ -37,8 +37,9 @@ class ReceiveMode(Mode):
# Server status
self.server_status.set_mode('receive')
#self.server_status.server_stopped.connect(self.update_primary_action)
#self.server_status.server_canceled.connect(self.update_primary_action)
self.server_status.server_started_finished.connect(self.update_primary_action)
self.server_status.server_stopped.connect(self.update_primary_action)
self.server_status.server_canceled.connect(self.update_primary_action)
# Tell server_status about web, then update
self.server_status.web = self.web
@ -161,3 +162,15 @@ class ReceiveMode(Mode):
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_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))
def update_primary_action(self):
self.common.log('ReceiveMode', 'update_primary_action')
# Show the info widget when the server is active
if self.server_status.status == self.server_status.STATUS_STARTED:
self.info_widget.show()
else:
self.info_widget.hide()
# Resize window
self.adjustSize()

View File

@ -29,6 +29,7 @@ class ServerStatus(QtWidgets.QWidget):
The server status chunk of the GUI.
"""
server_started = QtCore.pyqtSignal()
server_started_finished = QtCore.pyqtSignal()
server_stopped = QtCore.pyqtSignal()
server_canceled = QtCore.pyqtSignal()
button_clicked = QtCore.pyqtSignal()
@ -268,6 +269,7 @@ class ServerStatus(QtWidgets.QWidget):
self.status = self.STATUS_STARTED
self.copy_url()
self.update()
self.server_started_finished.emit()
def stop_server(self):
"""