mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 08:49:30 -05:00
experimenting with adjustSize() which seems to help the widget issue. Also adjust the custom Bridge parsing so that it injects the Bridge prefix automatically (means we can copy/pasta from https://bridges.torproject.org/bridges)
This commit is contained in:
parent
b23a4f2bee
commit
3f27b80154
32
a
Normal file
32
a
Normal file
@ -0,0 +1,32 @@
|
||||
Old Settings
|
||||
|
||||
|
||||
|
||||
+ # Remove the 'Bridge' lines at the start of each bridge.
|
||||
+ # They are added automatically to provide compatibility with
|
||||
+ # copying/pasting bridges provided from https://bridges.torproject.org
|
||||
+ new_bridges = []
|
||||
+ bridges = self.old_settings.get('tor_bridges_use_custom_bridges').split('Bridge ')
|
||||
+ for bridge in bridges:
|
||||
+ new_bridges.append(bridge)
|
||||
+ new_bridges = ''.join(new_bridges)
|
||||
+ self.tor_bridges_use_custom_textbox.setPlainText(new_bridges)
|
||||
|
||||
|
||||
|
||||
|
||||
+ # Insert a 'Bridge' line at the start of each bridge.
|
||||
+ # This makes it easier to copy/paste a set of bridges
|
||||
+ # provided from https://bridges.torproject.org
|
||||
+ new_bridges = []
|
||||
+ bridges = self.tor_bridges_use_custom_textbox.toPlainText().split('\n')
|
||||
+ for bridge in bridges:
|
||||
+ if bridge != '':
|
||||
+ new_bridges.append(''.join(['Bridge ', bridge, '\n']))
|
||||
+ new_bridges = ''.join(new_bridges)
|
||||
+ settings.set('tor_bridges_use_custom_bridges', new_bridges)
|
||||
|
||||
|
||||
|
||||
+ "gui_settings_tor_bridges_custom_label": "You can obtain bridges from <a href=\"https://bridges.torproject.org/bridges\">https://bridges.torproject.org</a>",
|
||||
|
@ -202,18 +202,27 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.tor_bridges_use_custom_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_custom_radio_option', True))
|
||||
self.tor_bridges_use_custom_radio.toggled.connect(self.tor_bridges_use_custom_radio_toggled)
|
||||
|
||||
self.tor_bridges_use_custom_label = QtWidgets.QLabel(strings._('gui_settings_tor_bridges_custom_label', True))
|
||||
self.tor_bridges_use_custom_textbox = QtWidgets.QPlainTextEdit()
|
||||
self.tor_bridges_use_custom_textbox.setPlaceholderText('Bridge [address:port] [identifier]')
|
||||
tor_bridges_use_custom_textbox_options_layout = QtWidgets.QHBoxLayout()
|
||||
self.tor_bridges_use_custom_textbox.setPlaceholderText('[address:port] [identifier]')
|
||||
self.tor_bridges_use_custom_textbox.adjustSize()
|
||||
|
||||
tor_bridges_use_custom_textbox_options_layout = QtWidgets.QVBoxLayout()
|
||||
tor_bridges_use_custom_textbox_options_layout.addWidget(self.tor_bridges_use_custom_label)
|
||||
tor_bridges_use_custom_textbox_options_layout.addWidget(self.tor_bridges_use_custom_textbox)
|
||||
|
||||
self.tor_bridges_use_custom_textbox_options = QtWidgets.QWidget()
|
||||
self.tor_bridges_use_custom_textbox_options.setLayout(tor_bridges_use_custom_textbox_options_layout)
|
||||
self.tor_bridges_use_custom_textbox_options.hide()
|
||||
self.tor_bridges_use_custom_textbox_options.adjustSize()
|
||||
|
||||
# Test tor settings button
|
||||
self.connection_type_test_button = QtWidgets.QPushButton(strings._('gui_settings_connection_type_test_button', True))
|
||||
self.connection_type_test_button.clicked.connect(self.test_tor_clicked)
|
||||
connection_type_test_button_layout = QtWidgets.QHBoxLayout()
|
||||
connection_type_test_button_layout.addWidget(self.connection_type_test_button)
|
||||
connection_type_test_button_group = QtWidgets.QGroupBox()
|
||||
connection_type_test_button_group.setLayout(connection_type_test_button_layout)
|
||||
|
||||
|
||||
# Put the radios into their own group so they are exclusive
|
||||
connection_type_radio_group_layout = QtWidgets.QVBoxLayout()
|
||||
@ -239,7 +248,6 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
connection_type_bridges_radio_group_layout.addWidget(self.tor_bridges_use_obfs4_radio)
|
||||
connection_type_bridges_radio_group_layout.addWidget(self.tor_bridges_use_custom_radio)
|
||||
connection_type_bridges_radio_group_layout.addWidget(self.tor_bridges_use_custom_textbox_options)
|
||||
connection_type_bridges_radio_group_layout.addWidget(self.connection_type_test_button)
|
||||
connection_type_bridges_radio_group = QtWidgets.QGroupBox(strings._("gui_settings_tor_bridges", True))
|
||||
connection_type_bridges_radio_group.setLayout(connection_type_bridges_radio_group_layout)
|
||||
|
||||
@ -272,6 +280,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
right_col_layout.addWidget(connection_type_radio_group)
|
||||
right_col_layout.addWidget(connection_type_group)
|
||||
right_col_layout.addWidget(connection_type_bridges_radio_group)
|
||||
right_col_layout.addWidget(connection_type_test_button_group)
|
||||
right_col_layout.addWidget(self.tor_status)
|
||||
right_col_layout.addStretch()
|
||||
|
||||
@ -351,7 +360,15 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.tor_bridges_use_obfs4_radio.setChecked(self.old_settings.get('tor_bridges_use_obfs4'))
|
||||
if self.old_settings.get('tor_bridges_use_custom_bridges'):
|
||||
self.tor_bridges_use_custom_radio.setChecked(True)
|
||||
self.tor_bridges_use_custom_textbox.setPlainText(self.old_settings.get('tor_bridges_use_custom_bridges'))
|
||||
# Remove the 'Bridge' lines at the start of each bridge.
|
||||
# They are added automatically to provide compatibility with
|
||||
# copying/pasting bridges provided from https://bridges.torproject.org
|
||||
new_bridges = []
|
||||
bridges = self.old_settings.get('tor_bridges_use_custom_bridges').split('Bridge ')
|
||||
for bridge in bridges:
|
||||
new_bridges.append(bridge)
|
||||
new_bridges = ''.join(new_bridges)
|
||||
self.tor_bridges_use_custom_textbox.setPlainText(new_bridges)
|
||||
|
||||
def connection_type_bundled_toggled(self, checked):
|
||||
"""
|
||||
@ -386,6 +403,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
if checked:
|
||||
self.tor_bridges_use_obfs4_radio.setEnabled(False)
|
||||
self.tor_bridges_use_custom_textbox_options.show()
|
||||
self.tor_bridges_use_custom_textbox_options.adjustSize()
|
||||
self.adjustSize()
|
||||
|
||||
def connection_type_automatic_toggled(self, checked):
|
||||
"""
|
||||
@ -406,6 +425,10 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.authenticate_group.show()
|
||||
self.connection_type_control_port_extras.show()
|
||||
self.connection_type_socks.show()
|
||||
self.authenticate_group.adjustSize()
|
||||
self.connection_type_control_port_extras.adjustSize()
|
||||
self.connection_type_socks.adjustSize()
|
||||
self.adjustSize()
|
||||
else:
|
||||
self.connection_type_control_port_extras.hide()
|
||||
|
||||
@ -420,6 +443,10 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.authenticate_group.show()
|
||||
self.connection_type_socket_file_extras.show()
|
||||
self.connection_type_socks.show()
|
||||
self.authenticate_group.adjustSize()
|
||||
self.connection_type_socket_file_extras.adjustSize()
|
||||
self.connection_type_socks.adjustSize()
|
||||
self.adjustSize()
|
||||
else:
|
||||
self.connection_type_socket_file_extras.hide()
|
||||
|
||||
@ -437,6 +464,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
common.log('SettingsDialog', 'authenticate_password_toggled')
|
||||
if checked:
|
||||
self.authenticate_password_extras.show()
|
||||
self.authenticate_password_extras.adjustSize()
|
||||
self.adjustSize()
|
||||
else:
|
||||
self.authenticate_password_extras.hide()
|
||||
|
||||
@ -631,7 +660,16 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
if self.tor_bridges_use_custom_radio.isChecked():
|
||||
settings.set('no_bridges', False)
|
||||
settings.set('tor_bridges_use_obfs4', False)
|
||||
settings.set('tor_bridges_use_custom_bridges', self.tor_bridges_use_custom_textbox.toPlainText())
|
||||
# Insert a 'Bridge' line at the start of each bridge.
|
||||
# This makes it easier to copy/paste a set of bridges
|
||||
# provided from https://bridges.torproject.org
|
||||
new_bridges = []
|
||||
bridges = self.tor_bridges_use_custom_textbox.toPlainText().split('\n')
|
||||
for bridge in bridges:
|
||||
if bridge != '':
|
||||
new_bridges.append(''.join(['Bridge ', bridge, '\n']))
|
||||
new_bridges = ''.join(new_bridges)
|
||||
settings.set('tor_bridges_use_custom_bridges', new_bridges)
|
||||
|
||||
return settings
|
||||
|
||||
|
@ -94,6 +94,7 @@
|
||||
"gui_settings_tor_bridges_no_bridges_radio_option": "Don't use bridges",
|
||||
"gui_settings_tor_bridges_obfs4_radio_option": "Use obfs4 pluggable transports",
|
||||
"gui_settings_tor_bridges_custom_radio_option": "Use custom bridges",
|
||||
"gui_settings_tor_bridges_custom_label": "You can obtain bridges from <a href=\"https://bridges.torproject.org/bridges\">https://bridges.torproject.org</a>",
|
||||
"gui_settings_button_save": "Save",
|
||||
"gui_settings_button_cancel": "Cancel",
|
||||
"gui_settings_button_help": "Help",
|
||||
|
Loading…
Reference in New Issue
Block a user