diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 36041650d..07a69b4dc 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -332,6 +332,8 @@ close the profile or restart Anki.""" if not self.loadCollection(): return + self.pm.apply_profile_options() + # show main window if self.pm.profile["mainWindowState"]: restoreGeom(self, "mainWindow") diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 53714d911..7d964f746 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.pasteInvert.setChecked(self.prof.get("pasteInvert", False)) self.form.showPlayButtons.setChecked(self.prof.get("showPlayButtons", True)) self.form.nightMode.setChecked(self.mw.pm.night_mode()) + self.form.interrupt_audio.setChecked(self.mw.pm.interrupt_audio()) def updateOptions(self): restart_required = False @@ -242,5 +243,7 @@ Not currently enabled; click the sync button in the main window to enable.""" self.mw.pm.set_night_mode(not self.mw.pm.night_mode()) restart_required = True + self.mw.pm.set_interrupt_audio(self.form.interrupt_audio.isChecked()) + if restart_required: showInfo(_("Changes will take effect when you restart Anki.")) diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index 51ee3c8de..9b7f0c26c 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -481,7 +481,7 @@ please see: elif mode == "angle": self.setGlMode("software") - # Helpers + # Shared options ###################################################################### def uiScale(self) -> float: @@ -501,3 +501,18 @@ please see: def set_night_mode(self, on: bool) -> None: self.meta["night_mode"] = on + + # Profile-specific options + ###################################################################### + + def interrupt_audio(self) -> bool: + return self.profile.get("interrupt_audio", True) + + def set_interrupt_audio(self, val: bool) -> None: + self.profile["interrupt_audio"] = val + aqt.sound.av_player.interrupt_current_audio = val + + ###################################################################### + + def apply_profile_options(self) -> None: + aqt.sound.av_player.interrupt_current_audio = self.interrupt_audio() diff --git a/qt/designer/preferences.ui b/qt/designer/preferences.ui index 87e80b9bb..3e7c9fca4 100644 --- a/qt/designer/preferences.ui +++ b/qt/designer/preferences.ui @@ -7,7 +7,7 @@ 0 0 422 - 586 + 611 @@ -94,6 +94,13 @@ + + + + Interrupt current audio when answering + + + @@ -522,6 +529,7 @@ showEstimates showProgress showPlayButtons + interrupt_audio pastePNG pasteInvert nightMode