mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-24 13:41:14 -05:00
Stop worrying about common.gui.config in settings and update check
This commit is contained in:
parent
b815b0e9e2
commit
4b416141c2
@ -187,8 +187,8 @@ class Onion(object):
|
||||
|
||||
def connect(
|
||||
self,
|
||||
custom_settings=False,
|
||||
config=False,
|
||||
custom_settings=None,
|
||||
config=None,
|
||||
tor_status_update_func=None,
|
||||
connect_timeout=120,
|
||||
local_only=False,
|
||||
|
@ -716,7 +716,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
def reload_settings(self):
|
||||
# Load settings, and fill them in
|
||||
self.old_settings = Settings(self.common, self.common.gui.config)
|
||||
self.old_settings = Settings(self.common)
|
||||
self.old_settings.load()
|
||||
|
||||
close_after_first_download = self.old_settings.get("close_after_first_download")
|
||||
@ -1063,7 +1063,6 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
onion = Onion(self.common)
|
||||
onion.connect(
|
||||
custom_settings=settings,
|
||||
config=self.common.gui.config,
|
||||
tor_status_update_func=tor_status_update_func,
|
||||
)
|
||||
|
||||
@ -1109,7 +1108,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
def update_timestamp():
|
||||
# Update the last checked label
|
||||
settings = Settings(self.common, self.common.gui.config)
|
||||
settings = Settings(self.common)
|
||||
settings.load()
|
||||
autoupdate_timestamp = settings.get("autoupdate_timestamp")
|
||||
self._update_autoupdate_timestamp(autoupdate_timestamp)
|
||||
@ -1152,7 +1151,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
close_forced_update_thread()
|
||||
|
||||
forced_update_thread = UpdateThread(
|
||||
self.common, self.onion, self.common.gui.config, force=True
|
||||
self.common, self.onion, force=True
|
||||
)
|
||||
forced_update_thread.update_available.connect(update_available)
|
||||
forced_update_thread.update_not_available.connect(update_not_available)
|
||||
@ -1294,7 +1293,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
Return a Settings object that's full of values from the settings dialog.
|
||||
"""
|
||||
self.common.log("SettingsDialog", "settings_from_fields")
|
||||
settings = Settings(self.common, self.common.gui.config)
|
||||
settings = Settings(self.common)
|
||||
settings.load() # To get the last update timestamp
|
||||
|
||||
settings.set(
|
||||
|
@ -61,19 +61,18 @@ class UpdateChecker(QtCore.QObject):
|
||||
update_error = QtCore.pyqtSignal()
|
||||
update_invalid_version = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__(self, common, onion, config=False):
|
||||
def __init__(self, common, onion):
|
||||
super(UpdateChecker, self).__init__()
|
||||
|
||||
self.common = common
|
||||
|
||||
self.common.log("UpdateChecker", "__init__")
|
||||
self.onion = onion
|
||||
self.config = config
|
||||
|
||||
def check(self, force=False, config=False):
|
||||
def check(self, force=False):
|
||||
self.common.log("UpdateChecker", "check", f"force={force}")
|
||||
# Load the settings
|
||||
settings = Settings(self.common, config)
|
||||
settings = Settings(self.common)
|
||||
settings.load()
|
||||
|
||||
# If force=True, then definitely check
|
||||
@ -188,27 +187,26 @@ class UpdateThread(QtCore.QThread):
|
||||
update_error = QtCore.pyqtSignal()
|
||||
update_invalid_version = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__(self, common, onion, config=False, force=False):
|
||||
def __init__(self, common, onion, force=False):
|
||||
super(UpdateThread, self).__init__()
|
||||
|
||||
self.common = common
|
||||
|
||||
self.common.log("UpdateThread", "__init__")
|
||||
self.onion = onion
|
||||
self.config = config
|
||||
self.force = force
|
||||
|
||||
def run(self):
|
||||
self.common.log("UpdateThread", "run")
|
||||
|
||||
u = UpdateChecker(self.common, self.onion, self.config)
|
||||
u = UpdateChecker(self.common, self.onion)
|
||||
u.update_available.connect(self._update_available)
|
||||
u.update_not_available.connect(self._update_not_available)
|
||||
u.update_error.connect(self._update_error)
|
||||
u.update_invalid_version.connect(self._update_invalid_version)
|
||||
|
||||
try:
|
||||
u.check(config=self.config, force=self.force)
|
||||
u.check(force=self.force)
|
||||
except Exception as e:
|
||||
# If update check fails, silently ignore
|
||||
self.common.log("UpdateThread", "run", str(e))
|
||||
|
Loading…
Reference in New Issue
Block a user