mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
update the editor in real time
This commit is contained in:
parent
212bae412b
commit
4908ca96bc
1 changed files with 11 additions and 0 deletions
|
@ -147,6 +147,13 @@ class DeckModel(QAbstractTableModel):
|
||||||
self.cards = self.deck.s.all(query)
|
self.cards = self.deck.s.all(query)
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
|
def updateCard(self, index):
|
||||||
|
self.cards[index.row()] = self.deck.s.first("""
|
||||||
|
select id, priority, question, answer, due, reps, factId
|
||||||
|
from cards where id = :id""", id=self.cards[index.row()][0])
|
||||||
|
self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"),
|
||||||
|
index, self.index(index.row(), 1))
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
@ -192,6 +199,7 @@ class EditDeck(QMainWindow):
|
||||||
self.deck = self.parent.deck
|
self.deck = self.parent.deck
|
||||||
self.config = parent.config
|
self.config = parent.config
|
||||||
self.origModTime = parent.deck.modified
|
self.origModTime = parent.deck.modified
|
||||||
|
self.currentRow = None
|
||||||
self.dialog = ankiqt.forms.cardlist.Ui_MainWindow()
|
self.dialog = ankiqt.forms.cardlist.Ui_MainWindow()
|
||||||
self.dialog.setupUi(self)
|
self.dialog.setupUi(self)
|
||||||
# flush all changes before we load
|
# flush all changes before we load
|
||||||
|
@ -341,6 +349,9 @@ class EditDeck(QMainWindow):
|
||||||
self.dialog.actionRedo.setEnabled(True)
|
self.dialog.actionRedo.setEnabled(True)
|
||||||
else:
|
else:
|
||||||
self.dialog.actionRedo.setEnabled(False)
|
self.dialog.actionRedo.setEnabled(False)
|
||||||
|
# update list
|
||||||
|
if self.currentRow:
|
||||||
|
self.model.updateCard(self.currentRow)
|
||||||
|
|
||||||
def filterTextChanged(self):
|
def filterTextChanged(self):
|
||||||
interval = 500
|
interval = 500
|
||||||
|
|
Loading…
Reference in a new issue