The old `media_files_did_export` hook has been kept around for use with
the legacy apkg exporter (an add-on uses it), and a new
`legacy_export_progress` hook has been added so we can get progress
from the new colpkg exporter until we move over fully to the new code.
* The importer list have a Hook
Previously, add-on 175027074 simply edited the list once. It became impossible
since the list became a function. Hence I need a filter to add the list here.
@kelciour (nice to meet you by the way), you may be interested by it too (at
least if I believe efb1ce46d4 )
I would have preferred to use `anki.importing.base.Importer` instead of
`Any`. However, this leads to
> Name "anki.importing.base.Importer" is not defined [name-defined]
when I run test.
Helps to solve this would be welcomed
* mention the hook may not last too long (dae)
* Add py3.9 to hooks
This follows examples from efb1ce46d4 I assume the
hooks were missed because those were not considered types but strings.
I did not even try to run pyupgrade and did the change manually, then used bazel format
* remove wildcard import in find.py, and change Any to object (dae)
The explicit flush was clearing undo history, and the hook will need
re-working to support propagating OpChanges correctly. It will likely
come back as a GUI hook, instead of one in pylib.
- QueueConfig is only used by the scheduler
- DeckConfig was being used in places that Config should have been used
- Add "Dict" to the name so that the bare name is free for use with a
stronger type.
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:
- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
- 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
It often arrives that I want to know when a card is going to be
flushed and in this case change it.
This could be the case if I want to change the scheduler without
implementing a whole scheduler. It simply reads the card history and
change interval and due date.
It's also the case for the "'trigger -> action' rules", which apply
some coded actions when some event occurs. E.g. suspend/unsuspend a
sibling when card become mature/is forgotten.
I created multiple add-ons which want to transform a note before it is
being saved. For example, one add-on trim it, and remove useless line
break which arrived by accident.
Another add-on want to compile LaTeX as soon as the note is done, and
warn the user if LaTeX can't be compiled.
Having a hook in pre-flush would be useful here
- _renderQA() has moved to template.py:render_card()
- dropped QAData in favour of a properly typed dict
- render_card() returns a TemplateRenderOutput struct instead of a dict
- card_did_render now takes that output as the first arg, and can
mutate it
- TemplateRenderContext now stores the original card, so it can return
a card even in the add screen case
The old mungeFields and mungeQA hook have been removed as part of this
change. mungeQA can be replaced with the card_did_render hook.
In the mungeFields case, please switch to using field_filter instead.
- the context exists for the lifecycle of one card's render,
and caches calls to things like .card() to avoid add-ons needing to
do their own cache management.
- add-ons can optionally add extra data to the context if they need
it across multiple filters
- removed card_will_render. the legacy hook is still available for
now
- card_did_render is now called only once, with both front and back
text
Still todo:
- Add separate module for GUI hooks
- Update the remaining runHook/runFilter() calls
- Document the changes, including defensive registration