When Tor is disconnected, hide the Check for Updates button in the Settings tab

This commit is contained in:
Micah Lee 2021-11-09 18:57:07 -08:00
parent 73b570f4b4
commit d88005d550
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
2 changed files with 25 additions and 14 deletions

View file

@ -154,6 +154,11 @@ class SettingsTab(QtWidgets.QWidget):
self.reload_settings()
if self.common.gui.onion.connected_to_tor:
self.tor_is_connected()
else:
self.tor_is_disconnected()
def reload_settings(self):
# Load settings, and fill them in
self.old_settings = Settings(self.common)
@ -341,3 +346,9 @@ class SettingsTab(QtWidgets.QWidget):
else:
self.check_for_updates_button.setEnabled(True)
self.save_button.setEnabled(True)
def tor_is_connected(self):
self.check_for_updates_button.show()
def tor_is_disconnected(self):
self.check_for_updates_button.hide()

View file

@ -378,23 +378,23 @@ class TabWidget(QtWidgets.QTabWidget):
def tor_is_connected(self):
for tab_id in self.tabs:
if not (
type(self.tabs[tab_id]) is SettingsTab
or type(self.tabs[tab_id]) is TorSettingsTab
):
mode = self.tabs[tab_id].get_mode()
if mode:
mode.tor_connection_started()
if type(self.tabs[tab_id]) is SettingsTab:
self.tabs[tab_id].tor_is_connected()
else:
if not type(self.tabs[tab_id]) is TorSettingsTab:
mode = self.tabs[tab_id].get_mode()
if mode:
mode.tor_connection_started()
def tor_is_disconnected(self):
for tab_id in self.tabs:
if not (
type(self.tabs[tab_id]) is SettingsTab
or type(self.tabs[tab_id]) is TorSettingsTab
):
mode = self.tabs[tab_id].get_mode()
if mode:
mode.tor_connection_stopped()
if type(self.tabs[tab_id]) is SettingsTab:
self.tabs[tab_id].tor_is_disconnected()
else:
if not type(self.tabs[tab_id]) is TorSettingsTab:
mode = self.tabs[tab_id].get_mode()
if mode:
mode.tor_connection_stopped()
class TabBar(QtWidgets.QTabBar):