mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 02:32:58 -03:00
When Tor is disconnected, hide the Check for Updates button in the Settings tab
This commit is contained in:
parent
73b570f4b4
commit
d88005d550
2 changed files with 25 additions and 14 deletions
|
@ -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()
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue