[Pkg-privacy-commits] [onionshare] 177/256: Added debug logging to OnionShareGui, SettingsDialog, TorConnectionDialog, and Alert objects
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:35 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 f90d49fa4b8b281ad0bd5b7a5680ca8f4d84f89c
Author: Micah Lee <micah at micahflee.com>
Date: Tue May 16 11:31:52 2017 -0700
Added debug logging to OnionShareGui, SettingsDialog, TorConnectionDialog, and Alert objects
---
onionshare_gui/alert.py | 2 ++
onionshare_gui/onionshare_gui.py | 20 ++++++++++++++++++++
onionshare_gui/settings_dialog.py | 21 ++++++++++++++++++++-
onionshare_gui/tor_connection_dialog.py | 4 ++++
4 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/onionshare_gui/alert.py b/onionshare_gui/alert.py
index a07c556..814ff78 100644
--- a/onionshare_gui/alert.py
+++ b/onionshare_gui/alert.py
@@ -27,6 +27,8 @@ class Alert(QtWidgets.QMessageBox):
"""
def __init__(self, message, icon=QtWidgets.QMessageBox.NoIcon, buttons=QtWidgets.QMessageBox.Ok, autostart=True):
super(Alert, self).__init__(None)
+ common.log('Alert', '__init__')
+
self.setWindowTitle("OnionShare")
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
self.setText(message)
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 84f3ab3..91ccc9e 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -46,6 +46,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
def __init__(self, onion, qtapp, app, filenames):
super(OnionShareGui, self).__init__()
+
+ common.log('OnionShareGui', '__init__')
+
self.onion = onion
self.qtapp = qtapp
self.app = app
@@ -146,6 +149,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
If the user cancels before Tor finishes connecting, ask if they want to
quit, or open settings.
"""
+ common.log('OnionShareGui', '_tor_connection_canceled')
+
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")
@@ -167,6 +172,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
The TorConnectionDialog wants to open the Settings dialog
"""
+ common.log('OnionShareGui', '_tor_connection_open_settings')
+
def open_settings():
SettingsDialog(self.onion, self.qtapp)
@@ -178,6 +185,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
Start the onionshare server. This uses multiple threads to start the Tor onion
server and the web app.
"""
+ common.log('OnionShareGui', 'start_server')
+
# First, load settings and configure
settings = Settings()
settings.load()
@@ -214,6 +223,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
Step 2 in starting the onionshare server. Zipping up files.
"""
+ common.log('OnionShareGui', 'start_server_step2')
+
# add progress bar to the status bar, indicating the crunching of files.
self._zip_progress_bar = ZipProgressBar(0)
self._zip_progress_bar.total_files_size = OnionShareGui._compute_total_size(
@@ -244,6 +255,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
Step 3 in starting the onionshare server. This displays the large filesize
warning, if applicable.
"""
+ common.log('OnionShareGui', 'start_server_step3')
+
# Remove zip progress bar
if self._zip_progress_bar is not None:
self.status_bar.removeWidget(self._zip_progress_bar)
@@ -258,6 +271,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
If there's an error when trying to start the onion service
"""
+ common.log('OnionShareGui', 'start_server_error')
+
Alert(error, QtWidgets.QMessageBox.Warning)
self.server_status.stop_server()
self.status_bar.clearMessage()
@@ -266,6 +281,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
Stop the onionshare server.
"""
+ common.log('OnionShareGui', 'stop_server')
+
if self.server_status.status != self.server_status.STATUS_STOPPED:
web.stop(self.app.port)
self.app.cleanup()
@@ -338,12 +355,14 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
When the URL gets copied to the clipboard, display this in the status bar.
"""
+ common.log('OnionShareGui', 'copy_url')
self.status_bar.showMessage(strings._('gui_copied_url', True), 2000)
def copy_hidservauth(self):
"""
When the stealth onion service HidServAuth gets copied to the clipboard, display this in the status bar.
"""
+ common.log('OnionShareGui', 'copy_hidservauth')
self.status_bar.showMessage(strings._('gui_copied_hidservauth', True), 2000)
def clear_message(self):
@@ -353,6 +372,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.status_bar.clearMessage()
def closeEvent(self, e):
+ common.log('OnionShareGui', 'closeEvent')
try:
if self.server_status.status != self.server_status.STATUS_STOPPED:
dialog = QtWidgets.QMessageBox()
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index d368fb4..fa2d6bf 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -33,6 +33,8 @@ class SettingsDialog(QtWidgets.QDialog):
"""
def __init__(self, onion, qtapp):
super(SettingsDialog, self).__init__()
+ common.log('SettingsDialog', '__init__')
+
self.onion = onion
self.qtapp = qtapp
@@ -283,6 +285,7 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Connection type bundled was toggled. If checked, hide authentication fields.
"""
+ common.log('SettingsDialog', 'connection_type_bundled_toggled')
if checked:
self.authenticate_group.hide()
self.connection_type_socks.hide()
@@ -291,6 +294,7 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Connection type automatic was toggled. If checked, hide authentication fields.
"""
+ common.log('SettingsDialog', 'connection_type_automatic_toggled')
if checked:
self.authenticate_group.hide()
self.connection_type_socks.hide()
@@ -300,6 +304,7 @@ class SettingsDialog(QtWidgets.QDialog):
Connection type control port was toggled. If checked, show extra fields
for Tor control address and port. If unchecked, hide those extra fields.
"""
+ common.log('SettingsDialog', 'connection_type_control_port_toggled')
if checked:
self.authenticate_group.show()
self.connection_type_control_port_extras.show()
@@ -313,6 +318,7 @@ class SettingsDialog(QtWidgets.QDialog):
Connection type socket file was toggled. If checked, show extra fields
for socket file. If unchecked, hide those extra fields.
"""
+ common.log('SettingsDialog', 'connection_type_socket_file_toggled')
if checked:
self.authenticate_group.show()
self.connection_type_socket_file_extras.show()
@@ -324,13 +330,14 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Authentication option no authentication was toggled.
"""
- pass
+ common.log('SettingsDialog', 'authenticate_no_auth_toggled')
def authenticate_password_toggled(self, checked):
"""
Authentication option password was toggled. If checked, show extra fields
for password auth. If unchecked, hide those extra fields.
"""
+ common.log('SettingsDialog', 'authenticate_password_toggled')
if checked:
self.authenticate_password_extras.show()
else:
@@ -341,6 +348,7 @@ class SettingsDialog(QtWidgets.QDialog):
Test Tor Settings button clicked. With the given settings, see if we can
successfully connect and authenticate to Tor.
"""
+ common.log('SettingsDialog', 'test_tor_clicked')
settings = self.settings_from_fields()
try:
@@ -374,6 +382,7 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Check for Updates button clicked. Manually force an update check.
"""
+ common.log('SettingsDialog', 'check_for_updates')
# Disable buttons
self._disable_buttons()
self.qtapp.processEvents()
@@ -408,6 +417,8 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Save button clicked. Save current settings to disk.
"""
+ common.log('SettingsDialog', 'save_clicked')
+
settings = self.settings_from_fields()
settings.save()
self.close()
@@ -416,12 +427,14 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Cancel button clicked.
"""
+ common.log('SettingsDialog', 'cancel_clicked')
self.close()
def settings_from_fields(self):
"""
Return a Settings object that's full of values from the settings dialog.
"""
+ common.log('SettingsDialog', 'settings_from_fields')
settings = Settings()
settings.load() # To get the last update timestamp
@@ -454,6 +467,8 @@ class SettingsDialog(QtWidgets.QDialog):
return settings
def _update_autoupdate_timestamp(self, autoupdate_timestamp):
+ common.log('SettingsDialog', '_update_autoupdate_timestamp')
+
if autoupdate_timestamp:
dt = datetime.datetime.fromtimestamp(autoupdate_timestamp)
last_checked = dt.strftime('%B %d, %Y %H:%M')
@@ -469,12 +484,16 @@ class SettingsDialog(QtWidgets.QDialog):
self._enable_buttons()
def _disable_buttons(self):
+ common.log('SettingsDialog', '_disable_buttons')
+
self.check_for_updates_button.setEnabled(False)
self.connection_type_test_button.setEnabled(False)
self.save_button.setEnabled(False)
self.cancel_button.setEnabled(False)
def _enable_buttons(self):
+ common.log('SettingsDialog', '_enable_buttons')
+
self.check_for_updates_button.setEnabled(True)
self.connection_type_test_button.setEnabled(True)
self.save_button.setEnabled(True)
diff --git a/onionshare_gui/tor_connection_dialog.py b/onionshare_gui/tor_connection_dialog.py
index 486f7b5..068175d 100644
--- a/onionshare_gui/tor_connection_dialog.py
+++ b/onionshare_gui/tor_connection_dialog.py
@@ -32,6 +32,8 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
def __init__(self, settings, onion):
super(TorConnectionDialog, self).__init__(None)
+ common.log('TorConnectionDialog', '__init__')
+
self.settings = settings
self.onion = onion
@@ -49,6 +51,8 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
self.setMinimumDuration(100)
def start(self):
+ common.log('TorConnectionDialog', 'start')
+
# If bundled tor, prepare to display Tor connection status
if self.settings.get('connection_type') == 'bundled':
tor_status_update = self.tor_status_update
--
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