[Pkg-privacy-commits] [onionshare] 171/256: Now when you cancel connecting to Tor, it prompts you if you want to quit or open settings
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 58f70b1d9bcf4521db48fbde89c6ce3e97c194e0
Author: Micah Lee <micah at micahflee.com>
Date: Sun May 14 19:21:33 2017 -0700
Now when you cancel connecting to Tor, it prompts you if you want to quit or open settings
---
onionshare_gui/alert.py | 7 +++++--
onionshare_gui/onionshare_gui.py | 20 ++++++++++++++++----
onionshare_gui/tor_connection_dialog.py | 3 +--
share/locale/en.json | 2 +-
4 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/onionshare_gui/alert.py b/onionshare_gui/alert.py
index 5dee4d3..2af7daf 100644
--- a/onionshare_gui/alert.py
+++ b/onionshare_gui/alert.py
@@ -25,10 +25,13 @@ class Alert(QtWidgets.QMessageBox):
"""
An alert box dialog.
"""
- def __init__(self, message, icon=QtWidgets.QMessageBox.NoIcon):
+ def __init__(self, message, icon=QtWidgets.QMessageBox.NoIcon, buttons=QtWidgets.QMessageBox.Ok, autostart=True):
super(Alert, self).__init__(None)
self.setWindowTitle("OnionShare")
self.setWindowIcon(QtGui.QIcon(helpers.get_resource_path('images/logo.png')))
self.setText(message)
self.setIcon(icon)
- self.exec_()
+ self.setStandardButtons(buttons)
+
+ if autostart:
+ self.exec_()
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 00c0aee..dc5bdc7 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -143,13 +143,25 @@ class OnionShareGui(QtWidgets.QMainWindow):
def _tor_connection_canceled(self):
"""
- If the user cancels before Tor finishes connecting, quit.
+ If the user cancels before Tor finishes connecting, ask if they want to
+ quit, or open settings.
"""
- def quit():
- self.qtapp.quit()
+ def quit_settings_dialog():
+ a = Alert("Would you like to open OnionShare settings to troubleshoot connecting to Tor?", QtWidgets.QMessageBox.Question, buttons=QtWidgets.QMessageBox.NoButton, autostart=False)
+ settings_button = QtWidgets.QPushButton("Open Settings")
+ quit_button = QtWidgets.QPushButton("Quit")
+ a.addButton(settings_button, QtWidgets.QMessageBox.AcceptRole)
+ a.addButton(quit_button, QtWidgets.QMessageBox.RejectRole)
+ a.setDefaultButton(settings_button)
+ a.exec_()
+
+ if a.clickedButton() == settings_button:
+ SettingsDialog(self.qtapp)
+ else:
+ self.qtapp.quit()
# Wait 1ms for the event loop to finish closing the TorConnectionDialog
- QtCore.QTimer.singleShot(1, quit)
+ QtCore.QTimer.singleShot(1, quit_settings_dialog)
def _tor_connection_open_settings(self):
"""
diff --git a/onionshare_gui/tor_connection_dialog.py b/onionshare_gui/tor_connection_dialog.py
index 96bb2f6..ee1a9b2 100644
--- a/onionshare_gui/tor_connection_dialog.py
+++ b/onionshare_gui/tor_connection_dialog.py
@@ -42,7 +42,6 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
# Label
self.setLabelText(strings._('connecting_to_tor', True))
- self.setCancelButtonText(strings._('gui_tor_connection_exit', True))
# Progress bar ticks from 0 to 100
self.setRange(0, 100)
@@ -72,7 +71,7 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
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)
+ Alert("{}\n\n{}".format(e.args[0], strings._('gui_tor_connection_error_settings', True)), QtWidgets.QMessageBox.Warning)
# Open settings
self.open_settings.emit()
diff --git a/share/locale/en.json b/share/locale/en.json
index acb4f73..9608545 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -101,5 +101,5 @@
"update_error_sockshttp": "Error checking for updates: Connected to Tor, but can't load the update HTTP request.",
"update_error_invalid_latest_version": "Error checking for updates: The OnionShare website responded saying the latest version is '{}', but that doesn't appear to be a valid version string.",
"update_not_available": "You are running the latest version of OnionShare.",
- "gui_tor_connection_exit": "Exit"
+ "gui_tor_connection_error_settings": "Try adjusting how OnionShare connects to the Tor network in Settings."
}
--
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