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:
|
||||
import pyaudio
|
||||
except:
|
||||
print(
|
||||
"Warning: pyaudio is not installed and audio recording will not work! Install it with: python3 -m pip install pyaudio"
|
||||
)
|
||||
pyaudio = None
|
||||
|
||||
|
||||
# AV player protocol
|
||||
|
@ -526,6 +524,11 @@ Recorder = PyAudioRecorder
|
|||
|
||||
def getAudio(parent: QWidget, encode: bool = True) -> Optional[str]:
|
||||
"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
|
||||
r = Recorder()
|
||||
mb = QMessageBox(parent)
|
||||
|
|
Loading…
Reference in a new issue