Commit graph

6617 commits

Author SHA1 Message Date
Damien Elmes
f8e023d56b update Rust deps 2021-03-10 11:53:27 +10:00
Damien Elmes
1ba7f66413 when only sort field changed, we don't need to update ordinals 2021-03-10 11:53:27 +10:00
Damien Elmes
aff8df067d make flag changes in the reviewer undoable
This splits update_card() into separate undoable/non-undoable ops
like the change to notes in b4396b94abdeba3347d30025c5c0240d991006c9

It means that actions get a blanket 'Update Card' description - in the
future we'll probably want to either add specific actions to the backend,
or allow an enum or string to be passed in to describe the op.

Other changes:
- card.flush() can no longer be used to add new cards. Card creation
is only supposed to be done in response to changes in a note's fields,
and this functionality was only exposed because the card generation
hadn't been migrated to the backend at that point. As far as I'm aware,
only Arthur's "copy notes" add-on used this functionality, and that should
be an easy fix - when the new note is added, the associated cards will
be generated, and they can then be retrieved with note.cards()
- tidy ups/PEP8
2021-03-10 11:53:27 +10:00
Damien Elmes
15dc6766f2 coalesce note updates; avoid unnecessary saving due to mtime changes 2021-03-10 11:53:27 +10:00
Damien Elmes
254c9dab69 dispatch undo operations via enum instead of trait
To coalesce successive note edits into a single undo op we'll need to
be able to get the original Undoable type, which is awkward to do with
a trait object.
2021-03-10 11:53:27 +10:00
Damien Elmes
18fed218e4 move remaining undo ops into separate files 2021-03-10 11:53:27 +10:00
Damien Elmes
3fcd9f9640 move note undo into separate file 2021-03-10 11:53:27 +10:00
Damien Elmes
2e517b9a6d move card undo into separate file 2021-03-10 11:53:27 +10:00
Damien Elmes
8e9169b7c5 fix some clippy lints 2021-03-10 11:53:27 +10:00
Damien Elmes
7a58268617 make mark toggling undoable
- note.flush() behaves like before, as otherwise actions or add-ons
that perform bulk flushing would end up creating an undo entry for
each note
- added col.update_note() to opt in to the new behaviour
- tidy up the names of some related routines
2021-03-10 11:53:27 +10:00
Damien Elmes
a2a534551f undo support for bulk tag add/remove 2021-03-10 11:47:53 +10:00
Damien Elmes
1b6cc07e63 note deletion undo; refactoring
- transact() now automatically clears card queues unless an op
opts-out (and currently only AnswerCard does). This means there's no
risk of forgetting to clear the queues in an operation, or when undoing/
redoing
- CollectionOp->UndoableOp
- clear queues when redoing "answer card", instead of clearing redo
when clearing queues
2021-03-10 11:47:53 +10:00
Damien Elmes
d8fda47c66 undo support for note removing 2021-03-10 11:47:53 +10:00
Damien Elmes
be1bf89761 drop some unused properties 2021-03-10 11:47:53 +10:00
Damien Elmes
4d7c7e5b36 remove unnecessary setMod() calls 2021-03-10 11:47:53 +10:00
Damien Elmes
b1350727fc commit immediately when there's no active checkpoint
Reviews and operations on the backend that support undoing can now be
committed immediately, so they will not be lost in the event of a crash.

This required tweaks to a few places:

- don't set collection mtime on save() unless changes were made in
Python, as otherwise we end up accidentally clearing the backend undo
queue
- autosave() is now run on every reset()
- garbage collection now runs in a timer, instead of relying on
autosave() to be run periodically
2021-03-10 11:47:53 +10:00
Damien Elmes
3049612835 undo support for note adding 2021-03-10 11:47:53 +10:00
Damien Elmes
cb9b65188a undo unbury/unsuspend 2021-03-10 11:47:53 +10:00
Damien Elmes
eed798c7d6 fix notes being saved indiscriminately
caused by a commit a few days ago:

f61827657630ec0e6bbc5ca58c1a5ca131aede56
2021-03-10 11:47:53 +10:00
Damien Elmes
b05d7659ed implement bury/suspend undo 2021-03-10 11:47:53 +10:00
Damien Elmes
160c90b840 rework undo
- use dataclasses for the review/checkpoint undo cases, instead of the
nasty ad-hoc list structure
- expose backend review undo to Python, and hook it into GUI
- redo is not currently exposed on the GUI, and the backend can only
cope with reviews done by the new scheduler at the moment
- the initial undo prototype code was bumping mtime/usn on undo, but
that was not ideal, as it was breaking the queue handling which expected
the mtime to match. The original rationale for bumping mtime/usn was
to avoid problems with syncing, but various operations like removing
a revlog can't be synced anyway - so we just need to ensure we clear the
undo queue prior to syncing
2021-03-10 11:47:53 +10:00
Damien Elmes
60f7f1ca7d support undoing deck mutations
This required refactoring the deck code a bit to split up the 'update'
and 'add' cases better.
2021-03-10 11:47:53 +10:00
Damien Elmes
e5aeb69728 initial work on undoing reviews+burying siblings
- fetch sfld and csum when fetching notes, to make it cheaper
to write them back out unmodified
- make `fields` private, and access it via accessors, so we can
still catch when fields have been mutated without calling
prepare_for_update()
- fix python importing code passing a string in as the checksum
2021-03-10 11:47:53 +10:00
Damien Elmes
c887ca07df use native struct for QueuedCard 2021-03-10 11:47:53 +10:00
Damien Elmes
3aaec61216 Merge pull request #1046 from hgiesel/sticky
Sticky icons in the editor window
2021-03-10 11:43:51 +10:00
Damien Elmes
91892aa816 Merge pull request #1050 from BlueGreenMagick/choose-addon-to-update
Choose addon to update
2021-03-10 11:41:50 +10:00
Damien Elmes
647291f0cc bump version 2021-03-10 11:11:45 +10:00
Damien Elmes
c5e60d3ab8 update translations 2021-03-10 10:46:34 +10:00
bluegreenmagick
2600d89850 don't show routine update when not update_enabled 2021-03-09 22:27:28 +09:00
bluegreenmagick
7ccfb61154 add context menu to open ankiweb page 2021-03-09 22:19:03 +09:00
bluegreenmagick
328ecb9ec3 add bool_to_check and checked method 2021-03-09 22:19:03 +09:00
bluegreenmagick
aa58d3922e fix check issues in ChooseAddonsToUpdateList 2021-03-09 22:19:03 +09:00
bluegreenmagick
fa95d36bf9 save chooseaddonupdate check state 2021-03-09 22:19:03 +09:00
Henrik Giesel
f56c510e86 Fix another import 2021-03-09 14:02:41 +01:00
Henrik Giesel
4424ae864b Fix reversed sticky icon logic 2021-03-09 13:44:06 +01:00
Henrik Giesel
1ae13b7217 Satisfy formatter 2021-03-09 13:43:11 +01:00
Henrik Giesel
df20381a9e Change to pin icon 2021-03-09 13:43:11 +01:00
Henrik Giesel
2ea0602347 Switch to bi-sticky icons, toggle opacity for state indiciation 2021-03-09 13:43:11 +01:00
Henrik Giesel
94355978a2 Refactor bridgeCommand and silence false "uncaught msg" log 2021-03-09 13:43:11 +01:00
Henrik Giesel
e72b5d6e14 Switch back to pin icons, use fill/unfilled versions 2021-03-09 13:43:11 +01:00
Henrik Giesel
df562c7c4c Place sticky icons at the far right end of the labelContainer 2021-03-09 13:43:11 +01:00
Henrik Giesel
3a8fad5dc5 Make sure topleft buttons are rounded too, prefer Bootstrap's rounded class 2021-03-09 13:43:11 +01:00
Henrik Giesel
d8e8153aae Change signature of editor onBridgeCmd to Any instead of None 2021-03-09 13:43:11 +01:00
Henrik Giesel
59c69bd8dd Replace pin icon with lock icon
Credit goes out to @kleinerpirat
2021-03-09 13:43:11 +01:00
Henrik Giesel
b580e192f4 Remove Change Tracker again 2021-03-09 13:43:11 +01:00
Henrik Giesel
f98ba1e412 Remove button highlight on disabling button (i.e. blur) 2021-03-09 13:43:09 +01:00
Henrik Giesel
5bba8cbfd9 Remove "true" return value from event handler
* this does not change any semantics
2021-03-09 13:41:39 +01:00
Henrik Giesel
e94fbdbc38 Separate index.ts into editable/editingArea/editorField/labelContainer.ts 2021-03-09 13:40:47 +01:00
Henrik Giesel
3f96290214 Connect icons to sticky fields values 2021-03-09 13:37:56 +01:00
Henrik Giesel
07e3812072 Add visual elements for pinned fields 2021-03-09 13:37:56 +01:00