Commit Graph

52 Commits

Author SHA1 Message Date
Damien Elmes
98f4b3db81 add types to utils.py
The function signatures for things like getFile() are awful, but
sadly are used by a bunch of add-ons.
2021-02-01 20:23:48 +10:00
Damien Elmes
328c86d3a5 add missing types to sidebar.py 2021-02-01 09:51:46 +10:00
RumovZ
13c6921da1 Remove protobuf filters whole_col and current_deck 2021-01-31 11:12:49 +01:00
Damien Elmes
6c483bb577 add public wrappers for remaining backend functions 2021-01-31 18:56:16 +10:00
Damien Elmes
9d853bbb03 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
3e69d39a25 Add missing sidebar onClicks 2021-01-31 08:56:34 +01:00
Damien Elmes
cb805cf355 Merge branch 'more-backend-search' into main 2021-01-31 14:21:51 +10:00
Damien Elmes
126b642115 disable multiple selection for now 2021-01-31 14:02:38 +10:00
Damien Elmes
18f0b78716 disable dragging of unsupported items 2021-01-31 13:46:31 +10:00
Damien Elmes
4579740df6 support dragging multiple decks at once 2021-01-31 13:46:31 +10:00
Damien Elmes
28ff061c19 support drag&drop of decks in sidebar 2021-01-31 13:46:31 +10:00
RumovZ
c299e271e8 Refactor search_string() and FilterToSearchIn
See #955.
2021-01-29 18:27:33 +01:00
Damien Elmes
d558f08a74 remove debug statement 2021-01-29 23:21:57 +10:00
Damien Elmes
79239c89b7 move saved search code into sidebar.py, and remove from Filter button 2021-01-29 23:05:30 +10:00
Damien Elmes
132bb5ff36 add expand/collapse children options 2021-01-29 22:54:00 +10:00
Damien Elmes
6ba5ff5a01 place each sidebar section under its own collapsible parent node
- Allows for group operations like "clear unused tags"
- Allows users to hide groups they're not interested in
2021-01-29 22:11:05 +10:00
Damien Elmes
57c53632a6 Revert "Make sidebar search matching work with full_name instead of name"
This reverts commit 6850e0f78e.

Using the full name caused issues with highlighting:
https://github.com/ankitects/anki/pull/951#issuecomment-769516003

Let's revert this for now and see if demand presents itself.
2021-01-29 13:18:28 +10:00
Damien Elmes
151cf52718 vary sidebar highlight with theme 2021-01-29 13:15:38 +10:00
abdo
903008f2bd Handle sidebar refreshing while searching 2021-01-29 04:20:15 +03:00
abdo
9492c8305e Wait for some time before performing sidebar search 2021-01-29 03:45:16 +03:00
abdo
6850e0f78e Make sidebar search matching work with full_name instead of name 2021-01-29 02:36:13 +03:00
RumovZ
ea46e24662 Use col instead of backend in aqt for search strs 2021-01-28 11:17:24 +01:00
Damien Elmes
2224fce936 fix crashes when activating context menu/items while searching 2021-01-28 19:12:07 +10:00
Damien Elmes
b148095243 basic match highlighting 2021-01-28 18:58:51 +10:00
Damien Elmes
8b08687b0c basic tree-based filtering with a sort proxy
Some things left to do:

- instead of searching on each keystroke, have the keystroke start
a timer and wait 600-1000ms before performing the search
- handle the case .refresh() is called while searching

It would also be nice to have some visual distinction between matching
rows and their non-matching parents.
2021-01-28 18:51:18 +10:00
Damien Elmes
fbf2f673f4 fix sidebar model.parent() returning invalid values
Triggered a crash when using a model proxy.
2021-01-28 17:48:33 +10:00
abdo
208c713e39 Add search bar to the sidebar
https://github.com/ankitects/help-wanted/issues/6
2021-01-27 01:41:57 +03:00
Damien Elmes
a82744a3e5 load sidebar in background
Allows the UI to repaint during processing, but will still block
DB operations until the call completes.
2021-01-26 09:02:08 +10:00
Damien Elmes
8d5dca4bda 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
abdo
0110102ea2 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
426ea1aba9 Move the logic for selecting a note type to models.py 2021-01-22 05:56:39 +03:00
abdo
918bba6365 Add manage note types menu item to the sidebar 2021-01-21 20:27:20 +03:00
abdo
0fc4c21dcc Add filter remove/rename actions to the sidebar 2021-01-20 03:26:53 +03:00
abdo
b33267f754 Do not check for missing tag parents at registration time 2021-01-09 17:10:16 +03:00
abdo
b276ce3dd5 Hierarchical tags 2021-01-09 17:10:13 +03:00
Damien Elmes
b30b7c3073 fix qt/ pylints 2021-01-07 16:21:50 +10:00
Damien Elmes
f667521ee0 only adjust search on left button click
Closes #898
2021-01-07 10:08:23 +10:00
BlueGreenMagick
ada8c505f6 add BrowserDeleteDeck to ResetReason 2021-01-05 21:33:48 +09:00
BlueGreenMagick
2a1b6f90ae add delete_deck to sidebar context menu 2021-01-05 20:09:55 +09:00
Damien Elmes
f3fa9daae2 do tag rename and tag clearing in background; move logic to tags.py
Because the logic is in rename_tag() now, it means we create a
checkpoint even if the tag is orphaned. This is because currently
checkpointing is a GUI responsibility. In the future we need to introduce
multi-level undo, and should move responsibility for managing it
to the backend.
2021-01-04 14:14:39 +10:00
Damien Elmes
35ce1b0d29 types don't need quoting, as annotations is imported from future 2021-01-04 13:46:00 +10:00
Damien Elmes
03b10b0d44
Merge pull request #887 from BlueGreenMagick/deck-rename-checkpoint
don't set checkpoint when deck rename is cancelled
2021-01-04 13:44:28 +10:00
BlueGreenMagick
35d3d89705 escape tags when finding notes 2021-01-03 17:34:44 +09:00
BlueGreenMagick
46346d01a0 add rename_tag to browser sidebar contextmenu 2021-01-03 16:36:54 +09:00
BlueGreenMagick
53edeaf07f don't set checkpoint when deck rename is cancelled 2021-01-03 16:30:14 +09:00
Damien Elmes
b27259096e refreshing should happen outside of except clause 2021-01-03 10:09:42 +10:00
Damien Elmes
e9c58382be
Merge pull request #884 from BlueGreenMagick/refresh-deckchooser
refresh deck browser after renaming deck in browser sidebar
2021-01-03 10:08:45 +10:00
BlueGreenMagick
708d94714c refresh deck browser on renaming deck 2021-01-02 23:21:41 +09:00
BlueGreenMagick
1afbf4212e no need to call show() 2021-01-02 23:07:57 +09:00
Damien Elmes
ffa26fe4bc fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00