From a6765518217a00f7c2dc9c08b4b39a1ed72e68b0 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 18 Dec 2021 17:37:50 -0800 Subject: [PATCH] Remove back button, and make TorConnectionWidget reset its progress in case it gets re-used --- desktop/src/onionshare/connection_tab.py | 12 ------------ desktop/src/onionshare/tor_connection.py | 8 ++++++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/desktop/src/onionshare/connection_tab.py b/desktop/src/onionshare/connection_tab.py index b6dae138..73c0ce36 100644 --- a/desktop/src/onionshare/connection_tab.py +++ b/desktop/src/onionshare/connection_tab.py @@ -465,12 +465,6 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget): self.connect_button.clicked.connect(self._connect_clicked) self.connect_button.setFixedWidth(150) self.connect_button.setStyleSheet(common.gui.css["autoconnect_start_button"]) - self.back_button = QtWidgets.QPushButton( - strings._("gui_autoconnect_bridge_back") - ) - self.back_button.clicked.connect(self._back_clicked) - self.back_button.setFlat(True) - self.back_button.setStyleSheet(common.gui.css["autoconnect_configure_button"]) self.configure_button = QtWidgets.QPushButton( strings._("gui_autoconnect_configure") ) @@ -491,7 +485,6 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget): cta_layout = QtWidgets.QHBoxLayout() cta_layout.addWidget(self.connect_button) - cta_layout.addWidget(self.back_button) cta_layout.addWidget(self.configure_button) cta_layout.addStretch() cta_widget = QtWidgets.QWidget() @@ -514,14 +507,12 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget): def hide_buttons(self): self.connect_button.hide() - self.back_button.hide() self.configure_button.hide() self.progress.show() self.progress_label.show() def show_buttons(self): self.connect_button.show() - self.back_button.show() self.configure_button.show() self.progress.hide() self.progress_label.hide() @@ -558,8 +549,5 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget): self.country_combobox.setEnabled(False) self.connect_clicked.emit() - def _back_clicked(self): - self.back_clicked.emit() - def _open_tor_settings(self): self.open_tor_settings.emit() diff --git a/desktop/src/onionshare/tor_connection.py b/desktop/src/onionshare/tor_connection.py index 1f07242d..83422b3a 100644 --- a/desktop/src/onionshare/tor_connection.py +++ b/desktop/src/onionshare/tor_connection.py @@ -113,6 +113,7 @@ class TorConnectionWidget(QtWidgets.QWidget): def cancel_clicked(self): self.was_canceled = True self.fail.emit("") + self._reset() def wasCanceled(self): return self.was_canceled @@ -132,6 +133,7 @@ class TorConnectionWidget(QtWidgets.QWidget): self.progress.setValue(self.progress.maximum()) self.success.emit() + self._reset() def _canceled_connecting_to_tor(self): self.common.log("TorConnectionWidget", "_canceled_connecting_to_tor") @@ -140,11 +142,17 @@ class TorConnectionWidget(QtWidgets.QWidget): # Cancel connecting to Tor QtCore.QTimer.singleShot(1, self.cancel_clicked) + self._reset() def _error_connecting_to_tor(self, msg): self.common.log("TorConnectionWidget", "_error_connecting_to_tor") self.active = False self.fail.emit(msg) + self._reset() + + def _reset(self): + self.label.setText("") + self.progress.setValue(0) class TorConnectionThread(QtCore.QThread):