From 0ab29ff8afa0a041396be85b296309969fb6d331 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 29 Dec 2016 14:35:57 -0800 Subject: [PATCH] When a share is active, disable the full advanced options group, not just the stealth checkbox --- onionshare_gui/onionshare_gui.py | 4 ++-- onionshare_gui/options.py | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 439b221a..ead6a609 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -161,7 +161,7 @@ class OnionShareGui(QtWidgets.QMainWindow): self.app.choose_port() # disable the stealth option - self.options.set_stealth_enabled(False) + self.options.set_advanced_enabled(False) # start onionshare http service in new thread t = threading.Thread(target=web.start, args=(self.app.port, self.app.stay_open, self.app.transparent_torification)) @@ -250,7 +250,7 @@ class OnionShareGui(QtWidgets.QMainWindow): web.stop(self.app.port) self.app.cleanup() self.filesize_warning.hide() - self.options.set_stealth_enabled(True) + self.options.set_advanced_enabled(True) self.stop_server_finished.emit() @staticmethod diff --git a/onionshare_gui/options.py b/onionshare_gui/options.py index f1acff25..7c284aa0 100644 --- a/onionshare_gui/options.py +++ b/onionshare_gui/options.py @@ -47,18 +47,18 @@ class Options(QtWidgets.QVBoxLayout): self.stealth.stateChanged.connect(self.stealth_changed) # advanced options group - advanced_group = QtWidgets.QGroupBox(strings._("gui_advanced_options", True)) - advanced_group.setCheckable(True) - advanced_group.setChecked(False) - advanced_group.setFlat(True) - advanced_group.toggled.connect(self.advanced_options_changed) + self.advanced_group = QtWidgets.QGroupBox(strings._("gui_advanced_options", True)) + self.advanced_group.setCheckable(True) + self.advanced_group.setChecked(False) + self.advanced_group.setFlat(True) + self.advanced_group.toggled.connect(self.advanced_options_changed) advanced_group_layout = QtWidgets.QVBoxLayout() advanced_group_layout.addWidget(self.stealth) - advanced_group.setLayout(advanced_group_layout) + self.advanced_group.setLayout(advanced_group_layout) # add the widgets self.addWidget(self.close_automatically) - self.addWidget(advanced_group) + self.addWidget(self.advanced_group) def stay_open_changed(self, state): """ @@ -89,9 +89,10 @@ class Options(QtWidgets.QVBoxLayout): else: self.app.set_stealth(False) - def set_stealth_enabled(self, enabled): + def set_advanced_enabled(self, enabled): """ You cannot toggle stealth after an onion service has started. This method - disables and re-enabled the stealth checkbox. + disables and re-enabled the advanced options group, including the stealth + checkbox. """ - self.stealth.setEnabled(enabled) + self.advanced_group.setEnabled(enabled)