[Pkg-privacy-commits] [onionshare] 244/256: Reload Settings whenever the settings get saved in SettingsDialog

Ulrike Uhlig ulrike at moszumanska.debian.org
Fri May 26 12:53:50 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 5846b06478994caa71b1fffe43574a27ef064563
Author: Micah Lee <micah at micahflee.com>
Date:   Mon May 22 17:08:05 2017 -0700

    Reload Settings whenever the settings get saved in SettingsDialog
---
 onionshare_gui/onionshare_gui.py  | 10 +++++++++-
 onionshare_gui/settings_dialog.py |  7 ++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index ffcb120..46356e2 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 f2a8027..71fc277 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):

-- 
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