Commit graph

1928 commits

Author SHA1 Message Date
Damien Elmes
de2c7f3e38 Merge pull request #970 from RumovZ/cleanup-967
Cleanup 967
2021-02-02 22:03:43 +10:00
abdo
09729057e2 Add checkpoints for sidebar drag & drop routines
Also save note and reset browser model
2021-02-02 14:58:44 +03:00
Damien Elmes
06fda14999 fix: Qt translations not working
Will need to manually confirm this is working in the bundled builds
2021-02-02 21:12:28 +10:00
RumovZ
28a954e77f Remove standard button translations 2021-02-02 11:57:35 +01:00
Damien Elmes
aad0d9b7b6 auto-expand items while dragging 2021-02-02 20:14:14 +10:00
Damien Elmes
957e781484 add tag drag & drop support 2021-02-02 20:14:04 +10:00
Damien Elmes
9ef0a1e070 Merge pull request #968 from abdnh/sidebar-expand-matches
Expand sidebar match trees one level
2021-02-02 19:03:04 +10:00
Damien Elmes
c5704e6102 collapsed->expanded in other tag uses for consistency 2021-02-02 18:52:57 +10:00
Damien Elmes
99d6247333 collapsed->expanded in TagTreeNode 2021-02-02 18:52:57 +10:00
RumovZ
af7aa4c21d Add docstring to browser.__ini__ 2021-02-02 09:48:55 +01:00
RumovZ
03ed76020f Disallow untyped defs for dyndeckconf 2021-02-02 09:40:05 +01:00
RumovZ
45739cbc64 Remove actionCreateFilteredDeck2 and use modifier 2021-02-02 09:29:09 +01:00
Damien Elmes
ee2e68fa6b remove sidebar margins 2021-02-02 16:35:42 +10:00
Damien Elmes
5c25a71634 fix: slowdowns after import; hard to read popup
QTextEdit() will pin the CPU at 100% for seconds to minutes when
fed a large string to display - work around it by switching to
QPlainTextEdit().

Also strip HTML before showing the user - easier to read, and less
text to display. And turn off word wrap, as it makes it easier to skim,
and further reduces the work the widget needs to do.

https://forums.ankiweb.net/t/big-issue-where-anki-gets-slow-when-you-import-this-deck/7050
2021-02-02 15:49:47 +10:00
abdo
14927c2465 Hide sidebar items when there is no match 2021-02-02 05:41:45 +03:00
abdo
1b72e142a7 Add more sidebar section roots 2021-02-02 04:51:45 +03:00
Damien Elmes
a1a70b1809 fix sync warning caused by mistake in typing work 2021-02-02 10:43:49 +10:00
Damien Elmes
b2c9030a58 ditch QSortFilterProxyModel in favour of our own code
Simpler and approximately twice as fast in a large collection:

old approach
search for a: 371ms
search for an: 260ms

new approach:
search for a: 171ms
search for an: 149ms

Still todo: add enum defs for the other root categories, update
the _section_root() calls, and update is_expanded() to use the new
extra types
2021-02-02 10:40:50 +10:00
RumovZ
8d8a2e49fd Add remaining type hints to dyndeckconf etc. 2021-02-01 23:46:56 +01:00
RumovZ
b21d1dcbc0 Merge branch 'master' into dyn-deckconf 2021-02-01 23:33:41 +01:00
RumovZ
7b39fb6484 Rename standard buttons to have transaltions 2021-02-01 23:20:57 +01:00
RumovZ
99ffc08dbf Make browser links unfocusable
Since Enter would trigger Accept anyway, there is no point in them
having focus.
2021-02-01 21:17:15 +01:00
RumovZ
3e30bd4610 Enable renaming from dyndeck dialogue 2021-02-01 21:02:22 +01:00
RumovZ
320b82aae6 Add cross links for second dyndeck filter 2021-02-01 19:10:05 +01:00
RumovZ
fbc5de4596 Style browser-from-filtered-deck button
Use theme color and add hover effect.
2021-02-01 18:01:57 +01:00
abdo
5c24e57734 Expand sidebar match trees one level
See 03eab6b646
2021-02-01 19:12:43 +03:00
Damien Elmes
748aeb9df1 add a bunch of return types 2021-02-01 23:53:23 +10:00
RumovZ
b76632eb62 Add button in dynDeckConf to search in browser 2021-02-01 13:55:03 +01:00
Damien Elmes
83892eac51 add types to various other files
Mainly automated with MonkeyType
2021-02-01 22:08:56 +10:00
RumovZ
ef413b90c6 Rename "Filtered Deck from Current Filter" 2021-02-01 12:09:37 +01:00
Damien Elmes
8be63cb902 add some types to main.py 2021-02-01 20:59:18 +10:00
RumovZ
27609a784f Change filtered-deck shortcut in browser to Ctrl+G 2021-02-01 11:59:16 +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
Damien Elmes
8dc5ea8bb6 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
RumovZ
aa6cf51527 Fix pylints and type annotations in dyndeckconf
Also fix int representation of learning steps.
2021-02-01 09:56:10 +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
dc261c5abf add helper script to run mypy daemon 2021-02-01 17:29:03 +10:00
Damien Elmes
34935bf478 add types to editor.py 2021-02-01 17:28:35 +10:00
Damien Elmes
b3f9d12606 Merge pull request #962 from hgiesel/editordirs
Make editor a rollup package within data/web/js
2021-02-01 13:40:54 +10:00
Damien Elmes
fe0d6b3a10 add missing types to sidebar.py 2021-02-01 09:51:46 +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
23d1481d34 Make dyndeckconf a registered dialogue 2021-01-31 22:37:08 +01:00
Henrik Giesel
9f3403d704 Move editor css to editor directory 2021-01-31 19:03:40 +01:00
RumovZ
53513f371f Rework dynndeckconf
- Handle deck building inside class. New deck is built unless caller
  passes filtered deck.
- If no deck is passed and current deck is filtered, copy settings.
- Remove exec_().
2021-01-31 18:20:47 +01:00
Henrik Giesel
978258067b Move editor to /ts/editor 2021-01-31 14:15:03 +01:00
Henrik Giesel
e667191899 Fix type issues 2021-01-31 13:34:39 +01:00
Henrik Giesel
aba2506394 Make editor a rollup package 2021-01-31 13:34:37 +01:00
RumovZ
632ad14801 Remove protobuf filters whole_col and current_deck 2021-01-31 11:12:49 +01:00
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
Henrik Giesel
b423c372d5 Fix dupes, but also make sticky, and centered to draw more attention 2021-01-29 14:54:58 +01:00
Henrik Giesel
8381d9f842 Update setFonts and setBackgrounds 2021-01-29 14:54:58 +01:00
Henrik Giesel
7170a2b853 Fix inListItem for shadow roots 2021-01-29 14:54:58 +01:00
Henrik Giesel
0c2b560718 Rename fieldContainsInlineContent to containsInlineContent to reflect new usage 2021-01-29 14:54:58 +01:00
Henrik Giesel
cbb5224f48 Isolate styling of editing-area into new scss file 2021-01-29 14:54:58 +01:00
Henrik Giesel
fd704381a0 Create a rough draft of the editor web component 2021-01-29 14:54:58 +01:00
Damien Elmes
ef178cd7e1 remove debug statement 2021-01-29 23:21:57 +10:00
Henrik Giesel
e9d8e73239 Make sticky topbar have a positive z-index 2021-01-29 14:21:32 +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
03eab6b646 add expand/collapse children options 2021-01-29 22:54:00 +10:00
Damien Elmes
cfc6620591 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
34c53aafb4 add getter/setter for boolean config values 2021-01-29 21:03:19 +10:00
RumovZ
9cf02efd20 Use proper docstrings 2021-01-29 09:40:21 +01:00
RumovZ
12c97442c9 Rename filters added_in etc. to added_in_days 2021-01-29 09:38:13 +01:00
Damien Elmes
45ec14184a show actual error when graphData fails
The original reason for the catch-all message was users with bad
data such as decimal intervals, but those get automatically coerced
these days. The common case should now be invalid search strings, which
we can show verbatim.
2021-01-29 14:39:05 +10:00
Damien Elmes
e70b887e8c Revert "Make sidebar search matching work with full_name instead of name"
This reverts commit b0a599c6bc.

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
a0a82c1f56 vary sidebar highlight with theme 2021-01-29 13:15:38 +10:00
Damien Elmes
e385507636 Merge pull request #951 from abdnh/sidebar-search
Add search bar to the sidebar
2021-01-29 11:32:26 +10:00
abdo
47b5e8d345 Handle sidebar refreshing while searching 2021-01-29 04:20:15 +03:00
Damien Elmes
c0e0cabd73 drop potentially slow regex usage in cloze check
Closes #956, thanks to Henrik.
2021-01-29 11:15:33 +10:00
abdo
68ea4eda96 Wait for some time before performing sidebar search 2021-01-29 03:45:16 +03:00
abdo
b0a599c6bc Make sidebar search matching work with full_name instead of name 2021-01-29 02:36:13 +03:00
RumovZ
e629e32c12 Add browser_search helper in mw 2021-01-28 20:51:32 +01:00
RumovZ
0950c8f7c6 Fix search calls in addcards 2021-01-28 20:01:20 +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
8d669724b1 Replace remaining literal searches in aqt 2021-01-28 11:19:07 +01:00
RumovZ
011e7413ff Use col instead of backend in aqt for search strs 2021-01-28 11:17:24 +01:00
Damien Elmes
55627e7eae fix crashes when activating context menu/items while searching 2021-01-28 19:12:07 +10:00
Damien Elmes
d82b6bc778 basic match highlighting 2021-01-28 18:58:51 +10:00
Damien Elmes
9212e6af5e 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
193e2d47a6 fix sidebar model.parent() returning invalid values
Triggered a crash when using a model proxy.
2021-01-28 17:48:33 +10:00
Damien Elmes
07b0eebdb3 Merge pull request #952 from hgiesel/fieldsflex
Deal with inline content vs block content and <br> in editor.ts
2021-01-28 15:49:31 +10:00
Damien Elmes
4b0d25aa23 add type check to textFormat arg 2021-01-27 14:22:17 +10:00
Henrik Giesel
04a7b88595 Rename fieldIsInInlineMode to fieldContainsInlineContent 2021-01-27 02:35:14 +01:00
Henrik Giesel
aa61f24547 Remove unused helper functions 2021-01-27 00:55:00 +01:00
Henrik Giesel
8572c1e1d7 Recreate border-spacing with margins for #fields 2021-01-27 00:50:26 +01:00
Henrik Giesel
bd270ba52c Change nodeIsInline logic to be more typesafe 2021-01-26 23:49:48 +01:00
Henrik Giesel
876efba70c Change logic to detect inline elements, as the display style property may not be set after setting innerHTML 2021-01-26 23:42:04 +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
Henrik Giesel
898cdb94e4 Make #fields display correctly 2021-01-26 23:17:50 +01:00
Henrik Giesel
a76d1772df Make fields div instead of table + implement fieldIsInInlineMode logic 2021-01-26 23:00:55 +01:00
Henrik Giesel
6464a2bb83 Strip trailing newline if inline elements logic 2021-01-26 21:26:04 +01:00
Damien Elmes
a83cb6402e tooltip() instead of print() when no tts tag matches
Can help with debugging user error like an incorrectly-typed language
code. Don't ask me how I know. :-)
2021-01-26 20:37:24 +10: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
Damien Elmes
6285729c49 Merge pull request #897 from hgiesel/statssearch
Triggering searches from the stats screen.
2021-01-26 11:31:36 +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
Damien Elmes
b9a663a738 Merge pull request #945 from RumovZ/dyndeck-search
Normalize dyndeck search and handle exception
2021-01-26 09:24:56 +10:00
Damien Elmes
d7994ad056 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
RumovZ
9986113eed Normalize dyndeck search and handle exception 2021-01-25 23:21:32 +01:00
RumovZ
0bd214b4ee Move show_invalid_search_error to utils 2021-01-25 23:19:19 +01:00
Henrik Giesel
6b0a26e46b Move dispatch logic from Histogram to individual graphs 2021-01-25 16:34:44 +01:00
Henrik Giesel
a86c41c19b Satisfy formatter 2021-01-25 13:46:44 +01:00
Henrik Giesel
a390fb08e2 Add browserSearch bridge command 2021-01-25 13:44:19 +01:00
Damien Elmes
08f6ec649c fix finished screen not showing when learning cards due later 2021-01-25 21:12:57 +10:00
Arthur Milchior
76c02c9f82 Correct browse help link 2021-01-23 14:48:29 +01:00
Damien Elmes
a6a4c0032d Merge pull request #934 from hgiesel/graphprefs
Add GraphsPreferences API to graphs for setting persistent preferences
2021-01-23 21:24:41 +10:00
Damien Elmes
387be76c00 minor wording tweak: GraphsPreferences -> GraphPreferences 2021-01-23 20:47:45 +10:00
Damien Elmes
959496f20e Merge pull request #938 from hgiesel/editorflex
Small refactor of topbar buttons
2021-01-23 20:09:42 +10: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
Henrik Giesel
25eee0e704 Change the function name in genbackend.py 2021-01-22 20:05:28 +01:00
Henrik Giesel
a5f59515e2 Rename GraphsPreferencesOut to simply GraphsPreferences 2021-01-22 19:39:03 +01: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
Henrik Giesel
fe75480fea Successfully send post request to rust 2021-01-22 14:37:24 +01:00
Henrik Giesel
846dd396a6 Add non-functioning logic for settings graphs preferences 2021-01-22 13:14:35 +01:00
Henrik Giesel
1516f5c37e Add GraphsPreferences endpoint to backend 2021-01-22 13:13:48 +01:00
Henrik Giesel
1a02613274 Avoid highlighting of toprightbuttons to shift the topbar 2021-01-22 12:53:45 +01:00
Henrik Giesel
f462f54e55 Space items by using margins instead of spaces
* also changed name of topbutton container back to topbutsOuter as it is clearer
* starting with Chromium 83, `row-gap` would be better suited for this
2021-01-22 12:17:10 +01:00
Henrik Giesel
e1979ef9a0 Switch from floating windows and clearfix to flex and justify-content: space-between 2021-01-22 11:37:11 +01:00
Damien Elmes
b045107baa Merge pull request #935 from abdnh/sidebar-nt
Add manage note types menu item to the sidebar
2021-01-22 14:21:28 +10:00
abdo
2eec50341d Move the logic for selecting a note type to models.py 2021-01-22 05:56:39 +03:00
Henrik Giesel
431b2fde63 Adjust the positioning of the editor toolarea via CSS 2021-01-21 21:36:33 +01:00
Henrik Giesel
8467b052f9 Remove image click event handler, as it never takes place
* className of fields will be "field clearfix", never just "field"
2021-01-21 20:50:17 +01:00
Henrik Giesel
3c3c78ee71 Remove javascript resizing code from editor.ts 2021-01-21 19:59:16 +01:00
abdo
14eeaa1ec9 Add manage note types menu item to the sidebar 2021-01-21 20:27:20 +03:00
Damien Elmes
85135d46fc Merge pull request #930 from hgiesel/editorts
Refactor editor.ts
2021-01-21 10:44:11 +10:00
Henrik Giesel
ba7252b664 Explicitly execute code deactivating button focus from editor.py 2021-01-20 17:06:08 +01:00
abdo
5a5b87e733 Add filter remove/rename actions to the sidebar 2021-01-20 03:26:53 +03:00
Henrik Giesel
55cf7a27ba Remove jQuery from most top functions, and avoid waiting for jquery load 2021-01-19 03:52:46 +01:00
Henrik Giesel
fc0402db81 Remove some unnecessary jQuery, replace some toggles with classList.toggle 2021-01-19 03:06:44 +01:00
Henrik Giesel
077a22adcc Remove code which supposedly fixing focus, but which is not functional 2021-01-19 02:54:15 +01:00
Henrik Giesel
9803a4ab00 Switch to iterables for elem.style and elem.attributes 2021-01-19 02:48:41 +01:00
Henrik Giesel
0534f217ae Satisfy formatter 2021-01-19 01:08:15 +01:00
Henrik Giesel
c8c10c07b2 Prefer template string and addEventListener over string concatenation and .on<event> 2021-01-18 17:42:29 +01:00
Henrik Giesel
2efc2030f6 Use more strict TypeScript in editor.ts 2021-01-18 17:18:35 +01:00
Henrik Giesel
2ec2bc91da Switch to KeyboardEvent.code rather than KeyboardEvent.which, which is deprecated 2021-01-18 15:19:57 +01: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
Damien Elmes
8e50cfc404 skip the schema warning on template rename
https://forums.ankiweb.net/t/unnecessary-full-upload-notification/6611
2021-01-18 12:03:07 +10: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
Damien Elmes
c6f38733ed Merge pull request #925 from hgiesel/preferbr
Prefer <br> over <div></div> in Editor
2021-01-16 13:03:28 +10:00
Damien Elmes
db045fb1b9 restore shortcuts that got lost in Fluent conversion
They were missed as they were not marked 'notr'.

https://forums.ankiweb.net/t/home-and-end-keys-no-longer-work-in-browse-window/6524
2021-01-16 10:03:29 +10:00
Henrik Giesel
131d71682b Deal with div insertion on deleting list item 2021-01-15 18:46:37 +01:00
Henrik Giesel
b5e26f7e51 Consider list edge case for line breaks
* Enter makes a new bullet point
* Shift+Enter makes a line break in current bullet point
2021-01-15 18:46:37 +01:00
Henrik Giesel
93b429a21b Prefer <br> over <div></div> 2021-01-15 18:46:37 +01:00
abdo
112aa44c90 Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-15 01:12:01 +03:00
RumovZ
895b3a0b6f Use backend to set dupe filter 2021-01-14 10:42:37 +10:00
Damien Elmes
6cc58451b1 add local sync server frontend 2021-01-13 11:42:00 +10:00
abdo
c423e8d7bb Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-12 23:31:58 +03:00
abdo
e3c873fb32 Keep tags in human form and update the tags table structure
See https://github.com/ankitects/anki/pull/900#issuecomment-758284016

- Leave tag names alone and add the collapsed and config columns to the tags table.
- Update The DB check code to preserve the collapse state of used tags.
- Add a simple test for clearing tags and their children
2021-01-12 23:12:35 +03:00
Damien Elmes
0accefcd94 drop basicCheck()
It can considerably slow down syncing on large collections
2021-01-12 18:47:08 +10:00
Damien Elmes
3f9b7ea6e2 Merge pull request #914 from hgiesel/previewineditor
Preview Button in Editor instead of Browser
2021-01-11 19:12:06 +10:00
Damien Elmes
07e0df5176 Merge pull request #915 from RumovZ/fix-template-filter
Fix _template_filter and update want_release_gil()
2021-01-11 16:20:50 +10:00
Kyle Mills
386f42070c typo 2021-01-10 07:18:08 -08:00
Henrik Giesel
cd09db2abe Make keys parameter requiring func parameter in _addButton explicit 2021-01-10 13:42:23 +01:00
RumovZ
9ad005aec5 Don't add 1 when calling _template_filter()
See #913.
2021-01-10 11:30:14 +01:00
Henrik Giesel
956beae044 Close previewer if there is no card to render 2021-01-10 02:01:24 +01:00
Henrik Giesel
961de57ed9 Fix formatting, use shortcut on preview before displaying 2021-01-10 01:50:00 +01:00
Henrik Giesel
90e4cb5bae Allow closing the Preview Dialog with Ctrl+Shift+P 2021-01-10 01:34:59 +01:00
Henrik Giesel
3e1cf6c986 Prevent error when browser is closed with previewer open 2021-01-10 01:21:52 +01:00
Henrik Giesel
1940c90f62 Activate toggle on hotkey invocation 2021-01-10 01:10:23 +01:00
Damien Elmes
ffec5ab461 add type to _named_filter()
The ...Value types generated by mypy-protobuf are only available
at typechecking time, and pylint chokes on them despite the use
of annotations from __future__ - so we either need to quote them,
or use # pylint: disable=no-member
2021-01-10 09:11:48 +10:00
Henrik Giesel
5aa6281521 Add shortcut to new preview button 2021-01-10 00:00:19 +01:00
Henrik Giesel
d58f9a6fea Improve styling of new preview button on light and nightMode 2021-01-09 23:55:39 +01:00
Henrik Giesel
2fa91e6480 Remove preview button from browser.py top bar 2021-01-09 23:25:56 +01:00
Henrik Giesel
f3f1849148 Make button show its toggle state 2021-01-09 23:16:01 +01:00
Henrik Giesel
1e3e7ccfcd Put Preview button into editor inside browser 2021-01-09 22:34:53 +01:00
RumovZ
0bf7ad0951 Merge branch 'master' into backend-filters
Adapt new formatting.
2021-01-09 19:03:43 +01:00
RumovZ
02837ebbef Use explicit wrapper functions to get filters 2021-01-09 16:48:47 +01:00
abdo
a17d309ed3 Move tag collapse method to the backend 2021-01-09 17:10:16 +03:00
abdo
a18227acc4 Do not check for missing tag parents at registration time 2021-01-09 17:10:16 +03:00
abdo
a30a2638ce Hierarchical tags 2021-01-09 17:10:13 +03:00
RumovZ
370c689c83 Prettify frontend filter code 2021-01-09 12:34:46 +01:00
RumovZ
0cb75f5601 Use backend filters instead of literal searches 2021-01-09 10:51:15 +01:00
abdo
4418e896bd Exclude aqt/hooks_gen.py from formatting 2021-01-09 03:01:48 +03:00
wallgrenen
3a1ef7b651 remove unused variables and commented-out code 2021-01-08 20:53:27 +01:00
RumovZ
0ebaf98c96 Compare and save filters normalised
When checking whether the current search is a saved filter, compare the
searches normalised to allow the detection of equivalent expressions.
Invalid searches are accepted unaltered to allow the deletion of invalid
saved filters.
As for saving new filters, do so normalised, respectively, reject
invalid searches.
2021-01-07 22:11:21 +01:00
RumovZ
5a559cab16 Format 2021-01-07 18:20:14 +01:00
RumovZ
ad361e7a77 Provide ConcatSeparator through rsbackend.py 2021-01-07 17:48:30 +01:00
Damien Elmes
dda65cac9a ignore missing pyaudio 2021-01-07 16:25:55 +10:00
Damien Elmes
2b5ef0b9a8 fix qt/ pylints 2021-01-07 16:21:50 +10:00
Damien Elmes
685e841771 cap pylint CPUs in qt/
After 4 cores, improvements are tiny, and soon start going backwards,
presumably due to the overhead of importing PyQt into each worker.
2021-01-07 16:19:52 +10:00
Damien Elmes
6872744689 fix pylint in qt
pylint fails to read Qt modules when invoked as a subprocess with
-j 0, and it looks like I committed this in the middle of debugging
the issue. Work around it by invoking pylint directly. It's still
awfully slow, taking 30 seconds on a 10 core machine.
2021-01-07 15:47:25 +10:00
Damien Elmes
5a1fb1da98 fix another broken setWindowFlags 2021-01-07 14:46:55 +10:00
Damien Elmes
8075d46011 convert setWindowFlags call into helper, and fix invalid variables
"type: ignore" was masking the invalid references to self in places
like showText()
2021-01-07 14:24:49 +10:00
Damien Elmes
73eec46bda Merge pull request #860 from RumovZ/norm-search
Normalise search
2021-01-07 10:51:36 +10:00
Damien Elmes
6fa649e8bf only adjust search on left button click
Closes #898
2021-01-07 10:08:23 +10:00
wallgrenen
49781ea29a replace broken link 2021-01-07 09:56:25 +10:00
Damien Elmes
07e7815ec4 Merge pull request #899 from BlueGreenMagick/remove-context-help-btn
remove context help button
2021-01-07 09:52:12 +10:00
RumovZ
ac4d254793 Merge branch 'master' of https://github.com/ankitects/anki into norm-search 2021-01-06 20:57:24 +01:00
RumovZ
85cb9c318c Format 2021-01-06 20:35:11 +01:00
RumovZ
163f92729d Add exception handling for filter modifications 2021-01-06 20:25:13 +01:00
RumovZ
0b1eec9cd8 Add tests for writer.rs
Also minor adjustments to concatenate_searches.
2021-01-06 19:39:34 +01:00
RumovZ
f061ccfb02 Implement search replacing via Ctrl+Shift combo
Also switch to using the new backend functions for concatenating and
negating searches.
2021-01-06 18:32:29 +01:00
wallgrenen
1c5f0ad44f replace broken link 2021-01-06 17:03:39 +01:00
BlueGreenMagick
9a29d1b97a remove context help button 2021-01-06 22:15:48 +09:00