diff --git a/desktop/src/onionshare/connection_tab.py b/desktop/src/onionshare/connection_tab.py index bb5f72a3..13a6b2ad 100644 --- a/desktop/src/onionshare/connection_tab.py +++ b/desktop/src/onionshare/connection_tab.py @@ -152,7 +152,7 @@ class AutoConnectTab(QtWidgets.QWidget): self.curr_settings.save() def open_tor_settings(self): - self.parent.open_tor_settings_tab() + self.parent.open_tor_settings_tab(from_autoconnect=True) def connect_clicked(self): """ @@ -164,11 +164,8 @@ class AutoConnectTab(QtWidgets.QWidget): self.connect_button.hide() self.configure_button.hide() - if not self.common.gui.local_only: - self.tor_con.show() - self.tor_con.start(self.curr_settings) - else: - self.close_this_tab.emit() + self.tor_con.show() + self.tor_con.start(self.curr_settings) def tor_con_success(self): """ diff --git a/desktop/src/onionshare/main_window.py b/desktop/src/onionshare/main_window.py index 54fef40c..80d9b5c1 100644 --- a/desktop/src/onionshare/main_window.py +++ b/desktop/src/onionshare/main_window.py @@ -23,8 +23,8 @@ import time from PySide2 import QtCore, QtWidgets, QtGui from . import strings -from .tor_connection import TorConnectionDialog from .widgets import Alert +from .connection_tab import AutoConnectTab from .update_checker import UpdateThread from .tab_widget import TabWidget from .gui_common import GuiCommon @@ -238,7 +238,8 @@ class MainWindow(QtWidgets.QMainWindow): Open the TorSettingsTab """ self.common.log("MainWindow", "open_tor_settings") - self.tabs.open_tor_settings_tab() + from_autoconnect = type(self.tabs.tabs[0]) is AutoConnectTab + self.tabs.open_tor_settings_tab(from_autoconnect) def open_settings(self): """ diff --git a/desktop/src/onionshare/tab_widget.py b/desktop/src/onionshare/tab_widget.py index 99770576..972792fd 100644 --- a/desktop/src/onionshare/tab_widget.py +++ b/desktop/src/onionshare/tab_widget.py @@ -241,7 +241,7 @@ class TabWidget(QtWidgets.QTabWidget): index = self.addTab(settings_tab, strings._("gui_settings_window_title")) self.setCurrentIndex(index) - def open_tor_settings_tab(self): + def open_tor_settings_tab(self, from_autoconnect=False): self.common.log("TabWidget", "open_tor_settings_tab") # See if a settings tab is already open, and if so switch to it @@ -251,7 +251,7 @@ class TabWidget(QtWidgets.QTabWidget): return self.tor_settings_tab = TorSettingsTab( - self.common, self.current_tab_id, self.are_tabs_active(), self.status_bar + self.common, self.current_tab_id, self.are_tabs_active(), self.status_bar, from_autoconnect ) self.tor_settings_tab.close_this_tab.connect(self.close_tor_settings_tab) self.tor_settings_tab.tor_is_connected.connect(self.tor_is_connected) diff --git a/desktop/src/onionshare/tor_settings_tab.py b/desktop/src/onionshare/tor_settings_tab.py index 28778365..1557a4d6 100644 --- a/desktop/src/onionshare/tor_settings_tab.py +++ b/desktop/src/onionshare/tor_settings_tab.py @@ -43,7 +43,7 @@ class TorSettingsTab(QtWidgets.QWidget): tor_is_connected = QtCore.Signal() tor_is_disconnected = QtCore.Signal() - def __init__(self, common, tab_id, are_tabs_active, status_bar): + def __init__(self, common, tab_id, are_tabs_active, status_bar, from_autoconnect=False): super(TorSettingsTab, self).__init__() self.common = common @@ -54,6 +54,7 @@ class TorSettingsTab(QtWidgets.QWidget): self.system = platform.system() self.tab_id = tab_id + self.from_autoconnect = from_autoconnect # Connection type: either automatic, control port, or socket file @@ -692,7 +693,7 @@ class TorSettingsTab(QtWidgets.QWidget): # If Tor isn't connected, or if Tor settings have changed, Reinitialize # the Onion object reboot_onion = False - if not self.common.gui.local_only: + if not self.common.gui.local_only and not self.from_autoconnect: if self.common.gui.onion.is_authenticated(): self.common.log( "TorSettingsTab", "save_clicked", "Connected to Tor"