diff --git a/onionshare/__init__.py b/onionshare/__init__.py
index e0608b6d..29bc0ed4 100644
--- a/onionshare/__init__.py
+++ b/onionshare/__init__.py
@@ -73,7 +73,7 @@ class OnionShare(object):
self.port = tmpsock.getsockname()[1]
tmpsock.close()
- def start_onion_service(self):
+ def start_onion_service(self, bundled_tor_func=None):
"""
Start the onionshare onion service.
"""
@@ -85,7 +85,7 @@ class OnionShare(object):
return
if not self.onion:
- self.onion = Onion(self.stealth)
+ self.onion = Onion(self.stealth, bundled_tor_func=bundled_tor_func)
self.onion_host = self.onion.start(self.port)
diff --git a/onionshare/onion.py b/onionshare/onion.py
index 2bcb79b6..8ac03dd6 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -356,3 +356,4 @@ class Onion(object):
# Stop tor process
if self.tor_proc:
self.tor_proc.terminate()
+ self.tor_proc = None
diff --git a/onionshare_gui/__init__.py b/onionshare_gui/__init__.py
index a1a7ea26..5e2617da 100644
--- a/onionshare_gui/__init__.py
+++ b/onionshare_gui/__init__.py
@@ -171,9 +171,18 @@ class OnionShareGui(QtWidgets.QMainWindow):
# start the onion service in a new thread
def start_onion_service(self):
- self.status_bar.showMessage(strings._('gui_starting_server1', True))
try:
- self.app.start_onion_service()
+ # Show Tor connection status if connection type is bundled tor
+ if settings.get('connection_type') == 'bundled':
+ def bundled_tor_func(message):
+ self.status_bar.showMessage(message)
+ if 'Done' in message:
+ self.status_bar.showMessage(strings._('gui_starting_server1', True))
+ else:
+ self.status_bar.showMessage(strings._('gui_starting_server1', True))
+ bundled_tor_func = None
+
+ self.app.start_onion_service(bundled_tor_func)
self.starting_server_step2.emit()
except (onionshare.onion.TorTooOld, onionshare.onion.TorErrorInvalidSetting, onionshare.onion.TorErrorAutomatic, onionshare.onion.TorErrorSocketPort, onionshare.onion.TorErrorSocketFile, onionshare.onion.TorErrorMissingPassword, onionshare.onion.TorErrorUnreadableCookieFile, onionshare.onion.TorErrorAuthError, onionshare.onion.TorErrorProtocolError) as e:
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index 749fed48..74c70391 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -286,14 +286,14 @@ class SettingsDialog(QtWidgets.QDialog):
settings = self.settings_from_fields()
try:
- # Create dialog for showing Tor connection status
+ # Show Tor connection status if connection type is bundled tor
if settings.get('connection_type') == 'bundled':
self.tor_status.show()
self.test_button.setEnabled(False)
self.save_button.setEnabled(False)
self.cancel_button.setEnabled(False)
def bundled_tor_func(message):
- self.tor_status.setText('{}
{}'.format(strings._('connecting_to_tor'), message))
+ self.tor_status.setText('{}
{}'.format(strings._('connecting_to_tor', True), message))
self.qtapp.processEvents()
if 'Done' in message:
self.tor_status.hide()