summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2017-05-22 17:08:05 -0700
committerMicah Lee <micah@micahflee.com>2017-05-22 17:08:05 -0700
commit5846b06478994caa71b1fffe43574a27ef064563 (patch)
tree8319a52430fa30b858a4cbfa8cee8f91f6fe68cc
parente626a410f3d383d9a1ccaf2662313355ab039c6b (diff)
downloadonionshare-5846b06478994caa71b1fffe43574a27ef064563.tar.gz
onionshare-5846b06478994caa71b1fffe43574a27ef064563.zip
Reload Settings whenever the settings get saved in SettingsDialog
-rw-r--r--onionshare_gui/onionshare_gui.py10
-rw-r--r--onionshare_gui/settings_dialog.py7
2 files changed, 13 insertions, 4 deletions
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index ffcb1202..46356e2b 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -206,7 +206,15 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
Open the SettingsDialog.
"""
- SettingsDialog(self.onion, self.qtapp)
+ common.log('OnionShareGui', 'open_settings')
+
+ def reload_settings():
+ common.log('OnionShareGui', 'open_settings', 'settings have changed, reloading')
+ self.settings.load()
+
+ d = SettingsDialog(self.onion, self.qtapp)
+ d.settings_saved.connect(reload_settings)
+ d.exec_()
def start_server(self):
"""
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index f2a80272..71fc277a 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -32,6 +32,8 @@ class SettingsDialog(QtWidgets.QDialog):
"""
Settings dialog.
"""
+ settings_saved = QtCore.pyqtSignal()
+
def __init__(self, onion, qtapp):
super(SettingsDialog, self).__init__()
common.log('SettingsDialog', '__init__')
@@ -312,9 +314,6 @@ class SettingsDialog(QtWidgets.QDialog):
self.authenticate_password_radio.setChecked(True)
self.authenticate_password_extras_password.setText(self.old_settings.get('auth_password'))
- # Show the dialog
- self.exec_()
-
def connection_type_bundled_toggled(self, checked):
"""
Connection type bundled was toggled. If checked, hide authentication fields.
@@ -493,9 +492,11 @@ class SettingsDialog(QtWidgets.QDialog):
common.log('SettingsDialog', 'save_clicked', 'Onion done rebooting, connected to Tor: {}'.format(self.onion.connected_to_tor))
if self.onion.connected_to_tor and not tor_con.wasCanceled():
+ self.settings_saved.emit()
self.close()
else:
+ self.settings_saved.emit()
self.close()
def cancel_clicked(self):