From d88be5b8567557228532cb4b9ea91f22e95d0472 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 26 Apr 2023 19:11:48 +1000 Subject: [PATCH] Use correct default values for missing keys --- qt/aqt/browser/browser.py | 6 ++++-- qt/aqt/profiles.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py index 81b4a303e..bdfa26f47 100644 --- a/qt/aqt/browser/browser.py +++ b/qt/aqt/browser/browser.py @@ -406,7 +406,9 @@ class Browser(QMainWindow): self.form.searchEdit.lineEdit().setPlaceholderText( tr.browsing_search_bar_hint() ) - self.form.searchEdit.addItems([""] + self.mw.pm.profile.get("searchHistory")) + self.form.searchEdit.addItems( + [""] + self.mw.pm.profile.get("searchHistory", []) + ) if search is not None: self.search_for_terms(*search) else: @@ -451,7 +453,7 @@ class Browser(QMainWindow): showWarning(str(err)) def update_history(self) -> None: - sh = self.mw.pm.profile.get("searchHistory") + sh = self.mw.pm.profile.get("searchHistory", []) if self._lastSearchTxt in sh: sh.remove(self._lastSearchTxt) sh.insert(0, self._lastSearchTxt) diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index fa6a21bb5..c15cbffce 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -632,10 +632,10 @@ create table if not exists profiles self.profile["hostNum"] = val or 0 def media_syncing_enabled(self) -> bool: - return self.profile.get("syncMedia") + return self.profile.get("syncMedia", True) def auto_syncing_enabled(self) -> bool: - return self.profile.get("autoSync") + return self.profile.get("autoSync", True) def sync_auth(self) -> SyncAuth | None: if not (hkey := self.profile.get("syncKey")):