aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaptak S <saptak013@gmail.com>2022-02-24 18:14:06 +0530
committerSaptak S <saptak013@gmail.com>2022-02-24 18:14:06 +0530
commitfdc7ba9228a08d35e6bed042522b4e4c462025e4 (patch)
treee20653a43b5e0842017d7a0e2009968e69ff9c4a
parent2d7e980adece27cd54536f87e9ee7b03df9b701b (diff)
downloadonionshare-fdc7ba9228a08d35e6bed042522b4e4c462025e4.tar.gz
onionshare-fdc7ba9228a08d35e6bed042522b4e4c462025e4.zip
Fix the settings tab calls
-rw-r--r--desktop/onionshare/connection_tab.py2
-rw-r--r--desktop/onionshare/main_window.py2
-rw-r--r--desktop/onionshare/settings_parent_tab.py4
-rw-r--r--desktop/onionshare/tab_widget.py74
4 files changed, 42 insertions, 40 deletions
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")
-
- # 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)
+ # 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
+
+ # 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: