Remove back button, and make TorConnectionWidget reset its progress in case it gets re-used

This commit is contained in:
Micah Lee 2021-12-18 17:37:50 -08:00
parent 576bee555f
commit a676551821
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 8 additions and 12 deletions

View File

@ -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()

View File

@ -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):