fix type answer
This commit is contained in:
parent
2d5affd3f2
commit
06169de6cd
@ -273,7 +273,7 @@ The front of this card is empty. Please run Tools>Empty Cards.""")
|
|||||||
self.mw.onEditCurrent()
|
self.mw.onEditCurrent()
|
||||||
elif (key == " " or evt.key() in (Qt.Key_Return, Qt.Key_Enter)):
|
elif (key == " " or evt.key() in (Qt.Key_Return, Qt.Key_Enter)):
|
||||||
if self.state == "question":
|
if self.state == "question":
|
||||||
self._showAnswer()
|
self._getTypedAnswer()
|
||||||
elif self.state == "answer":
|
elif self.state == "answer":
|
||||||
self._answerCard(self._defaultEase())
|
self._answerCard(self._defaultEase())
|
||||||
elif key == "r" or evt.key() == Qt.Key_F5:
|
elif key == "r" or evt.key() == Qt.Key_F5:
|
||||||
@ -299,16 +299,13 @@ The front of this card is empty. Please run Tools>Empty Cards.""")
|
|||||||
|
|
||||||
def _linkHandler(self, url):
|
def _linkHandler(self, url):
|
||||||
if url == "ans":
|
if url == "ans":
|
||||||
self._showAnswer()
|
self._getTypedAnswer()
|
||||||
elif url.startswith("ease"):
|
elif url.startswith("ease"):
|
||||||
self._answerCard(int(url[4:]))
|
self._answerCard(int(url[4:]))
|
||||||
elif url == "edit":
|
elif url == "edit":
|
||||||
self.mw.onEditCurrent()
|
self.mw.onEditCurrent()
|
||||||
elif url == "more":
|
elif url == "more":
|
||||||
self.showContextMenu()
|
self.showContextMenu()
|
||||||
elif url.startswith("typeans:"):
|
|
||||||
(cmd, arg) = url.split(":", 1)
|
|
||||||
self.typedAnswer = arg
|
|
||||||
else:
|
else:
|
||||||
openLink(url)
|
openLink(url)
|
||||||
|
|
||||||
@ -491,6 +488,13 @@ Please run Tools>Empty Cards""")
|
|||||||
res = "<div><code id=typeans>" + res + "</code></div>"
|
res = "<div><code id=typeans>" + res + "</code></div>"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _getTypedAnswer(self):
|
||||||
|
self.web.evalWithCallback("typeans ? typeans.value : null", self._onTypedAnswer)
|
||||||
|
|
||||||
|
def _onTypedAnswer(self, val):
|
||||||
|
self.typedAnswer = val
|
||||||
|
self._showAnswer()
|
||||||
|
|
||||||
# Bottom bar
|
# Bottom bar
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user