mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
option to disable sound autoplay
This commit is contained in:
parent
59f1707b17
commit
781324741a
5 changed files with 15 additions and 3 deletions
|
@ -43,6 +43,7 @@ class Config(dict):
|
||||||
fields = {
|
fields = {
|
||||||
'addZeroSpace': False,
|
'addZeroSpace': False,
|
||||||
'alternativeTheme': False,
|
'alternativeTheme': False,
|
||||||
|
'autoplaySounds': True,
|
||||||
'checkForUpdates': True,
|
'checkForUpdates': True,
|
||||||
'colourTimes': True,
|
'colourTimes': True,
|
||||||
'created': time.time(),
|
'created': time.time(),
|
||||||
|
|
|
@ -268,7 +268,7 @@ order by n""", id=card.id)
|
||||||
c)
|
c)
|
||||||
+ "</body></html>")
|
+ "</body></html>")
|
||||||
clearAudioQueue()
|
clearAudioQueue()
|
||||||
if not self.playedAudio:
|
if not self.playedAudio and self.mw.config['autoplaySounds']:
|
||||||
playFromText(c.question)
|
playFromText(c.question)
|
||||||
playFromText(c.answer)
|
playFromText(c.answer)
|
||||||
self.playedAudio = True
|
self.playedAudio = True
|
||||||
|
|
|
@ -219,6 +219,7 @@ class Preferences(QDialog):
|
||||||
self.dialog.deckBrowserOrder.setChecked(self.config['deckBrowserOrder'])
|
self.dialog.deckBrowserOrder.setChecked(self.config['deckBrowserOrder'])
|
||||||
self.dialog.deleteMedia.setChecked(self.config['deleteMedia'])
|
self.dialog.deleteMedia.setChecked(self.config['deleteMedia'])
|
||||||
self.dialog.stripHTML.setChecked(self.config['stripHTML'])
|
self.dialog.stripHTML.setChecked(self.config['stripHTML'])
|
||||||
|
self.dialog.autoplaySounds.setChecked(self.config['autoplaySounds'])
|
||||||
self.dialog.deckBrowserLen.setValue(self.config['deckBrowserNameLength'])
|
self.dialog.deckBrowserLen.setValue(self.config['deckBrowserNameLength'])
|
||||||
|
|
||||||
def updateAdvanced(self):
|
def updateAdvanced(self):
|
||||||
|
@ -234,6 +235,7 @@ class Preferences(QDialog):
|
||||||
self.config['showProgress'] = self.dialog.showProgress.isChecked()
|
self.config['showProgress'] = self.dialog.showProgress.isChecked()
|
||||||
self.config['preventEditUntilAnswer'] = self.dialog.preventEdits.isChecked()
|
self.config['preventEditUntilAnswer'] = self.dialog.preventEdits.isChecked()
|
||||||
self.config['stripHTML'] = self.dialog.stripHTML.isChecked()
|
self.config['stripHTML'] = self.dialog.stripHTML.isChecked()
|
||||||
|
self.config['autoplaySounds'] = self.dialog.autoplaySounds.isChecked()
|
||||||
self.config['loadLastDeck'] = self.dialog.openLastDeck.isChecked()
|
self.config['loadLastDeck'] = self.dialog.openLastDeck.isChecked()
|
||||||
if self.dialog.deckBrowserOrder.isChecked():
|
if self.dialog.deckBrowserOrder.isChecked():
|
||||||
self.config['deckBrowserOrder'] = 1
|
self.config['deckBrowserOrder'] = 1
|
||||||
|
|
|
@ -137,7 +137,8 @@ class View(object):
|
||||||
height = 45
|
height = 45
|
||||||
q = runFilter("drawQuestion", q, self.main.currentCard)
|
q = runFilter("drawQuestion", q, self.main.currentCard)
|
||||||
self.write(self.center(self.mungeQA(self.main.deck, q), height))
|
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)
|
playFromText(q)
|
||||||
|
|
||||||
def correct(self, a, b):
|
def correct(self, a, b):
|
||||||
|
@ -186,7 +187,7 @@ class View(object):
|
||||||
a = res + "<br>" + a
|
a = res + "<br>" + a
|
||||||
self.write(self.center('<span id=answer />'
|
self.write(self.center('<span id=answer />'
|
||||||
+ self.mungeQA(self.main.deck, a)))
|
+ self.mungeQA(self.main.deck, a)))
|
||||||
if self.state != self.oldState:
|
if self.state != self.oldState and self.main.config['autoplaySounds']:
|
||||||
playFromText(a)
|
playFromText(a)
|
||||||
|
|
||||||
def mungeQA(self, deck, txt):
|
def mungeQA(self, deck, txt):
|
||||||
|
|
|
@ -104,6 +104,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autoplaySounds">
|
||||||
|
<property name="text">
|
||||||
|
<string>Automatically play audio</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -697,6 +704,7 @@
|
||||||
<tabstop>showEstimates</tabstop>
|
<tabstop>showEstimates</tabstop>
|
||||||
<tabstop>showProgress</tabstop>
|
<tabstop>showProgress</tabstop>
|
||||||
<tabstop>preventEdits</tabstop>
|
<tabstop>preventEdits</tabstop>
|
||||||
|
<tabstop>autoplaySounds</tabstop>
|
||||||
<tabstop>mediaChoice</tabstop>
|
<tabstop>mediaChoice</tabstop>
|
||||||
<tabstop>mediaPath</tabstop>
|
<tabstop>mediaPath</tabstop>
|
||||||
<tabstop>syncUser</tabstop>
|
<tabstop>syncUser</tabstop>
|
||||||
|
|
Loading…
Reference in a new issue