Used showWarning asking the user to install pyaudio

This commit is contained in:
evandrocoan 2020-05-04 23:45:06 -03:00
parent b671c8e627
commit 0006269c01

View file

@ -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)