diff --git a/desktop/onionshare/connection_tab.py b/desktop/onionshare/connection_tab.py index e67ca483..a3355db4 100644 --- a/desktop/onionshare/connection_tab.py +++ b/desktop/onionshare/connection_tab.py @@ -149,7 +149,7 @@ class AutoConnectTab(QtWidgets.QWidget): self.curr_settings.save() def open_tor_settings(self): - self.parent.open_tor_settings_tab(from_autoconnect=True) + self.parent.open_settings_tab(from_autoconnect=True) def first_launch_widget_connect_clicked(self): """ diff --git a/desktop/onionshare/main_window.py b/desktop/onionshare/main_window.py index 61119683..0de47fe4 100644 --- a/desktop/onionshare/main_window.py +++ b/desktop/onionshare/main_window.py @@ -246,7 +246,7 @@ class MainWindow(QtWidgets.QMainWindow): if type(self.tabs.tabs[tab_id]) is AutoConnectTab: from_autoconnect = True break - self.tabs.open_tor_settings_tab(from_autoconnect) + self.tabs.open_settings_tab(from_autoconnect) def open_settings(self): """ diff --git a/desktop/onionshare/settings_parent_tab.py b/desktop/onionshare/settings_parent_tab.py index 2e372983..0c2f548f 100644 --- a/desktop/onionshare/settings_parent_tab.py +++ b/desktop/onionshare/settings_parent_tab.py @@ -38,7 +38,7 @@ class SettingsParentTab(QtWidgets.QTabWidget): tab_bar = TabBar() self.setTabBar(tab_bar) settings_tab = SettingsTab(self.common, 0) - tor_settings_tab = TorSettingsTab( + self.tor_settings_tab = TorSettingsTab( self.common, 1, self.parent.are_tabs_active(), @@ -46,7 +46,7 @@ class SettingsParentTab(QtWidgets.QTabWidget): from_autoconnect, ) self.addTab( - tor_settings_tab, strings._("gui_tor_settings_window_title") + self.tor_settings_tab, strings._("gui_tor_settings_window_title") ) self.addTab(settings_tab, strings._("gui_settings_window_title")) diff --git a/desktop/onionshare/tab_widget.py b/desktop/onionshare/tab_widget.py index 05285a61..27bbfdb2 100644 --- a/desktop/onionshare/tab_widget.py +++ b/desktop/onionshare/tab_widget.py @@ -232,47 +232,49 @@ class TabWidget(QtWidgets.QTabWidget): index = self.addTab(connection_tab, strings._("gui_autoconnect_start")) self.setCurrentIndex(index) - def open_settings_tab(self): + def open_settings_tab(self, from_autoconnect=False, active_tab='tor'): self.common.log("TabWidget", "open_settings_tab") # See if a settings tab is already open, and if so switch to it for tab_id in self.tabs: - if type(self.tabs[tab_id]) is SettingsTab: + if type(self.tabs[tab_id]) is SettingsParentTab: self.setCurrentIndex(self.indexOf(self.tabs[tab_id])) return - settings_tab = SettingsParentTab(self.common, self.current_tab_id, parent=self) + settings_tab = SettingsParentTab(self.common, self.current_tab_id,active_tab=active_tab, parent=self, from_autoconnect=from_autoconnect) settings_tab.close_this_tab.connect(self.close_settings_tab) + settings_tab.tor_settings_tab.tor_is_connected.connect(self.tor_is_connected) + settings_tab.tor_settings_tab.tor_is_disconnected.connect(self.tor_is_disconnected) self.tabs[self.current_tab_id] = settings_tab self.current_tab_id += 1 index = self.addTab(settings_tab, strings._("gui_settings_window_title")) self.setCurrentIndex(index) - def open_tor_settings_tab(self, from_autoconnect=False): - self.common.log("TabWidget", "open_tor_settings_tab") + # 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 - for tab_id in self.tabs: - if type(self.tabs[tab_id]) is TorSettingsTab: - self.setCurrentIndex(self.indexOf(self.tabs[tab_id])) - return + # # See if a settings tab is already open, and if so switch to it + # for tab_id in self.tabs: + # if type(self.tabs[tab_id]) is TorSettingsTab: + # self.setCurrentIndex(self.indexOf(self.tabs[tab_id])) + # return - self.tor_settings_tab = TorSettingsTab( - 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) - self.tor_settings_tab.tor_is_disconnected.connect(self.tor_is_disconnected) - self.tabs[self.current_tab_id] = self.tor_settings_tab - self.current_tab_id += 1 - index = self.addTab( - self.tor_settings_tab, strings._("gui_tor_settings_window_title") - ) - self.setCurrentIndex(index) + # self.tor_settings_tab = TorSettingsTab( + # 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) + # self.tor_settings_tab.tor_is_disconnected.connect(self.tor_is_disconnected) + # self.tabs[self.current_tab_id] = self.tor_settings_tab + # self.current_tab_id += 1 + # index = self.addTab( + # self.tor_settings_tab, strings._("gui_tor_settings_window_title") + # ) + # self.setCurrentIndex(index) def change_title(self, tab_id, title): shortened_title = title @@ -384,15 +386,15 @@ class TabWidget(QtWidgets.QTabWidget): self.close_tab(index) return - def close_settings_tab(self): - self.common.log("TabWidget", "close_settings_tab") - for tab_id in self.tabs: - if type(self.tabs[tab_id]) is SettingsTab: - index = self.indexOf(self.tabs[tab_id]) - self.close_tab(index) - return + # def close_settings_tab(self): + # self.common.log("TabWidget", "close_settings_tab") + # for tab_id in self.tabs: + # if type(self.tabs[tab_id]) is SettingsTab: + # index = self.indexOf(self.tabs[tab_id]) + # self.close_tab(index) + # return - def close_tor_settings_tab(self): + def close_settings_tab(self): self.common.log("TabWidget", "close_tor_settings_tab") for tab_id in list(self.tabs): if type(self.tabs[tab_id]) is AutoConnectTab: