diff --git a/qt/aqt/main.py b/qt/aqt/main.py
index 8940065b2..e9368440f 100644
--- a/qt/aqt/main.py
+++ b/qt/aqt/main.py
@@ -396,6 +396,15 @@ close the profile or restart Anki."""
def setupSound(self) -> None:
aqt.sound.setup_audio(self.taskman, self.pm.base)
+ def process_av_tags(self, text: str) -> Tuple[str, List[AVTag]]:
+ "Return card text with play buttons added, and the extracted AV tags."
+ tags = self.col.backend.get_av_tags(text)
+ if self.pm.profile.get("showPlayButtons", True):
+ text = aqt.sound.av_flags_to_html(self.col.backend.flag_av_tags(text))
+ else:
+ text = self.col.backend.strip_av_tags(text)
+ return (text, tags)
+
# Collection load/unload
##########################################################################
diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py
index a789ec236..669c828ad 100644
--- a/qt/aqt/preferences.py
+++ b/qt/aqt/preferences.py
@@ -226,6 +226,7 @@ Not currently enabled; click the sync button in the main window to enable."""
self.form.pastePNG.setChecked(self.prof.get("pastePNG", False))
self.form.uiScale.setValue(self.mw.pm.uiScale() * 100)
self.form.pasteInvert.setChecked(self.prof.get("pasteInvert", False))
+ self.form.showPlayButtons.setChecked(self.prof.get("showPlayButtons", True))
def updateOptions(self):
self.prof["pastePNG"] = self.form.pastePNG.isChecked()
@@ -234,3 +235,4 @@ Not currently enabled; click the sync button in the main window to enable."""
if newScale != self.mw.pm.uiScale():
self.mw.pm.setUiScale(newScale)
showInfo(_("Changes will take effect when you restart Anki."))
+ self.prof["showPlayButtons"] = self.form.showPlayButtons.isChecked()
diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py
index 5ee5ec3ec..3091fea4d 100644
--- a/qt/aqt/reviewer.py
+++ b/qt/aqt/reviewer.py
@@ -18,7 +18,7 @@ from anki.sound import AVTag
from anki.utils import bodyClass, stripHTML
from aqt import AnkiQt, gui_hooks
from aqt.qt import *
-from aqt.sound import av_player, getAudio, process_av_tags
+from aqt.sound import av_player, getAudio
from aqt.utils import (
askUserDialog,
downArrow,
@@ -192,7 +192,7 @@ The front of this card is empty. Please run Tools>Empty Cards."""
else:
q = c.q()
- q, self._current_side_audio = process_av_tags(self.mw.col, q)
+ q, self._current_side_audio = self.mw.process_av_tags(q)
if self.autoplay(c):
av_player.play_tags(self._current_side_audio)
@@ -236,7 +236,7 @@ The front of this card is empty. Please run Tools>Empty Cards."""
c = self.card
a = c.a()
# play audio?
- a, self._current_side_audio = process_av_tags(self.mw.col, a)
+ a, self._current_side_audio = self.mw.process_av_tags(a)
if self.autoplay(c):
av_player.play_tags(self._current_side_audio)
a = self._mungeQA(a)
diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py
index 9f46b0ede..1d71c6589 100644
--- a/qt/aqt/sound.py
+++ b/qt/aqt/sound.py
@@ -585,17 +585,6 @@ for (k, v) in _exports:
# Tag handling
##########################################################################
-
-def process_av_tags(
- col: anki.storage._Collection, text: str
-) -> Tuple[str, List[AVTag]]:
- "Return card text with play buttons added, and the extracted AV tags."
- return (
- av_flags_to_html(col.backend.flag_av_tags(text)),
- col.backend.get_av_tags(text),
- )
-
-
AV_FLAG_RE = re.compile(r"\[anki:play\](\d+)\[/anki:play]")
diff --git a/qt/designer/preferences.ui b/qt/designer/preferences.ui
index bcbc77e73..2f638ceb3 100644
--- a/qt/designer/preferences.ui
+++ b/qt/designer/preferences.ui
@@ -6,8 +6,8 @@
0
0
- 423
- 508
+ 422
+ 579
@@ -87,6 +87,13 @@
+ -
+
+
+ Show play buttons on cards with audio
+
+
+
-
@@ -514,6 +521,7 @@
hwAccel
showEstimates
showProgress
+ showPlayButtons
pastePNG
pasteInvert
nightMode