Damien Elmes 2018-04-30 17:12:26 +10:00
parent 693bb955ad
commit 47370af7c3
2 changed files with 10 additions and 1 deletions

View file

@ -5,7 +5,7 @@
import html
import re, sys, threading, time, subprocess, os, atexit
import random
from anki.hooks import addHook
from anki.hooks import addHook, runHook
from anki.utils import tmpdir, isWin, isMac, isLin
# Shared utils
@ -114,6 +114,9 @@ class MpvManager(MPV):
def seekRelative(self, secs):
self.command("seek", secs, "relative")
def on_idle(self):
runHook("mpvIdleHook")
mpvManager = None
def setupMPV():

View file

@ -958,12 +958,18 @@ Difference to correct time: %s.""") % diffText
addHook("modSchema", self.onSchemaMod)
addHook("remNotes", self.onRemNotes)
addHook("odueInvalid", self.onOdueInvalid)
addHook("mpvIdleHook", self.onMpvIdle)
def onOdueInvalid(self):
showWarning(_("""\
Invalid property found on card. Please use Tools>Check Database, \
and if the problem comes up again, please ask on the support site."""))
def onMpvIdle(self):
# when audio player finishes playing, restore focus to anki window
self.activateWindow()
self.raise_()
# Log note deletion
##########################################################################