[Pkg-privacy-commits] [onionshare] 170/256: OnionShare connects fine when connection_type isn't bundled_tor, and it now displays errors and opens Settings when it can't connect to Tor
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:34 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 ad2c5e94b46cf09750bb3d30899e7dbd657b823d
Author: Micah Lee <micah at micahflee.com>
Date: Sun May 14 18:46:54 2017 -0700
OnionShare connects fine when connection_type isn't bundled_tor, and it now displays errors and opens Settings when it can't connect to Tor
---
onionshare_gui/onionshare_gui.py | 14 +++++++++++++-
onionshare_gui/tor_connection_dialog.py | 16 +++++++++++++---
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 60674a1..00c0aee 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -25,6 +25,7 @@ from onionshare.settings import Settings
from onionshare.onion import *
from .tor_connection_dialog import TorConnectionDialog
+from .settings_dialog import SettingsDialog
from .menu import Menu
from .file_selection import FileSelection
from .server_status import ServerStatus
@@ -59,6 +60,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
# Start the "Connecting to Tor" dialog, which calls onion.connect()
tor_con = TorConnectionDialog(self.settings, self.onion)
tor_con.canceled.connect(self._tor_connection_canceled)
+ tor_con.open_settings.connect(self._tor_connection_open_settings)
tor_con.start()
# Menu bar
@@ -146,9 +148,19 @@ class OnionShareGui(QtWidgets.QMainWindow):
def quit():
self.qtapp.quit()
- # Wait 1ms for the event loop to finish closing the TorConnectionDialog before quitting
+ # Wait 1ms for the event loop to finish closing the TorConnectionDialog
QtCore.QTimer.singleShot(1, quit)
+ def _tor_connection_open_settings(self):
+ """
+ The TorConnectionDialog wants to open the Settings dialog
+ """
+ def open_settings():
+ SettingsDialog(self.qtapp)
+
+ # Wait 1ms for the event loop to finish closing the TorConnectionDialog
+ QtCore.QTimer.singleShot(1, open_settings)
+
def start_server(self):
"""
Start the onionshare server. This uses multiple threads to start the Tor onion
diff --git a/onionshare_gui/tor_connection_dialog.py b/onionshare_gui/tor_connection_dialog.py
index ab5c658..96bb2f6 100644
--- a/onionshare_gui/tor_connection_dialog.py
+++ b/onionshare_gui/tor_connection_dialog.py
@@ -22,10 +22,14 @@ from PyQt5 import QtCore, QtWidgets, QtGui
from onionshare import strings, helpers
from onionshare.onion import *
+from .alert import Alert
+
class TorConnectionDialog(QtWidgets.QProgressDialog):
"""
Connecting to Tor dialog.
"""
+ open_settings = QtCore.pyqtSignal()
+
def __init__(self, settings, onion):
super(TorConnectionDialog, self).__init__(None)
self.settings = settings
@@ -62,10 +66,16 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
except BundledTorCanceled as e:
self.cancel()
+
except Exception as e:
- print(e.args[0])
- # TODO: Open settings to connect to Tor properly
- sys.exit()
+ # Cancel connecting to Tor
+ self.cancel()
+
+ # Display the exception in an alert box
+ Alert("{}\n\nTry adjusting how OnionShare connects to the Tor network in Settings.".format(e.args[0]), QtWidgets.QMessageBox.Warning)
+
+ # Open settings
+ self.open_settings.emit()
def tor_status_update(self, progress, summary):
self.setValue(int(progress))
--
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