mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 10:12:38 +02:00
Revert "Propagate "update check" prompt to UI checkbox"
This reverts commit 3915a86642502b673aa0e47931823acbe66f1043.
This commit is contained in:
parent
1695cc7a6c
commit
8221a56c7d
4 changed files with 3 additions and 16 deletions
|
@ -123,7 +123,6 @@ def gui_main(
|
||||||
# Check for updates
|
# Check for updates
|
||||||
log.debug("Setting up Dangezone updater")
|
log.debug("Setting up Dangezone updater")
|
||||||
updater = UpdaterThread(dangerzone)
|
updater = UpdaterThread(dangerzone)
|
||||||
updater.update_check_toggled.connect(window.refresh_updates_checkbox)
|
|
||||||
window.register_update_handler(updater.finished)
|
window.register_update_handler(updater.finished)
|
||||||
|
|
||||||
log.debug("Consulting updater settings before checking for updates")
|
log.debug("Consulting updater settings before checking for updates")
|
||||||
|
|
|
@ -229,11 +229,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
self.dangerzone.settings.set("updater_check", check)
|
self.dangerzone.settings.set("updater_check", check)
|
||||||
self.dangerzone.settings.save()
|
self.dangerzone.settings.save()
|
||||||
|
|
||||||
def refresh_updates_checkbox(self) -> None:
|
|
||||||
"""Refreshes the "check for updates" checkbox according to the settings"""
|
|
||||||
check = self.dangerzone.settings.get("updater_check")
|
|
||||||
self.toggle_updates_action.setChecked(check)
|
|
||||||
|
|
||||||
def handle_updates(self, report: UpdateReport) -> None:
|
def handle_updates(self, report: UpdateReport) -> None:
|
||||||
"""Handle update reports from the update checker thread.
|
"""Handle update reports from the update checker thread.
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,6 @@ class UpdaterThread(QtCore.QThread):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
finished = QtCore.Signal(UpdateReport)
|
finished = QtCore.Signal(UpdateReport)
|
||||||
update_check_toggled = QtCore.Signal()
|
|
||||||
|
|
||||||
GH_RELEASE_URL = (
|
GH_RELEASE_URL = (
|
||||||
"https://api.github.com/repos/freedomofpress/dangerzone/releases/latest"
|
"https://api.github.com/repos/freedomofpress/dangerzone/releases/latest"
|
||||||
|
@ -178,7 +177,6 @@ class UpdaterThread(QtCore.QThread):
|
||||||
if self.check is None:
|
if self.check is None:
|
||||||
log.debug("User has not been asked yet for update checks")
|
log.debug("User has not been asked yet for update checks")
|
||||||
self.check = self.prompt_for_checks()
|
self.check = self.prompt_for_checks()
|
||||||
self.update_check_toggled.emit()
|
|
||||||
return bool(self.check)
|
return bool(self.check)
|
||||||
elif not self.check:
|
elif not self.check:
|
||||||
log.debug("User has expressed that they don't want to check for updates")
|
log.debug("User has expressed that they don't want to check for updates")
|
||||||
|
|
|
@ -141,10 +141,7 @@ def test_linux_no_check(updater: UpdaterThread, monkeypatch: MonkeyPatch) -> Non
|
||||||
|
|
||||||
|
|
||||||
def test_user_prompts(
|
def test_user_prompts(
|
||||||
qtbot: QtBot,
|
updater: UpdaterThread, monkeypatch: MonkeyPatch, mocker: MockerFixture
|
||||||
updater: UpdaterThread,
|
|
||||||
monkeypatch: MonkeyPatch,
|
|
||||||
mocker: MockerFixture,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test prompting users to ask them if they want to enable update checks."""
|
"""Test prompting users to ask them if they want to enable update checks."""
|
||||||
# First run
|
# First run
|
||||||
|
@ -168,10 +165,8 @@ def test_user_prompts(
|
||||||
# Check disabling update checks.
|
# Check disabling update checks.
|
||||||
prompt_mock().launch.return_value = False # type: ignore [attr-defined]
|
prompt_mock().launch.return_value = False # type: ignore [attr-defined]
|
||||||
expected_settings["updater_check"] = False
|
expected_settings["updater_check"] = False
|
||||||
|
assert updater.should_check_for_updates() == False
|
||||||
with qtbot.waitSignal(updater.update_check_toggled) as blocker:
|
assert updater.dangerzone.settings.get_updater_settings() == expected_settings
|
||||||
assert updater.should_check_for_updates() == False
|
|
||||||
assert updater.dangerzone.settings.get_updater_settings() == expected_settings
|
|
||||||
|
|
||||||
# Reset the "updater_check" field and check enabling update checks.
|
# Reset the "updater_check" field and check enabling update checks.
|
||||||
updater.dangerzone.settings.set("updater_check", None)
|
updater.dangerzone.settings.set("updater_check", None)
|
||||||
|
|
Loading…
Reference in a new issue