Anki/qt/aqt
Damien Elmes 6b0fe4b381 undoable ops now return changes directly; add new *_ops.py files
- Introduced a new transact() method that wraps the return value
in a separate struct that describes the changes that were made.
- Changes are now gathered from the undo log, so we don't need to
guess at what was changed - eg if update_note() is called with identical
note contents, no changes are returned. Card changes will only be set
if cards were actually generated by the update_note() call, and tag
will only be set if a new tag was added.
- mw.perform_op() has been updated to expect the op to return the changes,
or a structure with the changes in it, and it will use them to fire the
change hook, instead of fetching the changes from undo_status(), so there
is no risk of race conditions.
- the various calls to mw.perform_op() have been split into separate
files like card_ops.py. Aside from making the code cleaner, this works
around a rather annoying issue with mypy. Because we run it with
no_strict_optional, mypy is happy to accept an operation that returns None,
despite the type signature saying it requires changes to be returned.
Turning no_strict_optional on for the whole codebase is not practical
at the moment, but we can enable it for individual files.

Still todo:
- The cursor keeps moving back to the start of a field when typing -
we need to ignore the refresh hook when we are the initiator.
- The busy cursor icon should probably be delayed a few hundreds ms.
- Still need to think about a nicer way of handling saveNow()
- op_made_changes(), op_affects_study_queue() might be better embedded
as properties in the object instead
2021-03-19 19:45:21 +10:00
..
data Remove explicit popperjs again, because it's included in bootstrap.bundle 2021-03-09 13:37:56 +01:00
forms Merge branch 'master' into sidebar-tools 2021-03-11 12:08:32 +01:00
__init__.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
about.py Update about screen 2021-03-10 11:34:28 +01:00
addcards.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
addons.py don't show routine update when not update_enabled 2021-03-09 22:27:28 +09:00
browser.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
BUILD.bazel winrt 1.0.20239.1 isn't available for python 3.9 2020-12-23 20:31:13 +10:00
card_ops.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
clayout.py commit immediately when there's no active checkpoint 2021-03-10 11:47:53 +10:00
colors.py move remaining Filter button items into sidebar 2021-02-05 18:58:22 +10:00
customstudy.py tweak search wording and tidy up API 2021-02-11 19:57:19 +10:00
dbcheck.py nest progress messages and remove Python wrapper class 2021-02-08 16:40:27 +10:00
deck_ops.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
deckbrowser.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
deckchooser.py Simplify note adding and the deck/notetype choosers 2021-03-10 11:53:27 +10:00
deckconf.py minor code cleanups with pyupgrade 2021-02-11 09:43:40 +10:00
dyndeckconf.py Make clickable dyndeck labels fixed in size 2021-03-01 11:26:52 +01:00
editcurrent.py commit immediately when there's no active checkpoint 2021-03-10 11:47:53 +10:00
editor.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
emptycards.py nest NoteWithEmptyCards 2021-02-08 19:11:16 +10:00
errors.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
exporting.py minor code cleanups with pyupgrade 2021-02-11 09:43:40 +10:00
fields.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
gui_hooks.py fix qt/ pylints 2021-01-07 16:21:50 +10:00
hooks_gen.py symlink generated .py/.pyi into tree to fix Python code completion 2020-12-16 11:36:42 +10:00
importing.py Simplify note adding and the deck/notetype choosers 2021-03-10 11:53:27 +10:00
legacy.py minor code cleanups with pyupgrade 2021-02-11 09:43:40 +10:00
main.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
mediacheck.py tweak search wording and tidy up API 2021-02-11 19:57:19 +10:00
mediasrv.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
mediasync.py nest progress messages and remove Python wrapper class 2021-02-08 16:40:27 +10:00
modelchooser.py Simplify note adding and the deck/notetype choosers 2021-03-10 11:53:27 +10:00
models.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
mpv.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
note_ops.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
notetypechooser.py Simplify note adding and the deck/notetype choosers 2021-03-10 11:53:27 +10:00
overview.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
pinnedmodules.py fix rsbackend compat issues 2021-02-08 09:51:51 +10:00
platform.py turn top bar dark when night mode enabled on macOS 2021-02-04 19:19:56 +10:00
preferences.py expand backend Preferences and make undoable 2021-03-10 18:51:03 +10:00
previewer.py remove unnecessary setMod() calls 2021-03-10 11:47:53 +10:00
profiles.py expand backend Preferences and make undoable 2021-03-10 18:51:03 +10:00
progress.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
py.typed mark anki and aqt modules as having typing info 2020-01-13 13:03:37 +10:00
qt.py more typing updates 2021-02-02 23:31:55 +10:00
reviewer.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
scheduling_ops.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
schema_change_tracker.py add a bunch of return types 2021-02-01 23:53:23 +10:00
sidebar.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
sound.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
stats.py commit immediately when there's no active checkpoint 2021-03-10 11:47:53 +10:00
studydeck.py Merge pull request #1040 from RumovZ/deck-name-err 2021-03-01 09:40:55 +10:00
sync.py nest progress messages and remove Python wrapper class 2021-02-08 16:40:27 +10:00
tagedit.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
taglimit.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
taskman.py more typing updates 2021-02-02 23:31:55 +10:00
theme.py minor code cleanups with pyupgrade 2021-02-11 09:43:40 +10:00
toolbar.py minor code cleanups with pyupgrade 2021-02-11 09:43:40 +10:00
tts.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
update.py more typing updates 2021-02-02 23:31:55 +10:00
utils.py undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
webview.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00
wheel_description.txt move aqt_data into source folder; implement wheel building 2020-11-04 12:14:03 +10:00
winpaths.py convert qt strings to f-strings with flynt 2021-02-11 10:09:06 +10:00