Hide Receive Files button while share server is active

This commit is contained in:
Micah Lee 2018-04-24 08:51:39 -07:00
parent bda82bc7a0
commit a232cfdbde
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
2 changed files with 12 additions and 8 deletions

View file

@ -151,7 +151,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.share_mode.server_status.button_clicked.connect(self.clear_message)
self.share_mode.server_status.url_copied.connect(self.copy_url)
self.share_mode.server_status.hidservauth_copied.connect(self.copy_hidservauth)
self.share_mode.set_server_active.connect(self.set_server_active)
self.share_mode.set_share_server_active.connect(self.set_share_server_active)
self.receive_mode = ReceiveMode(self.common)
self.update_mode_switcher()
@ -174,7 +174,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.show()
# The server isn't active yet
self.set_server_active(False)
self.set_share_server_active(False)
# Create the timer
self.timer = QtCore.QTimer()
@ -462,14 +462,18 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
self.status_bar.clearMessage()
def set_server_active(self, active):
def set_share_server_active(self, active):
"""
Disable the Settings button while an OnionShare server is active.
Disable the Settings and Receive Files buttons while an Share Files server is active.
"""
if active:
self.settings_button.hide()
self.share_mode_button.show()
self.receive_mode_button.hide()
else:
self.settings_button.show()
self.share_mode_button.show()
self.receive_mode_button.show()
# Disable settings menu action when server is active
self.settingsAction.setEnabled(not active)

View file

@ -41,7 +41,7 @@ class ShareMode(QtWidgets.QWidget):
starting_server_step2 = QtCore.pyqtSignal()
starting_server_step3 = QtCore.pyqtSignal()
starting_server_error = QtCore.pyqtSignal(str)
set_server_active = QtCore.pyqtSignal(bool)
set_share_server_active = QtCore.pyqtSignal(bool)
def __init__(self, common, filenames, qtapp, app, web, status_bar, server_share_status_label):
super(ShareMode, self).__init__()
@ -195,7 +195,7 @@ class ShareMode(QtWidgets.QWidget):
"""
self.common.log('ShareMode', 'start_server')
self.set_server_active.emit(True)
self.set_share_server_active.emit(True)
self.app.set_stealth(self.common.settings.get('use_stealth'))
@ -307,7 +307,7 @@ class ShareMode(QtWidgets.QWidget):
"""
self.common.log('ShareMode', 'start_server_error')
self.set_server_active.emit(False)
self.set_share_server_active.emit(False)
Alert(self.common, error, QtWidgets.QMessageBox.Warning)
self.server_status.stop_server()
@ -349,7 +349,7 @@ class ShareMode(QtWidgets.QWidget):
self.update_downloads_in_progress(0)
self.file_selection.file_list.adjustSize()
self.set_server_active.emit(False)
self.set_share_server_active.emit(False)
self.stop_server_finished.emit()
def downloads_toggled(self, checked):