mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Used showWarning asking the user to install pyaudio
This commit is contained in:
parent
b671c8e627
commit
0006269c01
1 changed files with 6 additions and 3 deletions
|
@ -27,9 +27,7 @@ from aqt.utils import restoreGeom, saveGeom, showWarning, startup_info
|
||||||
try:
|
try:
|
||||||
import pyaudio
|
import pyaudio
|
||||||
except:
|
except:
|
||||||
print(
|
pyaudio = None
|
||||||
"Warning: pyaudio is not installed and audio recording will not work! Install it with: python3 -m pip install pyaudio"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# AV player protocol
|
# AV player protocol
|
||||||
|
@ -526,6 +524,11 @@ Recorder = PyAudioRecorder
|
||||||
|
|
||||||
def getAudio(parent: QWidget, encode: bool = True) -> Optional[str]:
|
def getAudio(parent: QWidget, encode: bool = True) -> Optional[str]:
|
||||||
"Record and return filename"
|
"Record and return filename"
|
||||||
|
if not pyaudio:
|
||||||
|
showWarning(
|
||||||
|
"The Python pip `pyaudio` dependency is not installed and audio recording will not work!"
|
||||||
|
)
|
||||||
|
return None
|
||||||
# record first
|
# record first
|
||||||
r = Recorder()
|
r = Recorder()
|
||||||
mb = QMessageBox(parent)
|
mb = QMessageBox(parent)
|
||||||
|
|
Loading…
Reference in a new issue