Commit graph

280 commits

Author SHA1 Message Date
RumovZ
b21d1dcbc0 Merge branch 'master' into dyn-deckconf 2021-02-01 23:33:41 +01:00
RumovZ
320b82aae6 Add cross links for second dyndeck filter 2021-02-01 19:10:05 +01:00
RumovZ
ef413b90c6 Rename "Filtered Deck from Current Filter" 2021-02-01 12:09:37 +01:00
RumovZ
d57d0f977b Make browser accept optional args and add reopen
That way, the caller doesn't have to hold a reference to the browser and
explicitly call it again, if it wants to search for something specific.
Also, if the browser was closed and opened for a single-card-search, it
now won't perform a redundant current-deck-search first.
2021-02-01 11:54:28 +01:00
RumovZ
2a82e43c0b Make DialogManager accept kwargs
When opening a dialogue accepting multiple optional arguments, relying
on position is error-prone and requires passing Nones to fill unused
parameter slots.
2021-02-01 08:50:19 +01:00
Damien Elmes
34935bf478 add types to editor.py 2021-02-01 17:28:35 +10:00
Damien Elmes
2070847868 add missing types to browser.py 2021-02-01 09:39:55 +10:00
RumovZ
90e1a75dd6 Add current-filter-to-filtered-deck action 2021-01-31 23:16:49 +01:00
RumovZ
632ad14801 Remove protobuf filters whole_col and current_deck 2021-01-31 11:12:49 +01: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
Damien Elmes
9a697fd843 Merge branch 'more-backend-search' into main 2021-01-31 14:21:51 +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
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
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
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
cf1e2a2c0d export SearchTerm from collection.py, and avoid exporting embedded items 2021-01-30 11:01:11 +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
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
RumovZ
c7365abc9e Refactor search_string() and FilterToSearchIn
See #955.
2021-01-29 18:27:33 +01:00
Damien Elmes
0a119c3bad move saved search code into sidebar.py, and remove from Filter button 2021-01-29 23:05:30 +10:00
Damien Elmes
34c53aafb4 add getter/setter for boolean config values 2021-01-29 21:03:19 +10:00
RumovZ
e629e32c12 Add browser_search helper in mw 2021-01-28 20:51:32 +01:00
RumovZ
df1d059128 Use backend filter for findDupes and handle excep. 2021-01-28 19:49:16 +01:00
RumovZ
3723bc5a98 Use backend nid filter in addcards and mediacheck 2021-01-28 18:59:20 +01:00
RumovZ
cd9a3734c3 Use backend nid filter in browser 2021-01-28 16:21:56 +01:00
RumovZ
8d786213d3 Prevent search prompt from being saved as a filter
Normalisation would render it useless.
2021-01-28 13:31:08 +01:00
RumovZ
7941c03ec0 Use backend filter for search prompt 2021-01-28 13:26:52 +01:00
RumovZ
011e7413ff Use col instead of backend in aqt for search strs 2021-01-28 11:17:24 +01:00
abdo
924d501bf3 Add search bar to the sidebar
https://github.com/ankitects/help-wanted/issues/6
2021-01-27 01:41:57 +03:00
Damien Elmes
8b8c826cd8 Merge pull request #944 from Arthur-Milchior/help
NF: HelpPage in an enum
2021-01-26 11:33:39 +10:00
Arthur Milchior
cb2df4fc1a NF: HelpPage in an enum
Hopefully, this can help with updating on next manual update and maybe even linking to manual translation
2021-01-26 02:16:37 +01:00
RumovZ
0bd214b4ee Move show_invalid_search_error to utils 2021-01-25 23:19:19 +01:00
Arthur Milchior
76c02c9f82 Correct browse help link 2021-01-23 14:48:29 +01:00
Damien Elmes
ec7000575e move sidebar code from browser.py to sidebar.py and tidy up
https://github.com/ankitects/help-wanted/issues/6

Some notes:
- use our own routine to toggle the sidebar, which avoids a useless
refresh on browser close, and allows us to limit the delayed loading
to initial browser load.
- add-ons that limited themselves to the browser_will_build_tree hook
should theoretically continue working; ones that were monkey patching
will likely break. A few appear to be broken at the moment anyway,
so it's probably a good time to be making this change.
2021-01-23 19:59:12 +10:00
Damien Elmes
bceaa21fa6 drop tags/decks/etc from Filter button
https://github.com/ankitects/help-wanted/issues/6

These are a relic from when the sidebar defaulted to off, and I don't
think enough people are using them to bother keeping them around.
Once the the card state and saved filter functionality moves into the
sidebar and top menus, we may be able to remove the Filter button
completely.
2021-01-23 18:21:44 +10:00
abdo
fb70929b81 Render card templates as trees in the sidebar
Reusing the note type icon and not caring about saving collapse state
for now.
2021-01-22 17:49:20 +03:00
abdo
2eec50341d Move the logic for selecting a note type to models.py 2021-01-22 05:56:39 +03:00
abdo
5a5b87e733 Add filter remove/rename actions to the sidebar 2021-01-20 03:26:53 +03:00
Damien Elmes
d92ba2c246 Merge pull request #900 from abdnh/tagtree
Hierarchical tags
2021-01-18 16:36:22 +10:00
abdo
c4725cc908 Fix wrong tag collapse state being used 2021-01-18 06:50:29 +03:00
abdo
a96c410c52 Remove unused set_filter() 2021-01-16 18:51:31 +03:00
Damien Elmes
96bd39f13e search error tweaks
- use markdown instead of HTML, to make editing and translating easier
- use a shared prefix
- a few very minor wording tweaks
- we don't need to translate undocumented command errors
- share a string for positive number of days
- share a string for invalid property and state arguments, and avoid
listing them out

Related discussion: https://github.com/ankitects/anki/pull/922
2021-01-16 15:59:19 +10:00
abdo
112aa44c90 Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-15 01:12:01 +03:00