_fields -> fields

This commit is contained in:
Damien Elmes 2011-04-13 22:44:41 +09:00
parent 2245be962a
commit 8865ca6131
6 changed files with 15 additions and 11 deletions

View file

@ -93,9 +93,9 @@ class AddCards(QDialog):
# copy fields from old fact
if oldFact:
self.removeTempFact(oldFact)
for n in range(len(fact._fields)):
for n in range(len(fact.fields)):
try:
fact._fields[n] = oldFact._fields[n]
fact.fields[n] = oldFact.fields[n]
except IndexError:
break
self.editor.setFact(fact)
@ -107,7 +107,7 @@ class AddCards(QDialog):
self.mw.deck._delFacts([fact.id])
def addHistory(self, fact):
txt = stripHTMLMedia(",".join(fact._fields))[:30]
txt = stripHTMLMedia(",".join(fact.fields))[:30]
self.history.append((fact.id, txt))
self.history = self.history[-15:]
self.historyButton.setEnabled(True)

View file

@ -195,7 +195,7 @@ class DeckModel(QAbstractTableModel):
return self.formatQA(c.a())
elif type == "factFld":
f = c.fact()
return self.formatQA(f._fields[f.model().sortIdx()])
return self.formatQA(f.fields[f.model().sortIdx()])
elif type == "template":
return c.template()['name']
elif type == "cardDue":

View file

@ -311,7 +311,7 @@ class Editor(object):
# focus lost or key/button pressed?
if str.startswith("blur") or str.startswith("key"):
(type, txt) = str.split(":", 1)
self.fact._fields[self.currentField] = self.mungeHTML(txt)
self.fact.fields[self.currentField] = self.mungeHTML(txt)
if type == "blur":
if not self._keepButtons:
self.disableButtons()
@ -405,7 +405,7 @@ class Editor(object):
def fieldsAreBlank(self):
if not self.fact:
return True
for f in self.fact._fields:
for f in self.fact.fields:
if f:
return False
return True
@ -420,10 +420,10 @@ class Editor(object):
form.setupUi(d)
d.connect(form.buttonBox, SIGNAL("helpRequested()"),
lambda: aqt.openHelp("HtmlEditor"))
form.textEdit.setPlainText(self.fact._fields[self.currentField])
form.textEdit.setPlainText(self.fact.fields[self.currentField])
form.textEdit.moveCursor(QTextCursor.End)
d.exec_()
self.fact._fields[self.currentField] = unicode(
self.fact.fields[self.currentField] = unicode(
form.textEdit.toPlainText())
self.loadFact(self.currentField)
@ -503,7 +503,7 @@ class Editor(object):
showInfo(_("Please add a cloze deletion model."),
help="ClozeDeletion")
return
f = self.fact._fields[self.currentField]
f = self.fact.fields[self.currentField]
# find the highest existing cloze
m = re.findall("\{\{c(\d+)::", f)
if m:

View file

@ -238,7 +238,7 @@ title="%s">%s</button>''' % (
def onUpgrade(self, db):
self.upgrading = True
self.progress.setupDB(db)
self.progress.start(label=_("Upgrading..."))
self.progress.start(label=_("Upgrading. Please be patient..."))
# Deck loading
##########################################################################

View file

@ -6,6 +6,10 @@ import time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
# fixme: if mw->subwindow opens a progress dialog with mw as the parent, mw
# gets raised on finish on compiz. perhaps we should be using the progress
# dialog as the parent?
# Progress info
##########################################################################

View file

@ -378,7 +378,7 @@ div#filler {
ord = self.typeAns()
try:
cor = self.mw.deck.media.strip(
stripHTML(self.card.fact()._fields[ord]))
stripHTML(self.card.fact().fields[ord]))
except IndexError:
self.card.template()['typeAns'] = None
self.card.model().flush()