mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
user-friendly warning when mpv missing
This commit is contained in:
parent
e1a4c52175
commit
f7062ff0c6
1 changed files with 15 additions and 5 deletions
20
aqt/main.py
20
aqt/main.py
|
@ -22,10 +22,8 @@ import aqt.webview
|
||||||
import aqt.toolbar
|
import aqt.toolbar
|
||||||
import aqt.stats
|
import aqt.stats
|
||||||
import aqt.mediasrv
|
import aqt.mediasrv
|
||||||
|
from aqt.utils import showWarning
|
||||||
from anki.sound import setupMPV, cleanupMPV
|
import anki.sound
|
||||||
setupMPV()
|
|
||||||
|
|
||||||
from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
||||||
restoreState, getOnlyText, askUser, applyStyles, showText, tooltip, \
|
restoreState, getOnlyText, askUser, applyStyles, showText, tooltip, \
|
||||||
openHelp, openLink, checkInvalidFilename, getFile
|
openHelp, openLink, checkInvalidFilename, getFile
|
||||||
|
@ -72,6 +70,7 @@ class AnkiQt(QMainWindow):
|
||||||
self.setupKeys()
|
self.setupKeys()
|
||||||
self.setupThreads()
|
self.setupThreads()
|
||||||
self.setupMediaServer()
|
self.setupMediaServer()
|
||||||
|
self.setupSound()
|
||||||
self.setupMainWindow()
|
self.setupMainWindow()
|
||||||
self.setupSystemSpecific()
|
self.setupSystemSpecific()
|
||||||
self.setupStyle()
|
self.setupStyle()
|
||||||
|
@ -299,9 +298,20 @@ close the profile or restart Anki."""))
|
||||||
def cleanupAndExit(self):
|
def cleanupAndExit(self):
|
||||||
self.errorHandler.unload()
|
self.errorHandler.unload()
|
||||||
self.mediaServer.shutdown()
|
self.mediaServer.shutdown()
|
||||||
cleanupMPV()
|
anki.sound.cleanupMPV()
|
||||||
self.app.exit(0)
|
self.app.exit(0)
|
||||||
|
|
||||||
|
# Sound/video
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
def setupSound(self):
|
||||||
|
try:
|
||||||
|
anki.sound.setupMPV()
|
||||||
|
except FileNotFoundError:
|
||||||
|
showWarning(_("mpv is not installed - audio and video on cards will not work."))
|
||||||
|
anki.sound._player = lambda file: 1
|
||||||
|
anki.sound._queueEraser = lambda: 1
|
||||||
|
|
||||||
# Collection load/unload
|
# Collection load/unload
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue