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.
We were previously relying on the DB progress hook to cause the
progress window to display.
Qt's progress dialogs do have built in support for automatically
showing, but it's easier to add a timer than change the existing
code to use it.
I hope to use this in oder to had features to the web view. In
particular, I expect the "spell checking" feature to use it
hopefully. Because currently it's incompatible with other add-on
dealing with the editor
The problem was caused by stop() doing a spin loop on the main
thread waiting for the completion signal. This prevented Qt's run
loop from executing, and so the completion signal was never delivered,
meaning longer files would time out.
Fixed by reworking the code so that stop() does not block at all -
instead it just sets the termination flag, and AVPlayer does not
unset current_player. Then when the completion callback fires, it
can advance to the next file.
TTS code still needs updating, and the lock should be safe to remove
as the start/stop logic is all on the main thread.
The error should be in "error_msg"
They can show:
* the original error message with {problem}
* the path of the error with {path},
* the value which does not match against the subchema with {error}
* the subschema against which the error occurs with {schema}
Thanks to Glutanimate for the idea https://github.com/ankitects/anki/pull/495#issuecomment-596685227
AD devs: before updating the sync version to 10, please make sure
the new timezone code has been ported over. The core change to the
scheduler is in _updateCutoff():
9736e4a970/pylib/anki/schedv2.py (L1357)
with the following supporting Python functions:
9736e4a970/pylib/anki/schedv2.py (L1410)
_timing_today() is calculated in Rust (lines up to 92, the rest are
tests):
9736e4a970/rslib/src/sched/cutoff.rs (L20)
The change went through a few iterations before stabilising, so it's
probably easier to refer to the above code than the patches that got
us to that point.