mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
work around video focus stealing
https://anki.tenderapp.com/discussions/ankidesktop/27401-bug-when-playing-a-video-on-anki-for-mac-anki-lanches-mplayer-and-doesnt-quit-it-or-return-to-anki
This commit is contained in:
parent
693bb955ad
commit
47370af7c3
2 changed files with 10 additions and 1 deletions
|
@ -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():
|
||||
|
|
|
@ -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
|
||||
##########################################################################
|
||||
|
||||
|
|
Loading…
Reference in a new issue