From 9936f6f7d12b1adb7044c8b1f7e1f0f680477958 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Sun, 16 Jan 2022 04:46:01 +0100 Subject: [PATCH] Only warn once about missing av player (#1592) --- qt/aqt/sound.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 80ffef6c2..1e2e39448 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -275,6 +275,7 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method self._taskman = taskman self._terminate_flag = False self._process: subprocess.Popen | None = None + self._warned_about_missing_player = False def play(self, tag: AVTag, on_done: OnDoneCallback) -> None: self._terminate_flag = False @@ -334,7 +335,9 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method try: ret.result() except FileNotFoundError: - showWarning(tr.media_sound_and_video_on_cards_will()) + if not self._warned_about_missing_player: + showWarning(tr.media_sound_and_video_on_cards_will()) + self._warned_about_missing_player = True # must call cb() here, as we don't currently have another way # to flag to av_player that we've stopped cb()