From 9f4f07c13310a1b56a3345b2c358b45e23d9378e Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Mon, 28 Jan 2019 20:01:51 -0800 Subject: [PATCH 1/2] Fix crash that occurs when opening settings when both client authentication and persistence are enabled --- onionshare_gui/settings_dialog.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py index 1fe6dc53..7cec8b92 100644 --- a/onionshare_gui/settings_dialog.py +++ b/onionshare_gui/settings_dialog.py @@ -144,10 +144,10 @@ class SettingsDialog(QtWidgets.QDialog): self.use_stealth_widget = QtWidgets.QWidget() self.use_stealth_widget.setLayout(use_stealth_layout) - hidservauth_details = QtWidgets.QLabel(strings._('gui_settings_stealth_hidservauth_string')) - hidservauth_details.setWordWrap(True) - hidservauth_details.setMinimumSize(hidservauth_details.sizeHint()) - hidservauth_details.hide() + self.hidservauth_details = QtWidgets.QLabel(strings._('gui_settings_stealth_hidservauth_string')) + self.hidservauth_details.setWordWrap(True) + self.hidservauth_details.setMinimumSize(self.hidservauth_details.sizeHint()) + self.hidservauth_details.hide() self.hidservauth_copy_button = QtWidgets.QPushButton(strings._('gui_copy_hidservauth')) self.hidservauth_copy_button.clicked.connect(self.hidservauth_copy_button_clicked) @@ -159,7 +159,7 @@ class SettingsDialog(QtWidgets.QDialog): onion_settings_layout.addWidget(self.use_legacy_v2_onions_widget) onion_settings_layout.addWidget(self.save_private_key_widget) onion_settings_layout.addWidget(self.use_stealth_widget) - onion_settings_layout.addWidget(hidservauth_details) + onion_settings_layout.addWidget(self.hidservauth_details) onion_settings_layout.addWidget(self.hidservauth_copy_button) self.onion_settings_widget = QtWidgets.QWidget() self.onion_settings_widget.setStyleSheet(self.common.css['settings_onion_settings']) @@ -523,7 +523,7 @@ class SettingsDialog(QtWidgets.QDialog): # Legacy v2 mode is forced on if Stealth is enabled self.use_legacy_v2_onions_checkbox.setEnabled(False) if save_private_key and self.old_settings.get('hidservauth_string') != "": - hidservauth_details.show() + self.hidservauth_details.show() self.hidservauth_copy_button.show() else: self.stealth_checkbox.setCheckState(QtCore.Qt.Unchecked) From afc913e243d5b460d7638bb05570b6ee1fec8ae4 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Mon, 28 Jan 2019 20:30:05 -0800 Subject: [PATCH 2/2] Separete onion settings into their own group, and remove css that was breaking the look of the "Copy HidServAuth" button --- onionshare/common.py | 7 ------- onionshare_gui/settings_dialog.py | 28 ++++++++++++++++++---------- share/locale/en.json | 3 ++- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/onionshare/common.py b/onionshare/common.py index 49c69ab5..fcb9ca6d 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -398,13 +398,6 @@ class Common(object): 'settings_connect_to_tor': """ QLabel { font-style: italic; - }""", - - # For some reason, this prevents extra padding around the v2 onion - # settings when viewing in macOS - 'settings_onion_settings': """ - QWidget { - border: 0; }""" } diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py index 7cec8b92..75a2f59b 100644 --- a/onionshare_gui/settings_dialog.py +++ b/onionshare_gui/settings_dialog.py @@ -52,7 +52,7 @@ class SettingsDialog(QtWidgets.QDialog): self.system = platform.system() - # General options + # General settings # Use a slug or not ('public mode') self.public_mode_checkbox = QtWidgets.QCheckBox() @@ -88,6 +88,15 @@ class SettingsDialog(QtWidgets.QDialog): self.shutdown_timeout_widget = QtWidgets.QWidget() self.shutdown_timeout_widget.setLayout(shutdown_timeout_layout) + # General settings layout + general_group_layout = QtWidgets.QVBoxLayout() + general_group_layout.addWidget(self.public_mode_widget) + general_group_layout.addWidget(self.shutdown_timeout_widget) + general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label")) + general_group.setLayout(general_group_layout) + + # Onion settings + # Label telling user to connect to Tor for onion service settings self.connect_to_tor_label = QtWidgets.QLabel(strings._("gui_connect_to_tor_for_onion_settings")) self.connect_to_tor_label.setStyleSheet(self.common.css['settings_connect_to_tor']) @@ -162,17 +171,15 @@ class SettingsDialog(QtWidgets.QDialog): onion_settings_layout.addWidget(self.hidservauth_details) onion_settings_layout.addWidget(self.hidservauth_copy_button) self.onion_settings_widget = QtWidgets.QWidget() - self.onion_settings_widget.setStyleSheet(self.common.css['settings_onion_settings']) self.onion_settings_widget.setLayout(onion_settings_layout) - # General options layout - general_group_layout = QtWidgets.QVBoxLayout() - general_group_layout.addWidget(self.public_mode_widget) - general_group_layout.addWidget(self.shutdown_timeout_widget) - general_group_layout.addWidget(self.connect_to_tor_label) - general_group_layout.addWidget(self.onion_settings_widget) - general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label")) - general_group.setLayout(general_group_layout) + # Onion settings layout + onion_group_layout = QtWidgets.QVBoxLayout() + onion_group_layout.addWidget(self.connect_to_tor_label) + onion_group_layout.addWidget(self.onion_settings_widget) + onion_group = QtWidgets.QGroupBox(strings._("gui_settings_onion_label")) + onion_group.setLayout(onion_group_layout) + # Sharing options @@ -445,6 +452,7 @@ class SettingsDialog(QtWidgets.QDialog): # Layout left_col_layout = QtWidgets.QVBoxLayout() left_col_layout.addWidget(general_group) + left_col_layout.addWidget(onion_group) left_col_layout.addWidget(sharing_group) left_col_layout.addWidget(receiving_group) left_col_layout.addWidget(autoupdate_group) diff --git a/share/locale/en.json b/share/locale/en.json index 3ad2efda..f7af9a80 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -56,13 +56,14 @@ "gui_settings_window_title": "Settings", "gui_settings_whats_this": "What's this?", "gui_settings_stealth_option": "Use client authorization", - "gui_settings_stealth_hidservauth_string": "Having saved your private key for reuse, means you can now\nclick to copy your HidServAuth.", + "gui_settings_stealth_hidservauth_string": "Having saved your private key for reuse, means you can now click to copy your HidServAuth.", "gui_settings_autoupdate_label": "Check for new version", "gui_settings_autoupdate_option": "Notify me when a new version is available", "gui_settings_autoupdate_timestamp": "Last checked: {}", "gui_settings_autoupdate_timestamp_never": "Never", "gui_settings_autoupdate_check_button": "Check for New Version", "gui_settings_general_label": "General settings", + "gui_settings_onion_label": "Onion settings", "gui_settings_sharing_label": "Sharing settings", "gui_settings_close_after_first_download_option": "Stop sharing after files have been sent", "gui_settings_connection_type_label": "How should OnionShare connect to Tor?",