mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix display of images on older qt versions when answer shown via keystroke
This commit is contained in:
parent
d351d4e9cc
commit
bbbff0ca32
1 changed files with 10 additions and 2 deletions
|
@ -142,7 +142,7 @@ function _getTypedText () {
|
||||||
};
|
};
|
||||||
function _typeAnsPress() {
|
function _typeAnsPress() {
|
||||||
if (window.event.keyCode === 13) {
|
if (window.event.keyCode === 13) {
|
||||||
py.link("ans");
|
py.link("ansHack");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -253,12 +253,18 @@ The front of this card is empty. Please run Tools>Maintenance>Empty Cards.""")
|
||||||
self.web.eval("$('#typeans').blur();")
|
self.web.eval("$('#typeans').blur();")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _showAnswerHack(self):
|
||||||
|
# on <qt4.8, calling _showAnswer() directly fails to show images on
|
||||||
|
# the answer side. But if we trigger it via the bottom web's python
|
||||||
|
# link, it inexplicably works.
|
||||||
|
self.bottom.web.eval("py.link('ans');")
|
||||||
|
|
||||||
def _keyHandler(self, evt):
|
def _keyHandler(self, evt):
|
||||||
key = unicode(evt.text())
|
key = unicode(evt.text())
|
||||||
if key == "e":
|
if key == "e":
|
||||||
self.mw.onEditCurrent()
|
self.mw.onEditCurrent()
|
||||||
elif key == " " and self.state == "question":
|
elif key == " " and self.state == "question":
|
||||||
self._showAnswer()
|
self._showAnswerHack()
|
||||||
elif key == "r":
|
elif key == "r":
|
||||||
self.replayAudio()
|
self.replayAudio()
|
||||||
elif key == "*":
|
elif key == "*":
|
||||||
|
@ -281,6 +287,8 @@ The front of this card is empty. Please run Tools>Maintenance>Empty Cards.""")
|
||||||
def _linkHandler(self, url):
|
def _linkHandler(self, url):
|
||||||
if url == "ans":
|
if url == "ans":
|
||||||
self._showAnswer()
|
self._showAnswer()
|
||||||
|
elif url == "ansHack":
|
||||||
|
self.mw.progress.timer(100, self._showAnswerHack, False)
|
||||||
elif url.startswith("ease"):
|
elif url.startswith("ease"):
|
||||||
self._answerCard(int(url[4:]))
|
self._answerCard(int(url[4:]))
|
||||||
elif url == "edit":
|
elif url == "edit":
|
||||||
|
|
Loading…
Reference in a new issue