Commit graph

1679 commits

Author SHA1 Message Date
Damien Elmes
56a75c07dc add public wrappers for remaining backend functions 2021-01-31 18:56:16 +10:00
Damien Elmes
ebfc9d1915 move rsbridge into _backend 2021-01-31 18:55:45 +10:00
Damien Elmes
a6be0f493b start work on more clearly defining backend/protobuf boundaries
- anki._backend stores the protobuf files and rsbackend.py code
- pylib modules import protobuf messages directly from the
_pb2 files, and explicitly export any will be returned or consumed
by public pylib functions, so that calling code can import from pylib
- the "rsbackend" no longer imports and re-exports protobuf messages
- pylib can just consume them directly.
- move errors to errors.py

Still todo:

- rsbridge
- finishing the work on rsbackend, and check what we need to add
back to the original file location to avoid breaking add-ons
2021-01-31 18:55:45 +10:00
RumovZ
4cb9bf7326 Add missing sidebar onClicks 2021-01-31 08:56:34 +01:00
Damien Elmes
9a697fd843 Merge branch 'more-backend-search' into main 2021-01-31 14:21:51 +10:00
Damien Elmes
86713be79c disable multiple selection for now 2021-01-31 14:02:38 +10:00
Damien Elmes
3708d28d0c disable dragging of unsupported items 2021-01-31 13:46:31 +10:00
Damien Elmes
1e573003e9 support dragging multiple decks at once 2021-01-31 13:46:31 +10:00
Damien Elmes
3a06fd2808 add missing check for on_done==None in with_progress() 2021-01-31 13:46:31 +10:00
Damien Elmes
0f8b0df491 support drag&drop of decks in sidebar 2021-01-31 13:46:31 +10:00
Damien Elmes
5710e4bbd0 move drag/drop deck logic to backend 2021-01-31 13:46:31 +10:00
RumovZ
d3d18d34c5 Remove search button and reword search bar hint 2021-01-30 19:23:40 +01:00
RumovZ
2539747115 Manually namespace enum variants in SearchTerm
In protobuf "...enum values use C++ scoping rules, meaning that
enum values are siblings of their type, not children of it.
Therefore, [an enum variant] must be unique within [a message],
not just within [the enum.]"
So we must prefix enum variants with their enum's name, but can
also call them directly from the message namespace.
The protobuf crate is smart, though, and strips the prefixes.

(Simultaneously change some SearchTerm variant names.)
2021-01-30 17:56:29 +01:00
RumovZ
cdabb0ecbe Replace leftover _named_filter with _filter_func 2021-01-30 17:39:21 +01:00
Henrik Giesel
a94bcbcc74 Fix focus on first field upon opening editor 2021-01-30 14:20:14 +01:00
RumovZ
353355fb15 Build list in focusCid and specify exception
model.cards may be a protobuf sequence but focusCid needs list's index
method, so convert to list, but only if needed.
2021-01-30 13:15:46 +01:00
RumovZ
540338cea3 Import SearchTerm from collection in aqt 2021-01-30 12:51:24 +01:00
RumovZ
a20ee1c844 Fix type annotations in browser search 2021-01-30 11:24:33 +01:00
RumovZ
9a1ff40b65 Update docstrings for browser search 2021-01-30 11:05:48 +01:00
RumovZ
fd07ef212a Auto search and check input before model search
- Search for current deck automatically on browser setup.
- Hide current deck and current card searches.
- Check user search input before passing it on to the model, so invalid
  searches don't change TableView.
2021-01-30 10:53:42 +01:00
Damien Elmes
747075e9a7 Merge pull request #957 from hgiesel/fieldsshadow
Implement editor as Web Component
2021-01-30 15:13:58 +10:00
Damien Elmes
190922666b move Rating up a level
More ergonomic, and will allow reuse if we expose prop:rated in
the future.
2021-01-30 11:54:39 +10:00
Damien Elmes
2f1bbd44d2 simplify nid/nids searches, and ditch helper function
- IdList could be re-used for a cids: search in the future if required.
- Embedding the message means it's easy to access from Python as
an attribute of SearchTerm.
2021-01-30 11:37:00 +10:00
Damien Elmes
f6f537e89f simplify Dupe message and ditch helper function
Calling code doesn't need to know about the existence of such helpers;
it can just rely on code completion to discover the required arguments.
2021-01-30 11:10:26 +10:00
Damien Elmes
cf1e2a2c0d export SearchTerm from collection.py, and avoid exporting embedded items 2021-01-30 11:01:11 +10:00
Damien Elmes
b34d128560 rename FilterToSearchIn in backend to match frontend 2021-01-30 10:54:21 +10:00
Damien Elmes
dbe852431f use a separate enum for the is:* searches 2021-01-30 10:49:00 +10:00
Damien Elmes
e3f2b77c5b combine forgot_in_days and studied_today into a more general 'rated' 2021-01-30 10:26:23 +10:00
Damien Elmes
873bf7f505 Merge pull request #958 from hgiesel/zindexedtopbar
Make sticky topbar have a positive z-index
2021-01-30 09:14:50 +10:00
RumovZ
cad57423c5 Update search history only after successful search
Ergo, don't save invalid searches, but also save searches normalised so
equivalent searches get saved only once.
2021-01-29 23:05:51 +01:00
RumovZ
df22e51d02 Rework search initialisation
- Remove _searchPrompt.
- Add placeholder prompt.
- Move search for current card from browser to caller. (Thus, support
  current card search even with opened browser.)
2021-01-29 21:07:42 +01:00
Henrik Giesel
44351bc997 Rename editingContainer -> editingArea; editingArea -> editable
* Custom elements are now namespaces with `anki-`
* The element names are inspired by summernote, which have the same
  naming scheme of "editingArea > editable"
2021-01-29 20:32:21 +01:00
Henrik Giesel
c44c1513a3 Reorder methods / properties 2021-01-29 20:13:02 +01:00
Henrik Giesel
da79acf685 Remove unnecessarily observed attribute 2021-01-29 20:11:00 +01:00
Henrik Giesel
9771b5394c Add semicolon in js message 2021-01-29 19:48:17 +01:00
Henrik Giesel
e7a49d5c48 Make forEditorField more cheaper to execute by avoiding casting to Array 2021-01-29 19:38:55 +01:00
RumovZ
c7365abc9e Refactor search_string() and FilterToSearchIn
See #955.
2021-01-29 18:27:33 +01:00
Henrik Giesel
00a4d0357d Remove explicit ids, as they are not necessary anymore 2021-01-29 18:07:31 +01:00
Henrik Giesel
1617565f2d No need to set initial values for editing area base CSS 2021-01-29 17:51:26 +01:00
Henrik Giesel
36ce422119 Remove checking for class names for instance checks 2021-01-29 17:41:27 +01:00
Henrik Giesel
a33fa9c0cf Put HTML initialization into web component constructor
* disconnectedCallback should remove event listeners and free other resources
* attributes belong to connectedCallback
2021-01-29 15:50:34 +01:00
Henrik Giesel
514d6b68b6 Move setting of index to connectedCallback 2021-01-29 14:54:59 +01:00
Henrik Giesel
1f5793e9e7 Remove user styling in editor again for now 2021-01-29 14:54:59 +01:00
Henrik Giesel
ef404c73ce Fix focus change on tab 2021-01-29 14:54:59 +01:00
Henrik Giesel
646415fd09 Move styling attributes from editor to editing-area that are for editing area 2021-01-29 14:54:58 +01:00
Henrik Giesel
fc24ebfb9e Make button highlight white in nightMode 2021-01-29 14:54:58 +01:00
Henrik Giesel
f3aaa40238 Make the text color part of the base style in editor 2021-01-29 14:54:58 +01:00
Henrik Giesel
49c3723647 Allow stylesheet of note type take effect on editor fields 2021-01-29 14:54:58 +01:00
Henrik Giesel
3d2c4b9969 Use currentField.getSelection instead of window.getSelection 2021-01-29 14:54:58 +01:00
Henrik Giesel
28276a9acf Use new focusEditingArea and blurEditingArea to delegate to editing area 2021-01-29 14:54:58 +01:00