From a59097ce6ccb72939442390134ea7ec9ef1eec33 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 17 Jan 2009 13:54:10 +0900 Subject: [PATCH] add sound back, disable 'replay current' in current editor --- ankiqt/ui/main.py | 1 + ankiqt/ui/sound.py | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) mode change 120000 => 100644 ankiqt/ui/sound.py diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 93570aec2..a24476e05 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -274,6 +274,7 @@ Please do not file a bug report with Anki.

""") elif state == "editCurrentFact": if self.lastState == "editCurrentFact": return self.moveToState("saveEdit") + self.mainWin.actionRepeatAudio.setEnabled(False) self.deck.s.flush() self.showEditor() elif state == "saveEdit": diff --git a/ankiqt/ui/sound.py b/ankiqt/ui/sound.py deleted file mode 120000 index 137c7c171..000000000 --- a/ankiqt/ui/sound.py +++ /dev/null @@ -1 +0,0 @@ -resolve@twitch.ichi2.net.12462:1231199561 \ No newline at end of file diff --git a/ankiqt/ui/sound.py b/ankiqt/ui/sound.py new file mode 100644 index 000000000..987d18c46 --- /dev/null +++ b/ankiqt/ui/sound.py @@ -0,0 +1,38 @@ +# Copyright: Damien Elmes +# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +import time +from anki.sound import Recorder, play + +def getAudio(parent, string=""): + "Record and return filename" + # record first + r = Recorder() + mb = QMessageBox(parent) + but = QPushButton(_(" Stop")) + but.setIcon(QIcon(":/icons/media-playback-stop.png")) + but.setIconSize(QSize(32, 32)) + mb.addButton(but, QMessageBox.RejectRole) + mb.show() + mb.setText("Recording..") + QApplication.instance().processEvents() + r.start() + mb.exec_() + r.stop() + # process + r.postprocess() + return r.file() + +def recordNoiseProfile(parent): + r = Recorder() + mb = QMessageBox(parent) + mb.show() + f = time.time() + 8 + r.start() + while f > time.time(): + mb.setText("Sampling silence...%0.1f" % f - time.time()) + QApplication.instance().processEvents() + r.stop()