Beispiel #1
0
 def __init__(self, col: _Collection, file: str) -> None:
     NoteImporter.__init__(self, col, file)
     self.opened = False
     self.workbook = None
     self.worksheet = None
     self.tagsToAdd: List[str] = []
     self.numFields = 0
Beispiel #2
0
 def __init__(self, col, file):
     NoteImporter.__init__(self, col, file)
     self.lines = None
     self.fileobj = None
     self.delimiter = None
     self.tagsToAdd = []
     self.numFields = 0
Beispiel #3
0
 def __init__(self, col, table, view, api_key, app_key):
     NoteImporter.__init__(self, col, "")
     self.records = None
     self.table = table
     self.view = view
     self.api_key = api_key
     self.app_key = app_key
Beispiel #4
0
 def __init__(self, col: Collection, file: str) -> None:
     NoteImporter.__init__(self, col, file)
     self.lines = None
     self.fileobj: Optional[TextIO] = None
     self.delimiter: Optional[str] = None
     self.tagsToAdd: List[str] = []
     self.numFields = 0
     self.dialect: Optional[Any]
     self.data: Optional[Union[str, List[str]]]
    def __init__(self, col, file):
        NoteImporter.__init__(self, col, file)
        self.model = col.models.byName(MODEL_NAME)
        self.mappingFields = [f['name'] for f in self.model['flds']]
        self.mapping = None
        self.fileDir = os.path.dirname(file)

        did = col.decks.id(DECK_NAME)
        col.decks.select(did)
        deck = col.decks.get(did)
        deck['mid'] = self.model['id']
        col.decks.save(deck)
Beispiel #6
0
    def __init__(self, col, file):
        NoteImporter.__init__(self, col, file)
        self.model = col.models.byName(MODEL_NAME)
        self.mappingFields = [f['name'] for f in self.model['flds']]
        self.mapping = None
        self.fileDir = os.path.dirname(file)

        did = col.decks.id(DECK_NAME)
        col.decks.select(did)
        deck = col.decks.get(did)
        deck['mid'] = self.model['id']
        col.decks.save(deck)
Beispiel #7
0
 def __init__(self, *args):
     # excerpt from TextImporter (csvfile.py)
     NoteImporter.__init__(self, *args)
     self.fileobj = None
     # preamble and postamble are saved in the following variables,
     # but they are not actually processed by the current version
     # of LatexImporter:
     self.preamble = ""
     self.postamble = ""
     # noteList will contain all ForeignNotes that have been imported:
     self.noteList = []
     # the log will be built from a list of warnings and a list
     # of text passages that have been ignored
     self.log = []
     self.rubbishList = []
     self.warningList = []
Beispiel #8
0
 def __init__(self, col, file):
     NoteImporter.__init__(self, col, file)
     self.model = col.models.byName(X_MODEL_NAME)
     self.sheets = None
     self.mw = aqt.mw
     self.currentSheetImport = dict()
     self.mediaDir = os.path.join(os.path.dirname(col.path),
                                  'collection.media')
     self.srcDir = tempfile.mkdtemp()
     self.xZip = zipfile.ZipFile(file, 'r')
     self.warnings = []
     self.deckId = ''
     self.notesToAdd = dict()
     self.running = True
     self.soup = BeautifulSoup(self.xZip.read('content.xml'),
                               features='html.parser')
     self.tagList = self.soup('topic')
     self.repair = False
Beispiel #9
0
    def __init__(self, *args):
        """Initialize internal varables.
        Pameters to be exposed to GUI are stored in self.META"""
        NoteImporter.__init__(self, *args)
        m = addBasicModel(self.col)
        m['name'] = "Supermemo"
        self.col.models.save(m)
        self.initMapping()

        self.lines = None
        self.numFields = int(2)

        # SmXmlParse VARIABLES
        self.xmldoc = None
        self.pieces = []
        self.cntBuf = []  # to store last parsed data
        self.cntElm = []  # to store SM Elements data
        self.cntCol = []  # to store SM Colections data

        # store some meta info related to parse algorithm
        # SmartDict works like dict / class wrapper
        self.cntMeta = SmartDict()
        self.cntMeta.popTitles = False
        self.cntMeta.title = []

        # META stores controls of import scritp, should be
        # exposed to import dialog. These are default values.
        self.META = SmartDict()
        self.META.resetLearningData = False  # implemented
        self.META.onlyMemorizedItems = False  # implemented
        self.META.loggerLevel = 2             # implemented
        # 0no,1info,2error,3debug
        self.META.tagAllTopics = True
        # path patterns to be tagged - in gui entered like 'Advanced
        # English 97|My Vocablary'
        self.META.pathsToBeTagged = ['English for begginers',  # sic
                                     'Advanced English 97',
                                     'Phrasal Verbs']
        self.META.tagMemorizedItems = True              # implemented
        self.META.logToStdOutput = False              # implemented

        self.notes = []
Beispiel #10
0
    def __init__(self, col: Collection, file: str) -> None:
        """Initialize internal varables.
        Pameters to be exposed to GUI are stored in self.META"""
        NoteImporter.__init__(self, col, file)
        m = addBasicModel(self.col)
        m["name"] = "Supermemo"
        self.col.models.save(m)
        self.initMapping()

        self.lines = None
        self.numFields = int(2)

        # SmXmlParse VARIABLES
        self.xmldoc = None
        self.pieces = []
        self.cntBuf = []  # to store last parsed data
        self.cntElm = []  # to store SM Elements data
        self.cntCol = []  # to store SM Colections data

        # store some meta info related to parse algorithm
        # SmartDict works like dict / class wrapper
        self.cntMeta = SmartDict()
        self.cntMeta.popTitles = False
        self.cntMeta.title = []

        # META stores controls of import scritp, should be
        # exposed to import dialog. These are default values.
        self.META = SmartDict()
        self.META.resetLearningData = False  # implemented
        self.META.onlyMemorizedItems = False  # implemented
        self.META.loggerLevel = 2  # implemented 0no,1info,2error,3debug
        self.META.tagAllTopics = True
        self.META.pathsToBeTagged = [
            "English for begginers",
            "Advanced English 97",
            "Phrasal Verbs",
        ]  # path patterns to be tagged - in gui entered like 'Advanced English 97|My Vocablary'
        self.META.tagMemorizedItems = True  # implemented
        self.META.logToStdOutput = False  # implemented

        self.notes = []
Beispiel #11
0
 def __init__(self, col, file_, model_name=None, deck_name=None):
     NoteImporter.__init__(self, col, file_)
     self._setup_model(model_name, deck_name, file_)
Beispiel #12
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self.allowHTML = True # see NoteImporter
Beispiel #13
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self._data = None
 def __init__(self, col, wordlist_id):
     NoteImporter.__init__(self, col, "")
     self.records = None
     self.wordlist_id = wordlist_id
Beispiel #15
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self.lines = None
     self.fileobj = None
     self.delimiter = None
     self.tagsToAdd = []
Beispiel #16
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self.lines = None
     self.fileobj = None
     self.delimiter = None
     self.tagsToAdd = []
Beispiel #17
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self.allowHTML = True
     self.bDeck = None
     self.tagsToAdd = []
Beispiel #18
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self.fileOpen = None
Beispiel #19
0
 def __init__(self, *args):
     NoteImporter.__init__(self, *args)
     self.allowHTML = True
     self.availableIds = set()
Beispiel #20
0
 def __init__(self, col, file_, model_name=None, deck_name=None):
     NoteImporter.__init__(self, col, file_)
     self._setup_model(model_name, deck_name, file_)