diff --git a/ankiqt/config.py b/ankiqt/config.py index d8a37f04c..8e171bca7 100644 --- a/ankiqt/config.py +++ b/ankiqt/config.py @@ -43,6 +43,7 @@ class Config(dict): fields = { 'addZeroSpace': False, 'alternativeTheme': False, + 'autoplaySounds': True, 'checkForUpdates': True, 'colourTimes': True, 'created': time.time(), diff --git a/ankiqt/ui/clayout.py b/ankiqt/ui/clayout.py index 3d36b2d4c..046799966 100644 --- a/ankiqt/ui/clayout.py +++ b/ankiqt/ui/clayout.py @@ -268,7 +268,7 @@ order by n""", id=card.id) c) + "") clearAudioQueue() - if not self.playedAudio: + if not self.playedAudio and self.mw.config['autoplaySounds']: playFromText(c.question) playFromText(c.answer) self.playedAudio = True diff --git a/ankiqt/ui/preferences.py b/ankiqt/ui/preferences.py index 30f78d10a..a21f5a3a3 100644 --- a/ankiqt/ui/preferences.py +++ b/ankiqt/ui/preferences.py @@ -219,6 +219,7 @@ class Preferences(QDialog): self.dialog.deckBrowserOrder.setChecked(self.config['deckBrowserOrder']) self.dialog.deleteMedia.setChecked(self.config['deleteMedia']) self.dialog.stripHTML.setChecked(self.config['stripHTML']) + self.dialog.autoplaySounds.setChecked(self.config['autoplaySounds']) self.dialog.deckBrowserLen.setValue(self.config['deckBrowserNameLength']) def updateAdvanced(self): @@ -234,6 +235,7 @@ class Preferences(QDialog): self.config['showProgress'] = self.dialog.showProgress.isChecked() self.config['preventEditUntilAnswer'] = self.dialog.preventEdits.isChecked() self.config['stripHTML'] = self.dialog.stripHTML.isChecked() + self.config['autoplaySounds'] = self.dialog.autoplaySounds.isChecked() self.config['loadLastDeck'] = self.dialog.openLastDeck.isChecked() if self.dialog.deckBrowserOrder.isChecked(): self.config['deckBrowserOrder'] = 1 diff --git a/ankiqt/ui/view.py b/ankiqt/ui/view.py index b7afd2fa0..705114e95 100644 --- a/ankiqt/ui/view.py +++ b/ankiqt/ui/view.py @@ -137,7 +137,8 @@ class View(object): height = 45 q = runFilter("drawQuestion", q, self.main.currentCard) self.write(self.center(self.mungeQA(self.main.deck, q), height)) - if self.state != self.oldState and not nosound: + if (self.state != self.oldState and not nosound + and self.main.config['autoplaySounds']): playFromText(q) def correct(self, a, b): @@ -186,7 +187,7 @@ class View(object): a = res + "
" + a self.write(self.center('' + self.mungeQA(self.main.deck, a))) - if self.state != self.oldState: + if self.state != self.oldState and self.main.config['autoplaySounds']: playFromText(a) def mungeQA(self, deck, txt): diff --git a/designer/preferences.ui b/designer/preferences.ui index a30268e37..cbd1a6c90 100644 --- a/designer/preferences.ui +++ b/designer/preferences.ui @@ -104,6 +104,13 @@ + + + + Automatically play audio + + + @@ -697,6 +704,7 @@ showEstimates showProgress preventEdits + autoplaySounds mediaChoice mediaPath syncUser