Related to: https://github.com/ankitects/anki/pull 529
Ensuring "setNote" is called only once during changing of note type
After debugging the code, every time the cards changes, there are
two stacktraces generated and triggered when note cards change:
calling 1590591251.4621403
File "qt/runanki", line 4, in <module>
File "F:\anki\qt\aqt\__init__.py", line 365, in run
_run()
File "F:\anki\qt\aqt\__init__.py", line 515, in _run
app.exec()
File "F:\anki\qt\aqt\webview.py", line 467, in handler
cb(val)
File "F:\anki\qt\aqt\editor.py", line 477, in <lambda>
self.web.evalWithCallback("saveNow(%d)" % keepFocus, lambda res: callback())
File "F:\anki\qt\aqt\browser.py", line 858, in <lambda>
self.editor.saveNow(lambda: self._onRowChanged(current, previous))
File "F:\anki\qt\aqt\browser.py", line 880, in _onRowChanged
self._renderPreview(True)
File "F:\anki\qt\aqt\browser.py", line 1576, in _renderPreview
self._previewer.render_card(cardChanged)
File "F:\anki\qt\aqt\previewer.py", line 136, in render_card
print('calling', time.time(), "\n", "".join( traceback.format_stack() ) )
calling 1590591251.4766161
File "qt/runanki", line 4, in <module>
File "F:\anki\qt\aqt\__init__.py", line 365, in run
_run()
File "F:\anki\qt\aqt\__init__.py", line 515, in _run
app.exec()
File "F:\anki\qt\aqt\webview.py", line 467, in handler
cb(val)
File "F:\anki\qt\aqt\editor.py", line 453, in oncallback
gui_hooks.editor_did_load_note(self)
File "F:\anki\qt\aqt\gui_hooks.py", line 1168, in __call__
hook(editor)
File "F:\anki\qt\aqt\browser.py", line 887, in onLoadNote
self.refreshCurrentCard(editor.note)
File "F:\anki\qt\aqt\browser.py", line 884, in refreshCurrentCard
self._renderPreview(False)
File "F:\anki\qt\aqt\browser.py", line 1576, in _renderPreview
self._previewer.render_card(cardChanged)
File "F:\anki\qt\aqt\previewer.py", line 136, in render_card
print('calling', time.time(), "\n", "".join( traceback.format_stack() ) )
- notetypes are fetched from the DB as needed, and cached in Python
- handle note type changes in the backend. Multiple operations can now
be performed in one go, but this is not currently exposed in the GUI.
- extra methods to grab sorted note type names quickly, and fetch by
name
- col.models.save() without a provided notetype is now a no-op
- note loading/saving handled in the backend
- notes with no valid cards can now be added
- templates can now be deleted even if they would previously
orphan notes
a number of fixmes have been left in notes.py and models.py
- mtime is tracked on each key individually, which will allow
merging of config changes when syncing in the future
- added col.(get|set|remove)_config()
- in order to support existing code that was mutating returned
values (eg col.conf["something"]["another"] = 5), the returned list/dict
will be automatically wrapped so that when the value is dropped, it
will save the mutated item back to the DB if it's changed. Code that
is fetching lists/dicts from the config like so:
col.conf["foo"]["bar"] = baz
col.setMod()
will continue to work in most case, but should be gradually updated to:
conf = col.get_config("foo")
conf["bar"] = baz
col.set_config("foo", conf)
- tag list stored in a separate DB table
- non-wildcard searches now do full unicode case folding
(eg tag:masse matches 'Maße')
- wildcard matches do simple unicode case folding
- some functions haven't been updated yet, so ascii folding will
continue to be used in some operations