Move owernship of the TorConnetionDialog objection from __init__.py into the OnionShareGUI class, and make it so when the Tor connection gets canceled, OnionShare quits

This commit is contained in:
Micah Lee 2017-05-14 18:30:45 -07:00
parent 162b53fbcd
commit f48e160816
4 changed files with 57 additions and 38 deletions

View file

@ -56,8 +56,12 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
self.setValue(0)
try:
self.onion.connect(self.settings, tor_status_update)
# Close the dialog after connecting
self.setValue(self.maximum())
except BundledTorCanceled as e:
self.close()
self.cancel()
except Exception as e:
print(e.args[0])
# TODO: Open settings to connect to Tor properly
@ -66,3 +70,6 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
def tor_status_update(self, progress, summary):
self.setValue(int(progress))
self.setLabelText("<strong>{}</strong><br>{}".format(strings._('connecting_to_tor', True), summary))
# Return False if the dialog was canceled
return not self.wasCanceled()