From 555ae9114f9fe43385ab3eb29f4ea11ac33e3459 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 27 Oct 2019 18:48:25 -0700 Subject: [PATCH] Make checking the persistent checkbox update the mode_settings dict, so closing tabs will catch that it's persistent --- onionshare_gui/tab/mode/__init__.py | 2 +- onionshare_gui/tab/mode/mode_settings.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/onionshare_gui/tab/mode/__init__.py b/onionshare_gui/tab/mode/__init__.py index 13cbd520..8018a4eb 100644 --- a/onionshare_gui/tab/mode/__init__.py +++ b/onionshare_gui/tab/mode/__init__.py @@ -72,7 +72,7 @@ class Mode(QtWidgets.QWidget): self.header_label.setStyleSheet(self.common.gui.css["mode_header_label"]) self.header_label.setAlignment(QtCore.Qt.AlignHCenter) - self.mode_settings = ModeSettings(self.common, self.tab.tab_id) + self.mode_settings = ModeSettings(self.common, self.tab) self.mode_settings.change_persistent.connect(self.change_persistent) header_layout = QtWidgets.QVBoxLayout() diff --git a/onionshare_gui/tab/mode/mode_settings.py b/onionshare_gui/tab/mode/mode_settings.py index 834680d8..2a4f2903 100644 --- a/onionshare_gui/tab/mode/mode_settings.py +++ b/onionshare_gui/tab/mode/mode_settings.py @@ -29,10 +29,10 @@ class ModeSettings(QtWidgets.QWidget): change_persistent = QtCore.pyqtSignal(int, bool) - def __init__(self, common, tab_id): + def __init__(self, common, tab): super(ModeSettings, self).__init__() self.common = common - self.tab_id = tab_id + self.tab = tab # Downstream Mode need to fill in this layout with its settings self.mode_specific_layout = QtWidgets.QVBoxLayout() @@ -128,7 +128,13 @@ class ModeSettings(QtWidgets.QWidget): self.client_auth_checkbox.hide() def persistent_checkbox_clicked(self): - self.change_persistent.emit(self.tab_id, self.persistent_checkbox.isChecked()) + self.tab.tab_settings["persistent"][ + "enabled" + ] = self.persistent_checkbox.isChecked() + + self.change_persistent.emit( + self.tab.tab_id, self.persistent_checkbox.isChecked() + ) def toggle_advanced_clicked(self): if self.advanced_widget.isVisible():