Commit Graph

6902 Commits

Author SHA1 Message Date
RumovZ
c11a394753 Remove prompt when deleting from deckbrowser 2021-03-11 10:28:23 +01:00
Damien Elmes
984e2c2666 add a separate 'rename deck' method 2021-03-11 19:24:54 +10:00
RumovZ
5d93832713 Run background tasks with progress 2021-03-11 10:04:58 +01:00
RumovZ
f1dd010489 Remove deck remove prompt but show card count 2021-03-11 09:52:11 +01:00
RumovZ
3219bb2539 Remove prompt when deleting saved searches 2021-03-11 09:20:41 +01:00
RumovZ
337ef0ae21 Show count of affected notes after tag renaming 2021-03-11 09:17:22 +01:00
RumovZ
186a0202ea Show tooltip instead of prompt for removing tags 2021-03-11 09:14:50 +01:00
Damien Elmes
4bd120cc4b split out remaining rpc methods
@david-allison-1 note this also changes the method index to start at
0 instead of 1
2021-03-11 17:04:32 +10:00
Damien Elmes
378b116977 split out stats, media and search 2021-03-11 16:16:40 +10:00
Damien Elmes
cd14987812 split out tags, deck config and card rendering 2021-03-11 16:05:06 +10:00
Damien Elmes
1b8d6c6e85 split out sync, notetypes and config code 2021-03-11 15:47:31 +10:00
Damien Elmes
5df684fa6b rework backend codegen to support multiple services; split out sched
Rust requires all methods of impl Trait to be in a single file, which
means we had a giant backend/mod.rs covering all exposed methods. By
using separate service definitions for the separate areas, and updating
the code generation, we can split it into more manageable chunks -
this commit starts with the scheduling code.

In the long run, we'll probably want to split up the protobuf file into
multiple files as well.

Also dropped want_release_gil() from rsbridge, and the associated method
enum. While it allows us to skip the thread save/restore and mutex unlock/
lock, it looks to only be buying about 2.5% extra performance in the
best case (tested with timeit+format_timespan), and the majority of
the backend methods deal with I/O, and thus were already releasing the
GIL.
2021-03-11 14:51:29 +10:00
Damien Elmes
060293c8f5
Merge pull request #1064 from BlueGreenMagick/fix-sidebar-click
Clicking the expander icon should not trigger click event
2021-03-11 10:19:55 +10:00
bluegreenmagick
38ae2f2b06 Clicking the expander icon should not trigger click event
Expander icon does not change currentIndex
2021-03-11 09:04:24 +09:00
Damien Elmes
763800ad9a
Merge pull request #1063 from hgiesel/edithtmlfix
Fix bug with initially enabled toolbar in browser
2021-03-11 10:02:41 +10:00
RumovZ
8e9331e424 Fix repainting in case of tag renaming exception 2021-03-10 21:50:46 +01:00
Henrik Giesel
76102db2a9 Fix bug with initially enabled toolbar in browser 2021-03-10 19:28:08 +01:00
RumovZ
bc7043c384 Store name prefix of sidebar items 2021-03-10 16:38:29 +01:00
RumovZ
e1db8e1da1 Borrow dids in remove_decks_and_child_decks 2021-03-10 15:56:54 +01:00
Damien Elmes
c3b0589bb4 make sure we invalidate cache when undoing deck add 2021-03-10 23:59:40 +10:00
Damien Elmes
e122f8ae0d undo support for deck adding/removing
Work in progress - still to do:
- renames appear as 'Update Deck' - easiest way to solve it would
be to have a separate backend method for renames
- drag&drop of decks not yet undoable
- since the undo status is updated after the backend method ends,
the older checkpoint() calls need to be replaced with an
update_undo_status() at the end of the call - if we just remove the
checkpoint, then the menu doesn't get updated
2021-03-10 23:50:11 +10:00
RumovZ
602ffa67a7 Update about screen 2021-03-10 11:34:28 +01:00
RumovZ
0c2ac4ba04 Merge branch 'master' into sidebar-tools 2021-03-10 10:34:36 +01:00
RumovZ
ffbb0b7c07 Disable renaming models and templates ...
... but add context action CLayout for templates.
2021-03-10 10:14:06 +01:00
Damien Elmes
6b1dd9ee19 expand backend Preferences and make undoable
- moved 'default to current deck when adding' into prefs
- move some profile options into the collection config, so they're
undoable and will sync. There is (currently) no automatic migration
from the old profile settings, meaning users will need to set the
options again if they've customized them.
- tidy up preferences.py
- drop the deleteMedia option that was not exposed in the UI
2021-03-10 18:51:03 +10:00
Damien Elmes
24ad7c1f35 inline scheduling settings into preferences 2021-03-10 14:11:59 +10:00
Damien Elmes
4bcd2b68ab roll back slog-term due to Windows break (2/2)
The cargo.toml update was missing from the previous commit, and term
was included directly when it didn't need to be.
2021-03-10 13:28:32 +10:00
Damien Elmes
77accb458f roll back slog-term due to Windows breakage 2021-03-10 12:22:11 +10:00
Damien Elmes
bb65d7bfda update translations 2021-03-10 12:04:34 +10:00
Damien Elmes
584915deb6 fix 'forgot card' translation string 2021-03-10 12:03:37 +10:00
Damien Elmes
d2f48e1663 move sync/err backend code into separate files 2021-03-10 11:53:27 +10:00
Damien Elmes
30865eae51 move progress and search backend code into separate files 2021-03-10 11:53:27 +10:00
Damien Elmes
96940f0527 undo support for config entries 2021-03-10 11:53:27 +10:00
Damien Elmes
ce243c2cae Simplify note adding and the deck/notetype choosers
The existing code was really difficult to reason about:

- The default notetype depended on the selected deck, and vice versa,
and this logic was buried in the deck and notetype choosing screens,
and models.py.
- Changes to the notetype were not passed back directly, but were fired
via a hook, which changed any screen in the app that had a notetype
selector.

It also wasn't great for performance, as the most recent deck and tags
were embedded in the notetype, which can be expensive to save and sync
for large notetypes.

To address these points:

- The current deck for a notetype, and notetype for a deck, are now
stored in separate config variables, instead of directly in the deck
or notetype. These are cheap to read and write, and we'll be able to
sync them individually in the future once config syncing is updated in
the future. I seem to recall some users not wanting the tag saving
behaviour, so I've dropped that for now, but if people end up missing
it, it would be simple to add as an extra auxiliary config variable.
- The logic for getting the starting deck and notetype has been moved
into the backend. It should be the same as the older Python code, with
one exception: when "change deck depending on notetype" is enabled in
the preferences, it will start with the current notetype ("curModel"),
instead of first trying to get a deck-specific notetype.
- ModelChooser has been duplicated into notetypechooser.py, and it
has been updated to solely be concerned with keeping track of a selected
notetype - it no longer alters global state.
2021-03-10 11:53:27 +10:00
Damien Elmes
c4f6ec99f7 Remove collection repr
I find the extra info it adds to tracebacks in pytest just makes them
harder to read.
2021-03-10 11:53:27 +10:00
Damien Elmes
c0e939ceb6 split config.rs up 2021-03-10 11:53:27 +10:00
Damien Elmes
545cb76018 native stringkey 2021-03-10 11:53:27 +10:00
Damien Elmes
1dea8babee use native boolkey instead of separate getters/setters
Makes it easier to add new config settings in the future, especially
if we don't need to export them via protobuf.
2021-03-10 11:53:27 +10:00
Damien Elmes
b67947cfbc use strum for config keys 2021-03-10 11:53:27 +10:00
Damien Elmes
265e91c13f add strum crate 2021-03-10 11:53:27 +10:00
Damien Elmes
0207f6c0ab update Rust deps 2021-03-10 11:53:27 +10:00
Damien Elmes
455d609109 when only sort field changed, we don't need to update ordinals 2021-03-10 11:53:27 +10:00
Damien Elmes
3d0ddc8539 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
d4765a301f coalesce note updates; avoid unnecessary saving due to mtime changes 2021-03-10 11:53:27 +10:00
Damien Elmes
ecea2161e3 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
d70e35e0a2 move remaining undo ops into separate files 2021-03-10 11:53:27 +10:00
Damien Elmes
ad74e26c84 move note undo into separate file 2021-03-10 11:53:27 +10:00
Damien Elmes
d2ebfc5482 move card undo into separate file 2021-03-10 11:53:27 +10:00
Damien Elmes
7900cc6868 fix some clippy lints 2021-03-10 11:53:27 +10:00
Damien Elmes
f1a1b0891e 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