[Pkg-privacy-commits] [onionshare] 129/256: Add Tor connection status to the main window status bar
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:26 UTC 2017
This is an automated email from the git hooks/post-receive script.
ulrike pushed a commit to branch master
in repository onionshare.
commit 1fa88c3d07307311ac8f3a89764b428c80948df5
Author: Micah Lee <micah at micahflee.com>
Date: Thu Apr 13 23:08:25 2017 -0700
Add Tor connection status to the main window status bar
---
onionshare/__init__.py | 4 ++--
onionshare/onion.py | 1 +
onionshare_gui/__init__.py | 13 +++++++++++--
onionshare_gui/settings_dialog.py | 4 ++--
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/onionshare/__init__.py b/onionshare/__init__.py
index e0608b6..29bc0ed 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 2bcb79b..8ac03dd 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 a1a7ea2..5e2617d 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 749fed4..74c7039 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('<strong>{}</strong><br>{}'.format(strings._('connecting_to_tor'), message))
+ self.tor_status.setText('<strong>{}</strong><br>{}'.format(strings._('connecting_to_tor', True), message))
self.qtapp.processEvents()
if 'Done' in message:
self.tor_status.hide()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git
More information about the Pkg-privacy-commits
mailing list