mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
preserve position on model update; include fact count again
This commit is contained in:
parent
104c0a11cc
commit
9fd4003251
1 changed files with 6 additions and 4 deletions
|
@ -37,17 +37,19 @@ class Models(QDialog):
|
|||
self.form.modelsList.setCurrentRow(0)
|
||||
|
||||
def updateModelsList(self):
|
||||
row = self.form.modelsList.currentRow()
|
||||
if row == -1:
|
||||
row = 0
|
||||
mids = self.deck.db.list("select id from models order by name")
|
||||
self.models = [self.deck.getModel(mid) for mid in mids]
|
||||
self.form.modelsList.clear()
|
||||
for m in self.models:
|
||||
item = QListWidgetItem(m.name)
|
||||
item = QListWidgetItem(_("%(name)s [%(facts)d facts]") % dict(
|
||||
name=m.name, facts=m.useCount()))
|
||||
self.form.modelsList.addItem(item)
|
||||
# if foo:
|
||||
#self.form.modelsList.setCurrentItem(item)
|
||||
self.form.modelsList.setCurrentRow(row)
|
||||
|
||||
def modelChanged(self):
|
||||
print "changed"
|
||||
if self.model:
|
||||
self.saveModel()
|
||||
idx = self.form.modelsList.currentRow()
|
||||
|
|
Loading…
Reference in a new issue