mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
save fields before moving between cards
This commit is contained in:
parent
5eaefa9d47
commit
dee16171ea
1 changed files with 4 additions and 0 deletions
|
@ -884,18 +884,21 @@ where id in %s""" % ids2str(sf))
|
|||
def onFirstCard(self):
|
||||
if not self.model.cards:
|
||||
return
|
||||
self.editor.saveFieldsNow()
|
||||
self.dialog.tableView.selectionModel().clear()
|
||||
self.dialog.tableView.selectRow(0)
|
||||
|
||||
def onLastCard(self):
|
||||
if not self.model.cards:
|
||||
return
|
||||
self.editor.saveFieldsNow()
|
||||
self.dialog.tableView.selectionModel().clear()
|
||||
self.dialog.tableView.selectRow(len(self.model.cards) - 1)
|
||||
|
||||
def onPreviousCard(self):
|
||||
if not self.model.cards:
|
||||
return
|
||||
self.editor.saveFieldsNow()
|
||||
row = self.dialog.tableView.currentIndex().row()
|
||||
row = max(0, row - 1)
|
||||
self.dialog.tableView.selectionModel().clear()
|
||||
|
@ -904,6 +907,7 @@ where id in %s""" % ids2str(sf))
|
|||
def onNextCard(self):
|
||||
if not self.model.cards:
|
||||
return
|
||||
self.editor.saveFieldsNow()
|
||||
row = self.dialog.tableView.currentIndex().row()
|
||||
row = min(len(self.model.cards) - 1, row + 1)
|
||||
self.dialog.tableView.selectionModel().clear()
|
||||
|
|
Loading…
Reference in a new issue