Make the "download page loaded" and "upload page loaded" messages displayed as systray notifications instead of in the status bar, and make it work for Receive Mode

This commit is contained in:
Micah Lee 2018-04-29 16:41:05 -07:00
parent 4f89082f18
commit 9a076635c5
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
5 changed files with 15 additions and 11 deletions

View File

@ -266,6 +266,8 @@ class Web(object):
"""
def index_logic():
self.add_request(self.REQUEST_LOAD, request.path)
r = make_response(render_template(
'receive.html',
slug=self.slug,

View File

@ -303,7 +303,8 @@ class Mode(QtWidgets.QWidget):
"""
Handle REQUEST_RATE_LIMIT event.
"""
pass
self.stop_server()
Alert(self.common, strings._('error_rate_limit'), QtWidgets.QMessageBox.Critical)
def handle_request_progress(self, event):
"""

View File

@ -93,6 +93,12 @@ class ReceiveMode(Mode):
self.starting_server_step3.emit()
self.start_server_finished.emit()
def handle_request_load(self, event):
"""
Handle REQUEST_LOAD event.
"""
self.system_tray.showMessage(strings._('systray_page_loaded_title', True), strings._('systray_upload_page_loaded_message', True))
def handle_request_close_server(self, event):
"""
Handle REQUEST_CLOSE_SERVER event.

View File

@ -244,7 +244,7 @@ class ShareMode(Mode):
"""
Handle REQUEST_LOAD event.
"""
self.status_bar.showMessage(strings._('download_page_loaded', True))
self.system_tray.showMessage(strings._('systray_page_loaded_title', True), strings._('systray_download_page_loaded_message', True))
def handle_request_download(self, event):
"""
@ -258,13 +258,6 @@ class ShareMode(Mode):
self.system_tray.showMessage(strings._('systray_download_started_title', True), strings._('systray_download_started_message', True))
def handle_request_rate_limit(self, event):
"""
Handle REQUEST_RATE_LIMIT event.
"""
self.stop_server()
Alert(self.common, strings._('error_rate_limit'), QtWidgets.QMessageBox.Critical)
def handle_request_progress(self, event):
"""
Handle REQUEST_PROGRESS event.

View File

@ -14,7 +14,6 @@
"not_a_readable_file": "{0:s} is not a readable file.",
"no_filenames": "You must specify a list of files to share.",
"no_available_port": "Could not start the Onion service as there was no available port.",
"download_page_loaded": "Download page loaded",
"other_page_loaded": "Address loaded",
"close_on_timeout": "Stopped because timer expired",
"closing_automatically": "Stopped because download finished",
@ -181,5 +180,8 @@
"gui_settings_receive_allow_receiver_shutdown_checkbox": "Allow people who upload files to you to stop Receive Mode for you",
"gui_settings_receive_public_mode_checkbox": "Receive Mode is open to the public\n(don't try to prevent people from guessing the OnionShare address)",
"systray_close_server_title": "OnionShare Server Closed",
"systray_close_server_message": "The user closed the server"
"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"
}