From 940f1dea0694a056c2611f83ce640b11267dfcc0 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 9 Jun 2022 12:08:16 +1000 Subject: [PATCH] Clear cached flag names on sync Closes #1907 --- qt/aqt/flags.py | 4 ++++ qt/aqt/main.py | 1 + 2 files changed, 5 insertions(+) diff --git a/qt/aqt/flags.py b/qt/aqt/flags.py index ee4100056..c41767a0d 100644 --- a/qt/aqt/flags.py +++ b/qt/aqt/flags.py @@ -55,6 +55,10 @@ class FlagManager: self.mw.col.set_config("flagLabels", labels) gui_hooks.flag_label_did_change() + def require_refresh(self) -> None: + "Discard cached labels." + self._flags = None + def _load_flags(self) -> None: labels = cast(dict[str, str], self.mw.col.get_config("flagLabels", {})) icon = ColoredIcon(path="icons:flag.svg", color=colors.DISABLED) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 501e456b0..c836230e0 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -953,6 +953,7 @@ title="{}" {}>{}""".format( def _refresh_after_sync(self) -> None: self.toolbar.redraw() + self.flags.require_refresh() def _sync_collection_and_media(self, after_sync: Callable[[], None]) -> None: "Caller should ensure auth available."