mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
cleanup recording on cancel
This commit is contained in:
parent
7a9508ea75
commit
95387af2cd
2 changed files with 6 additions and 2 deletions
|
@ -334,13 +334,16 @@ class _Recorder:
|
|||
except:
|
||||
ret = True
|
||||
finally:
|
||||
if os.path.exists(processingSrc):
|
||||
os.unlink(processingSrc)
|
||||
self.cleanup()
|
||||
if ret:
|
||||
raise Exception(_(
|
||||
"Error running %s") %
|
||||
" ".join(cmd))
|
||||
|
||||
def cleanup(self):
|
||||
if os.path.exists(processingSrc):
|
||||
os.unlink(processingSrc)
|
||||
|
||||
class PyAudioThreadedRecorder(threading.Thread):
|
||||
|
||||
def __init__(self, startupDelay):
|
||||
|
|
|
@ -40,6 +40,7 @@ def getAudio(parent, encode=True):
|
|||
QApplication.instance().processEvents()
|
||||
if mb.clickedButton() == mb.escapeButton():
|
||||
r.stop()
|
||||
r.cleanup()
|
||||
return
|
||||
saveGeom(mb, "audioRecorder")
|
||||
# ensure at least a second captured
|
||||
|
|
Loading…
Reference in a new issue