Shows the actual error message returned from tor connection at the top

This commit is contained in:
Saptak S 2022-04-30 21:19:24 +05:30
parent 737c4d0f20
commit 49d951f43d
No known key found for this signature in database
GPG key ID: 7B7F1772C0C6FCBF
2 changed files with 18 additions and 1 deletions

View file

@ -326,6 +326,10 @@ class AutoConnectTab(QtWidgets.QWidget):
"""
self.tor_con.hide()
# If there is a message, update the text of the bridge widget
if msg:
self.use_bridge_widget.connection_error_message.setText(f"{msg}")
# If we're on first launch, check if wasCancelled
# If cancelled, stay in first launch widget and show buttons
# Else, switch to use bridge
@ -548,12 +552,21 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
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
self.description_label = QtWidgets.QLabel(
strings._("gui_autoconnect_bridge_description")
)
self.description_label.setTextFormat(QtCore.Qt.RichText)
self.description_label.setWordWrap(True)
self.description_label.setContentsMargins(0, 0, 0, 20)
# Detection preference
self.use_bridge = True
@ -645,6 +658,7 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
# Layout
layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.connection_status_label)
layout.addWidget(self.connection_error_message)
layout.addWidget(self.description_label)
layout.addLayout(detect_layout)
layout.addWidget(self.country_combobox)
@ -660,6 +674,7 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
def hide_buttons(self):
self.connect_button.hide()
self.configure_button.hide()
self.connection_error_message.hide()
self.description_label.hide()
self.error_label.hide()
self.no_bridge.hide()
@ -668,6 +683,7 @@ class AutoConnectUseBridgeWidget(QtWidgets.QWidget):
def show_buttons(self):
self.connect_button.show()
self.connection_error_message.show()
self.description_label.show()
self.configure_button.show()
self.no_bridge.show()

View file

@ -46,7 +46,8 @@
"gui_enable_autoconnect_checkbox": "Connect to Tor automatically",
"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_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_manual": "Manually select my country for bridge settings",
"gui_autoconnect_start": "Connect to Tor",