mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
focus lost hook needs to be a filter
This commit is contained in:
parent
4bbd644e0a
commit
e81cfc616f
2 changed files with 12 additions and 4 deletions
|
@ -6,7 +6,7 @@ from aqt.qt import *
|
|||
import re, os, sys, urllib2, ctypes, simplejson, traceback
|
||||
from anki.utils import stripHTML, isWin, isMac, namedtmp
|
||||
from anki.sound import play
|
||||
from anki.hooks import runHook
|
||||
from anki.hooks import runHook, runFilter
|
||||
from aqt.sound import getAudio
|
||||
from aqt.webview import AnkiWebView
|
||||
from aqt.utils import shortcut, showInfo, showWarning, getBase, getFile, \
|
||||
|
@ -399,7 +399,16 @@ class Editor(object):
|
|||
if type == "blur":
|
||||
if not self._keepButtons:
|
||||
self.disableButtons()
|
||||
runHook("editFocusLost", self.note)
|
||||
# run any filters
|
||||
if runFilter(
|
||||
"editFocusLost", False, self.note, self.currentField):
|
||||
# something updated the note; schedule reload
|
||||
def onUpdate():
|
||||
self.loadNote()
|
||||
self.checkValid()
|
||||
self.mw.progress.timer(100, onUpdate, False)
|
||||
else:
|
||||
self.checkValid()
|
||||
else:
|
||||
runHook("editTimer", self.note)
|
||||
self.checkValid()
|
||||
|
|
|
@ -86,6 +86,5 @@ class ModelChooser(QHBoxLayout):
|
|||
self.models.addItems([m['name'] for m in self._models])
|
||||
for c, m in enumerate(self._models):
|
||||
if m['id'] == self.deck.conf['curModel']:
|
||||
print "current", c
|
||||
self.models.setCurrentIndex(c)
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue