From 869d665c229313d3be92d0b34ac67d37300e2dc8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 7 Mar 2012 05:54:57 +0900 Subject: [PATCH] gui integration for mnemosyne --- anki/importing/__init__.py | 1 + anki/importing/mnemo.py | 3 +++ anki/importing/noteimp.py | 2 +- tests/test_importing.py | 24 ------------------------ 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/anki/importing/__init__.py b/anki/importing/__init__.py index 997694cf6..a2259c592 100644 --- a/anki/importing/__init__.py +++ b/anki/importing/__init__.py @@ -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), ) diff --git a/anki/importing/mnemo.py b/anki/importing/mnemo.py index 8b8b79103..fa4d302c9 100644 --- a/anki/importing/mnemo.py +++ b/anki/importing/mnemo.py @@ -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( diff --git a/anki/importing/noteimp.py b/anki/importing/noteimp.py index 7bdef12ff..22c7156eb 100644 --- a/anki/importing/noteimp.py +++ b/anki/importing/noteimp.py @@ -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." diff --git a/tests/test_importing.py b/tests/test_importing.py index a665acfaa..a36202f1b 100644 --- a/tests/test_importing.py +++ b/tests/test_importing.py @@ -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"))