gui integration for mnemosyne

This commit is contained in:
Damien Elmes 2012-03-07 05:54:57 +09:00
parent 1d29c7bcc0
commit 869d665c22
4 changed files with 5 additions and 25 deletions

View file

@ -14,5 +14,6 @@ Importers = (
(_("Text separated by tabs or semicolons (*)"), TextImporter),
(_("Packaged Anki Deck (*.apkg)"), AnkiPackageImporter),
(_("Anki 1.2 Deck (*.anki)"), Anki1Importer),
(_("Mnemosyne 2.0 Deck (*.db)"), MnemosyneImporter),
(_("Supermemo XML export (*.xml)"), SupermemoXmlImporter),
)

View file

@ -11,6 +11,9 @@ from anki.stdmodels import addBasicModel
class MnemosyneImporter(NoteImporter):
needMapper = False
update = False
def run(self):
db = DB(self.file)
ver = db.scalar(

View file

@ -74,7 +74,7 @@ class NoteImporter(Importer):
def open(self):
"Open file and ensure it's in the right format."
assert 0
return
def importNotes(self, notes):
"Convert each card into a note, apply attributes and add to col."

View file

@ -119,30 +119,6 @@ def test_supermemo_xml_01_unicode():
assert i.total == 1
deck.close()
def test_updating():
print "disabled"; return
# get the standard csv deck first
deck = Deck()
deck.addModel(BasicModel())
file = unicode(os.path.join(testDir, "importing/text-2fields.txt"))
i = csvfile.TextImporter(deck, file)
i.run()
# now update
file = unicode(os.path.join(testDir, "importing/text-update.txt"))
i = csvfile.TextImporter(deck, file)
# first field
i.updateKey = (0, deck.currentModel.fieldModels[0].id)
i.multipleCardsAllowed = False
i.run()
ans = deck.db.scalar(
u"select answer from cards where question like '%食べる%'")
assert "to ate" in ans
# try again with tags
i.updateKey = (0, deck.currentModel.fieldModels[0].id)
i.mapping[1] = 0
i.run()
deck.close()
def test_mnemo():
deck = getEmptyDeck()
file = unicode(os.path.join(testDir, "support/mnemo.db"))