Dont start tor if torsettingstab opened from autoconnect

This commit is contained in:
Saptak S 2021-12-09 03:20:54 +05:30
parent 2ad9f8df58
commit 8d1d395d11
No known key found for this signature in database
GPG Key ID: 7B7F1772C0C6FCBF
4 changed files with 11 additions and 12 deletions

View File

@ -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):
"""

View File

@ -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):
"""

View File

@ -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)

View File

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