From 7da1ac187b7991a4bdd0f8b0e2828bc31f0adcb7 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 6 Nov 2021 19:20:36 -0700 Subject: [PATCH] Remove sticky "Disconnected from Tor" message (patch thanks to @mig5) --- desktop/src/onionshare/tab_widget.py | 2 +- desktop/src/onionshare/tor_connection.py | 5 +++-- desktop/src/onionshare/tor_settings_tab.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/desktop/src/onionshare/tab_widget.py b/desktop/src/onionshare/tab_widget.py index da7d50bf..3579d21b 100644 --- a/desktop/src/onionshare/tab_widget.py +++ b/desktop/src/onionshare/tab_widget.py @@ -232,7 +232,7 @@ class TabWidget(QtWidgets.QTabWidget): return self.tor_settings_tab = TorSettingsTab( - self.common, self.current_tab_id, self.are_tabs_active() + self.common, self.current_tab_id, self.are_tabs_active(), self.status_bar ) self.tor_settings_tab.close_this_tab.connect(self.close_tor_settings_tab) self.tabs[self.current_tab_id] = self.tor_settings_tab diff --git a/desktop/src/onionshare/tor_connection.py b/desktop/src/onionshare/tor_connection.py index 1cfed2a8..2cc599c4 100644 --- a/desktop/src/onionshare/tor_connection.py +++ b/desktop/src/onionshare/tor_connection.py @@ -117,7 +117,6 @@ class TorConnectionDialog(QtWidgets.QProgressDialog): def _connected_to_tor(self): self.common.log("TorConnectionDialog", "_connected_to_tor") self.active = False - # Close the dialog after connecting self.setValue(self.maximum()) @@ -166,11 +165,12 @@ class TorConnectionWidget(QtWidgets.QWidget): success = QtCore.Signal() fail = QtCore.Signal(str) - def __init__(self, common): + def __init__(self, common, status_bar): super(TorConnectionWidget, self).__init__(None) self.common = common self.common.log("TorConnectionWidget", "__init__") + self.status_bar = status_bar self.label = QtWidgets.QLabel(strings._("connecting_to_tor")) self.label.setAlignment(QtCore.Qt.AlignHCenter) @@ -245,6 +245,7 @@ class TorConnectionWidget(QtWidgets.QWidget): def _connected_to_tor(self): self.common.log("TorConnectionWidget", "_connected_to_tor") self.active = False + self.status_bar.clearMessage() # Close the dialog after connecting self.progress.setValue(self.progress.maximum()) diff --git a/desktop/src/onionshare/tor_settings_tab.py b/desktop/src/onionshare/tor_settings_tab.py index 7ef8d850..85645ca0 100644 --- a/desktop/src/onionshare/tor_settings_tab.py +++ b/desktop/src/onionshare/tor_settings_tab.py @@ -41,12 +41,13 @@ class TorSettingsTab(QtWidgets.QWidget): close_this_tab = QtCore.Signal() - def __init__(self, common, tab_id, are_tabs_active): + def __init__(self, common, tab_id, are_tabs_active, status_bar): super(TorSettingsTab, self).__init__() self.common = common self.common.log("TorSettingsTab", "__init__") + self.status_bar = status_bar self.meek = Meek(common, get_tor_paths=self.common.gui.get_tor_paths) self.system = platform.system() @@ -327,7 +328,7 @@ class TorSettingsTab(QtWidgets.QWidget): columns_wrapper.setLayout(columns_layout) # Tor connection widget - self.tor_con = TorConnectionWidget(self.common) + self.tor_con = TorConnectionWidget(self.common, self.status_bar) self.tor_con.success.connect(self.tor_con_success) self.tor_con.fail.connect(self.tor_con_fail) self.tor_con.hide()