mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-09 23:33:03 -04:00
Merge pull request #1582 from SaptakS/better-error-logs
Better error logs in the bridge connect widget
This commit is contained in:
commit
b320596190
3 changed files with 49 additions and 6 deletions
|
@ -326,11 +326,20 @@ class AutoConnectTab(QtWidgets.QWidget):
|
||||||
"""
|
"""
|
||||||
self.tor_con.hide()
|
self.tor_con.hide()
|
||||||
|
|
||||||
# If we're on first launch, switch to use bridge
|
# If there is a message, update the text of the bridge widget
|
||||||
|
if msg:
|
||||||
|
self.use_bridge_widget.connection_error_message.setText(msg)
|
||||||
|
|
||||||
|
# If we're on first launch, check if wasCanceled
|
||||||
|
# If cancelled, stay in first launch widget and show buttons
|
||||||
|
# Else, switch to use bridge
|
||||||
if self.first_launch_widget.isVisible():
|
if self.first_launch_widget.isVisible():
|
||||||
self.first_launch_widget.show_buttons()
|
if self.tor_con.wasCanceled():
|
||||||
self.first_launch_widget.hide()
|
self.first_launch_widget.show_buttons()
|
||||||
self.use_bridge_widget.show()
|
else:
|
||||||
|
self.first_launch_widget.show_buttons()
|
||||||
|
self.first_launch_widget.hide()
|
||||||
|
self.use_bridge_widget.show()
|
||||||
else:
|
else:
|
||||||
self.use_bridge_widget.show_buttons()
|
self.use_bridge_widget.show_buttons()
|
||||||
|
|
||||||
|
@ -543,12 +552,21 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
|
||||||
common.gui.css["autoconnect_failed_to_connect_label"]
|
common.gui.css["autoconnect_failed_to_connect_label"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Tor connection error message
|
||||||
|
self.connection_error_message = QtWidgets.QLabel(
|
||||||
|
strings._("gui_autoconnect_connection_error_msg")
|
||||||
|
)
|
||||||
|
self.connection_error_message.setTextFormat(QtCore.Qt.RichText)
|
||||||
|
self.connection_error_message.setWordWrap(True)
|
||||||
|
self.connection_error_message.setContentsMargins(0, 0, 0, 10)
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
self.description_label = QtWidgets.QLabel(
|
self.description_label = QtWidgets.QLabel(
|
||||||
strings._("gui_autoconnect_bridge_description")
|
strings._("gui_autoconnect_bridge_description")
|
||||||
)
|
)
|
||||||
self.description_label.setTextFormat(QtCore.Qt.RichText)
|
self.description_label.setTextFormat(QtCore.Qt.RichText)
|
||||||
self.description_label.setWordWrap(True)
|
self.description_label.setWordWrap(True)
|
||||||
|
self.description_label.setContentsMargins(0, 0, 0, 20)
|
||||||
|
|
||||||
# Detection preference
|
# Detection preference
|
||||||
self.use_bridge = True
|
self.use_bridge = True
|
||||||
|
@ -568,6 +586,14 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
|
||||||
detect_layout.addWidget(self.no_bridge)
|
detect_layout.addWidget(self.no_bridge)
|
||||||
detect_layout.addWidget(self.detect_automatic_radio)
|
detect_layout.addWidget(self.detect_automatic_radio)
|
||||||
detect_layout.addWidget(self.detect_manual_radio)
|
detect_layout.addWidget(self.detect_manual_radio)
|
||||||
|
bridge_setting_options = QtWidgets.QGroupBox(
|
||||||
|
strings._("gui_autoconnect_bridge_setting_options")
|
||||||
|
)
|
||||||
|
bridge_setting_options.setLayout(detect_layout)
|
||||||
|
bridge_setting_options.setFlat(True)
|
||||||
|
bridge_setting_options.setStyleSheet(
|
||||||
|
common.gui.css["autoconnect_bridge_setting_options"]
|
||||||
|
)
|
||||||
|
|
||||||
# Country list
|
# Country list
|
||||||
locale = self.common.settings.get("locale")
|
locale = self.common.settings.get("locale")
|
||||||
|
@ -640,8 +666,9 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
|
||||||
# Layout
|
# Layout
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
layout.addWidget(self.connection_status_label)
|
layout.addWidget(self.connection_status_label)
|
||||||
|
layout.addWidget(self.connection_error_message)
|
||||||
layout.addWidget(self.description_label)
|
layout.addWidget(self.description_label)
|
||||||
layout.addLayout(detect_layout)
|
layout.addWidget(bridge_setting_options)
|
||||||
layout.addWidget(self.country_combobox)
|
layout.addWidget(self.country_combobox)
|
||||||
layout.addWidget(self.task_label)
|
layout.addWidget(self.task_label)
|
||||||
layout.addWidget(cta_widget)
|
layout.addWidget(cta_widget)
|
||||||
|
@ -655,6 +682,7 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
|
||||||
def hide_buttons(self):
|
def hide_buttons(self):
|
||||||
self.connect_button.hide()
|
self.connect_button.hide()
|
||||||
self.configure_button.hide()
|
self.configure_button.hide()
|
||||||
|
self.connection_error_message.hide()
|
||||||
self.description_label.hide()
|
self.description_label.hide()
|
||||||
self.error_label.hide()
|
self.error_label.hide()
|
||||||
self.no_bridge.hide()
|
self.no_bridge.hide()
|
||||||
|
@ -663,6 +691,7 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
def show_buttons(self):
|
def show_buttons(self):
|
||||||
self.connect_button.show()
|
self.connect_button.show()
|
||||||
|
self.connection_error_message.show()
|
||||||
self.description_label.show()
|
self.description_label.show()
|
||||||
self.configure_button.show()
|
self.configure_button.show()
|
||||||
self.no_bridge.show()
|
self.no_bridge.show()
|
||||||
|
|
|
@ -194,6 +194,7 @@ class GuiCommon:
|
||||||
QComboBox {
|
QComboBox {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
margin-left: 32px;
|
||||||
}
|
}
|
||||||
QComboBox:disabled {
|
QComboBox:disabled {
|
||||||
color: #666666;
|
color: #666666;
|
||||||
|
@ -209,6 +210,17 @@ class GuiCommon:
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}""",
|
}""",
|
||||||
|
"autoconnect_bridge_setting_options": """
|
||||||
|
QGroupBox {
|
||||||
|
border: 0;
|
||||||
|
border-color: transparent;
|
||||||
|
background-color: transparent;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
QGroupBox::title {
|
||||||
|
subcontrol-origin: margin;
|
||||||
|
}""",
|
||||||
# Common styles between modes and their child widgets
|
# Common styles between modes and their child widgets
|
||||||
"mode_settings_toggle_advanced": """
|
"mode_settings_toggle_advanced": """
|
||||||
QPushButton {
|
QPushButton {
|
||||||
|
|
|
@ -46,9 +46,11 @@
|
||||||
"gui_enable_autoconnect_checkbox": "Connect to Tor automatically",
|
"gui_enable_autoconnect_checkbox": "Connect to Tor automatically",
|
||||||
"gui_autoconnect_failed_to_connect_to_tor": "Failed to Connect to Tor",
|
"gui_autoconnect_failed_to_connect_to_tor": "Failed to Connect to Tor",
|
||||||
"gui_autoconnect_trying_to_connect_to_tor": "Trying to Connect to Tor...",
|
"gui_autoconnect_trying_to_connect_to_tor": "Trying to Connect to Tor...",
|
||||||
"gui_autoconnect_bridge_description": "Are you connected to the internet?<br><br>It's also possible that your internet is being censored. You might be able to bypass this using a bridge.",
|
"gui_autoconnect_connection_error_msg": "Are you connected to the internet?",
|
||||||
|
"gui_autoconnect_bridge_description": "It's also possible that your internet is being censored. You might be able to bypass this using a bridge.",
|
||||||
"gui_autoconnect_bridge_detect_automatic": "Automatically determine my country from my IP address for bridge settings",
|
"gui_autoconnect_bridge_detect_automatic": "Automatically determine my country from my IP address for bridge settings",
|
||||||
"gui_autoconnect_bridge_detect_manual": "Manually select my country for bridge settings",
|
"gui_autoconnect_bridge_detect_manual": "Manually select my country for bridge settings",
|
||||||
|
"gui_autoconnect_bridge_setting_options": "Bridge Settings",
|
||||||
"gui_autoconnect_start": "Connect to Tor",
|
"gui_autoconnect_start": "Connect to Tor",
|
||||||
"gui_autoconnect_configure": "Network Settings",
|
"gui_autoconnect_configure": "Network Settings",
|
||||||
"gui_autoconnect_no_bridge": "Try again without bridge",
|
"gui_autoconnect_no_bridge": "Try again without bridge",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue