From 89e341c8ec2bdce41444207d32b5c22d4f6a6d73 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sat, 14 Jul 2018 16:19:16 +1000 Subject: [PATCH] #707 Hide/show the primary action in Receive Mode when tor connection is lost/regained --- onionshare_gui/onionshare_gui.py | 2 ++ onionshare_gui/receive_mode/__init__.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index ad5dee88..6d52ed01 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -308,6 +308,7 @@ class OnionShareGui(QtWidgets.QMainWindow): if not self.timer.isActive(): self.timer.start(500) self.share_mode.on_reload_settings() + self.receive_mode.on_reload_settings() self.status_bar.clearMessage() # If we switched off the shutdown timeout setting, ensure the widget is hidden. @@ -351,6 +352,7 @@ class OnionShareGui(QtWidgets.QMainWindow): self.system_tray.showMessage(strings._('gui_tor_connection_lost', True), strings._('gui_tor_connection_error_settings', True)) self.share_mode.handle_tor_broke() + self.receive_mode.handle_tor_broke() # Process events from the web object if self.mode == self.MODE_SHARE: diff --git a/onionshare_gui/receive_mode/__init__.py b/onionshare_gui/receive_mode/__init__.py index 90100efa..623d3986 100644 --- a/onionshare_gui/receive_mode/__init__.py +++ b/onionshare_gui/receive_mode/__init__.py @@ -123,6 +123,7 @@ class ReceiveMode(Mode): """ Connection to Tor broke. """ + self.primary_action.hide() self.info_widget.hide() def handle_request_load(self, event): @@ -166,6 +167,13 @@ class ReceiveMode(Mode): """ self.uploads.finished(event["data"]["id"]) + def on_reload_settings(self): + """ + We should be ok to re-enable the 'Start Receive Mode' button now. + """ + self.primary_action.show() + self.info_widget.show() + def reset_info_counters(self): """ Set the info counters back to zero.