add cancel button to recording window
This commit is contained in:
parent
4967275973
commit
7af591cfd7
@ -891,7 +891,8 @@ to a cloze type first, via Edit>Change Note Type."""))
|
||||
"Couldn't record audio. Have you installed lame and sox?") +
|
||||
"\n\n" + repr(str(e)))
|
||||
return
|
||||
self.addMedia(file)
|
||||
if file:
|
||||
self.addMedia(file)
|
||||
|
||||
# Media downloads
|
||||
######################################################################
|
||||
|
10
aqt/sound.py
10
aqt/sound.py
@ -15,10 +15,11 @@ def getAudio(parent, encode=True):
|
||||
restoreGeom(mb, "audioRecorder")
|
||||
mb.setWindowTitle("Anki")
|
||||
mb.setIconPixmap(QPixmap(":/icons/media-record.png"))
|
||||
but = QPushButton(_(" Stop"))
|
||||
but.setIcon(QIcon(":/icons/media-playback-stop.png"))
|
||||
#but.setIconSize(QSize(32, 32))
|
||||
but = QPushButton(_("Save"))
|
||||
mb.addButton(but, QMessageBox.AcceptRole)
|
||||
but = QPushButton(_("Cancel"))
|
||||
mb.addButton(but, QMessageBox.RejectRole)
|
||||
mb.setEscapeButton(but)
|
||||
t = time.time()
|
||||
r.start()
|
||||
QApplication.instance().processEvents()
|
||||
@ -27,6 +28,9 @@ def getAudio(parent, encode=True):
|
||||
mb.setText(txt % (time.time() - t))
|
||||
mb.show()
|
||||
QApplication.instance().processEvents()
|
||||
if mb.clickedButton() == mb.escapeButton():
|
||||
r.stop()
|
||||
return
|
||||
saveGeom(mb, "audioRecorder")
|
||||
# ensure at least a second captured
|
||||
while time.time() - t < 1:
|
||||
|
Loading…
Reference in New Issue
Block a user