From 49d951f43de469c5dc6f8cd7aced7710ec25d8c9 Mon Sep 17 00:00:00 2001 From: Saptak S Date: Sat, 30 Apr 2022 21:19:24 +0530 Subject: [PATCH] Shows the actual error message returned from tor connection at the top --- desktop/onionshare/connection_tab.py | 16 ++++++++++++++++ desktop/onionshare/resources/locale/en.json | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/desktop/onionshare/connection_tab.py b/desktop/onionshare/connection_tab.py index 6bef4abe..9f5f023a 100644 --- a/desktop/onionshare/connection_tab.py +++ b/desktop/onionshare/connection_tab.py @@ -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() diff --git a/desktop/onionshare/resources/locale/en.json b/desktop/onionshare/resources/locale/en.json index 54e2fa09..69429335 100644 --- a/desktop/onionshare/resources/locale/en.json +++ b/desktop/onionshare/resources/locale/en.json @@ -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?

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",