mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
don't autorepeat delete key during review
This commit is contained in:
parent
73f8d1a457
commit
551c1cf662
1 changed files with 8 additions and 2 deletions
|
@ -27,6 +27,10 @@ class Reviewer(object):
|
|||
self.typeCorrect = None # web init happens before this is set
|
||||
self.state = None
|
||||
self.bottom = aqt.toolbar.BottomBar(mw, mw.bottomWeb)
|
||||
# qshortcut so we don't autorepeat
|
||||
self.delShortcut = QShortcut(QKeySequence("Delete"), self.mw)
|
||||
self.delShortcut.setAutoRepeat(False)
|
||||
self.mw.connect(self.delShortcut, SIGNAL("activated()"), self.onDelete)
|
||||
addHook("leech", self.onLeech)
|
||||
|
||||
def show(self):
|
||||
|
@ -284,8 +288,6 @@ The front of this card is empty. Please run Tools>Maintenance>Empty Cards.""")
|
|||
self._answerCard(int(key))
|
||||
elif key == "v":
|
||||
self.onReplayRecorded()
|
||||
elif evt.key() == Qt.Key_Delete:
|
||||
self.onDelete()
|
||||
|
||||
def _linkHandler(self, url):
|
||||
if url == "ans":
|
||||
|
@ -693,6 +695,10 @@ function showAnswer(txt) {
|
|||
self.mw.reset()
|
||||
|
||||
def onDelete(self):
|
||||
# need to check state because the shortcut is global to the main
|
||||
# window
|
||||
if self.mw.state != "review" or not self.card:
|
||||
return
|
||||
self.mw.checkpoint(_("Delete"))
|
||||
cnt = len(self.card.note().cards())
|
||||
self.mw.col.remNotes([self.card.note().id])
|
||||
|
|
Loading…
Reference in a new issue