From 5c84c277da45d576db10ba7cf8f2a4301d9a6e3d Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sat, 23 Dec 2017 16:43:58 +1100 Subject: [PATCH] Don't show alert dialogs when Tor disconnects - just display in statusbar and stop any active share. --- onionshare_gui/onionshare_gui.py | 10 +++++----- share/locale/en.json | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index a5efa743..7c44b769 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -176,7 +176,6 @@ class OnionShareGui(QtWidgets.QMainWindow): quit, or open settings. """ common.log('OnionShareGui', '_tor_connection_canceled') - self.timer.stop() def ask(): a = Alert(strings._('gui_tor_connection_ask', True), QtWidgets.QMessageBox.Question, buttons=QtWidgets.QMessageBox.NoButton, autostart=False) @@ -223,8 +222,10 @@ class OnionShareGui(QtWidgets.QMainWindow): # We might've stopped the main requests timer if a Tor connection failed. # If we've reloaded settings, we probably succeeded in obtaining a new # connection. If so, restart the timer. - if not self.timer.isActive(): - self.timer.start() + if self.onion.is_authenticated(): + if not self.timer.isActive(): + self.timer.start() + self.status_bar.clearMessage() d = SettingsDialog(self.onion, self.qtapp, self.config) d.settings_saved.connect(reload_settings) @@ -401,8 +402,7 @@ class OnionShareGui(QtWidgets.QMainWindow): self.timer.stop() if self.server_status.status != self.server_status.STATUS_STOPPED: self.server_status.stop_server() - self.status_bar.clearMessage() - self._tor_connection_canceled() + self.status_bar.showMessage(strings._('gui_tor_connection_lost', True)) # scroll to the bottom of the dl progress bar log pane # if a new download has been added diff --git a/share/locale/en.json b/share/locale/en.json index 344736fc..abd734c9 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -114,11 +114,12 @@ "update_error_check_error": "Error checking for updates: Maybe you're not connected to Tor, or maybe the OnionShare website is down.", "update_error_invalid_latest_version": "Error checking for updates: The OnionShare website responded saying the latest version is '{}', but that doesn't appear to be a valid version string.", "update_not_available": "You are running the latest version of OnionShare.", - "gui_tor_connection_ask": "Tor isn't running.\n\nWould you like to open OnionShare settings to troubleshoot connecting to Tor?", + "gui_tor_connection_ask": "Would you like to open OnionShare settings to troubleshoot connecting to Tor?", "gui_tor_connection_ask_open_settings": "Open Settings", "gui_tor_connection_ask_quit": "Quit", "gui_tor_connection_error_settings": "Try adjusting how OnionShare connects to the Tor network in Settings.", "gui_tor_connection_canceled": "OnionShare cannot connect to Tor.\n\nMake sure you're connected to the internet, then re-open OnionShare to configure the Tor connection.", + "gui_tor_connection_lost": "Disconnected from Tor.", "gui_server_started_after_timeout": "The server started after your chosen auto-timeout.\nPlease start a new share.", "gui_server_timeout_expired": "The chosen timeout has already expired.\nPlease update the timeout and then you may start sharing.", "share_via_onionshare": "Share via OnionShare"