Ensure Tab timer starts once tor is connected

This commit is contained in:
Miguel Jacq 2022-11-23 17:04:15 +11:00
parent a7eff6c999
commit a96991713b
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
5 changed files with 2 additions and 33 deletions

View File

@ -244,17 +244,6 @@ class MainWindow(QtWidgets.QMainWindow):
break break
self.tabs.open_settings_tab(from_autoconnect, active_tab=active_tab) self.tabs.open_settings_tab(from_autoconnect, active_tab=active_tab)
def settings_have_changed(self):
self.common.log("OnionShareGui", "settings_have_changed")
if self.common.gui.onion.is_authenticated():
self.status_bar.clearMessage()
# Tell each tab that settings have changed
for index in range(self.tabs.count()):
tab = self.tabs.widget(index)
tab.settings_have_changed()
def bring_to_front(self): def bring_to_front(self):
self.common.log("MainWindow", "bring_to_front") self.common.log("MainWindow", "bring_to_front")
self.raise_() self.raise_()

View File

@ -315,10 +315,6 @@ class SettingsTab(QtWidgets.QWidget):
return settings return settings
def settings_have_changed(self):
# Global settings have changed
self.common.log("SettingsTab", "settings_have_changed")
def _update_autoupdate_timestamp(self, autoupdate_timestamp): def _update_autoupdate_timestamp(self, autoupdate_timestamp):
self.common.log("SettingsTab", "_update_autoupdate_timestamp") self.common.log("SettingsTab", "_update_autoupdate_timestamp")

View File

@ -564,6 +564,8 @@ class Mode(QtWidgets.QWidget):
self.content_widget.show() self.content_widget.show()
self.tor_not_connected_widget.hide() self.tor_not_connected_widget.hide()
self.primary_action.show() self.primary_action.show()
if not self.tab.timer.isActive():
self.tab.timer.start(500)
def tor_connection_stopped(self): def tor_connection_stopped(self):
""" """

View File

@ -630,20 +630,6 @@ class Tab(QtWidgets.QWidget):
else: else:
return None return None
def settings_have_changed(self):
# Global settings have changed
self.common.log("Tab", "settings_have_changed")
# We might've stopped the main requests timer if a Tor connection failed. If we've reloaded
# settings, we probably succeeded in obtaining a new connection. If so, restart the timer.
if not self.common.gui.local_only:
if self.common.gui.onion.is_authenticated():
mode = self.get_mode()
if mode:
if not self.timer.isActive():
self.timer.start(500)
mode.on_reload_settings()
def close_tab(self): def close_tab(self):
self.common.log("Tab", "close_tab") self.common.log("Tab", "close_tab")
if self.mode is None: if self.mode is None:

View File

@ -903,7 +903,3 @@ class TorSettingsTab(QtWidgets.QWidget):
# Wait 1ms for the event loop to finish, then quit # Wait 1ms for the event loop to finish, then quit
QtCore.QTimer.singleShot(1, self.common.gui.qtapp.quit) QtCore.QTimer.singleShot(1, self.common.gui.qtapp.quit)
def settings_have_changed(self):
# Global settings have changed
self.common.log("TorSettingsTab", "settings_have_changed")