From 52f4f832ff7e5526ab53aec0eca8df3ae3ee5365 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 29 Feb 2020 21:05:37 +1000 Subject: [PATCH] restore mpv/mplayer missing warning that got lost in the av changes and ensure the UI doesn't get temporarily stuck after the command fails --- qt/aqt/errors.py | 6 ------ qt/aqt/sound.py | 11 +++++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qt/aqt/errors.py b/qt/aqt/errors.py index 5b1655fd3..503602357 100644 --- a/qt/aqt/errors.py +++ b/qt/aqt/errors.py @@ -82,12 +82,6 @@ your system's temporary folder may be incorrect.""" ) if "Pyaudio not" in error: return showWarning(_("Please install PyAudio")) - if "install mplayer" in error: - return showWarning( - _( - "Sound and video on cards will not function until mpv or mplayer is installed." - ) - ) if "no default input" in error.lower(): return showWarning( _( diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 508a9611c..16611950c 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -1,6 +1,5 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - import atexit import os import re @@ -25,7 +24,7 @@ from aqt import gui_hooks from aqt.mpv import MPV, MPVBase from aqt.qt import * from aqt.taskman import TaskManager -from aqt.utils import restoreGeom, saveGeom, startup_info +from aqt.utils import restoreGeom, saveGeom, showWarning, startup_info # AV player protocol ########################################################################## @@ -291,6 +290,14 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method except PlayerInterrupted: # don't fire done callback when interrupted return + except FileNotFoundError: + showWarning( + _( + "Sound and video on cards will not function until mpv or mplayer is installed." + ) + ) + # must call cb() here, as we don't currently have another way + # to flag to av_player that we've stopped cb()