I have an add-on which allow to open multiple windows. So would like to know which browser has done the search. This
would allow me to have browser with various setting. In particular, I've an add-on which allow to show a single line by
note, and I would like for some browser to have this feature on and for some other to have this feature off.
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
This uses exactly the same code, with one exception. In the previewer
`self` became `self.parent` in order to have action on the
browser. And in the browser, some `self` become `self.previewer` to
access the previewer. (Some function having an action on the previewer
starting from the browser now are separated in two. One version in the
previewer doing the same thing. One version in the browser, calling
the version in the previewer if it exists.)
Preview dialog now takes a QWidget in general, not necesarrily a
Browser. The parameter is called parent
This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
- avoid rounding minutes
- round the seconds taken in the card info screen
- provide different precise and imprecise modes, since we need
to display seconds to multiple decimals in some areas
- all .ftl files for a language are concatenated into a single file
at build time
- all languages are included in the binary
- external ftl files placed in the ftl folder can override the
built-in definitions
- constants are automatically generated for each string key
- dropped the separate StringsGroup enum