Commit Graph

2449 Commits

Author SHA1 Message Date
RumovZ
db9594818a Handle failure in CardLayout/accept() 2021-05-25 20:58:43 +02:00
Damien Elmes
5a8f534f00 always start in first sidebar mode
I didn't notice anyone objecting; let's see how this is received.

https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/35
2021-05-24 14:51:21 +10:00
Damien Elmes
adcdb422c5 config updates by the frontend now skip undo by default 2021-05-24 14:50:46 +10:00
Damien Elmes
47076b9ac5
Merge pull request #1188 from RumovZ/switch-color-2
Change switch color depending on state
2021-05-24 11:42:54 +10:00
Damien Elmes
54628c3ac7 make switch more legible in dark mode 2021-05-24 11:31:56 +10:00
Damien Elmes
a0eebb78ce
Merge pull request #1186 from RumovZ/ctx-actions
Update context action states after card op
2021-05-24 10:49:23 +10:00
RumovZ
ff76d50338 Remove browser.oneModelNotes() 2021-05-22 19:12:03 +02:00
RumovZ
0dca3ef548 Check notetype count in browser.onChangeModel() 2021-05-22 19:11:06 +02:00
RumovZ
cba5c2253a Change switch color depending on state
Make knob overlap path.
2021-05-22 10:01:15 +02:00
RumovZ
29589fcf0d Update context action states after card op 2021-05-22 08:35:47 +02:00
Damien Elmes
195c41cba3
Merge pull request #1185 from RumovZ/scrolling
Scroll pixels instead of columns horizontally
2021-05-22 10:59:09 +10:00
Damien Elmes
d7d226843e improve type answer legibility
https://forums.ankiweb.net/t/accessibility-suggestion-correct-answer-text-contrast-in-dark-mode/10105

There's probably more that could be done here, but that can probably
wait for #1068
2021-05-22 10:31:29 +10:00
Damien Elmes
958c53d886 fix find&replace searching in incorrect field 2021-05-22 10:12:14 +10:00
RumovZ
d46fe913a5 Scroll pixels instead of columns horizontally 2021-05-21 18:59:53 +02:00
Damien Elmes
3d4cf26758 expose undoable config changes to frontend; refresh sidebar
The browser header handling still needs updating
2021-05-21 17:50:41 +10:00
Damien Elmes
99b7da49a9 report changed cards when changing deck/flag
+ fix repeated flag shortcut not toggling
2021-05-21 16:03:05 +10:00
Damien Elmes
398cdc8992 add night mode styling to type-in-the-answer box
https://forums.ankiweb.net/t/night-mode-does-not-affect-input-tags/10116
2021-05-20 19:14:12 +10:00
RumovZ
5a6ba1b0b9 Move flags into separate module 2021-05-20 10:26:18 +02:00
Damien Elmes
422584b814 fix error when opening and closing editor rapidly 2021-05-20 15:32:28 +10:00
Damien Elmes
d5f4860f9b fix fields/cards font size & too-large toolbar on high DPI Windows
- enable default_css on editor again, so that the html element
is set to the system font size. If this is bringing in unwanted styling,
maybe we can come up with a different solution that just adjusts the
fonts
- make toolbar size relative to html font size, instead of hard-coding
it
2021-05-20 13:15:17 +10:00
Damien Elmes
055f2907ec
Merge pull request #1178 from RumovZ/flag-labels
Custom labels for flags
2021-05-20 11:59:55 +10:00
RumovZ
6fb2d30426 Remove redundant pylint exception 2021-05-19 19:44:49 +02:00
RumovZ
f960299345 Prefer looping over flags over exhaustive listing 2021-05-19 19:26:39 +02:00
RumovZ
b5fa7923e6 Use custom flag labels in reviewer 2021-05-19 19:18:49 +02:00
RumovZ
5fa68c885a Use dataclass instead of tuple for loaded flags 2021-05-19 19:17:43 +02:00
abdo
bbb2f7158f Strip Unicode isolation characters from title 2021-05-19 18:21:57 +03:00
Damien Elmes
df38788e07 move deck name into window title; v-center sticky bar 2021-05-19 19:34:15 +10:00
Damien Elmes
fdd162a7b9 simplify previous patch
The default 1 rem is fine, but we need to apply the default font size
to the html element instead of the body for the definition of rem to
update.

Fixes #1174
2021-05-19 19:06:20 +10:00
RumovZ
30736ddf75 Use custom flag labels for browser actions 2021-05-19 11:00:02 +02:00
RumovZ
9816227b5c Make sidebar flags renamable 2021-05-19 10:04:40 +02:00
Damien Elmes
581480191a show note about old options screen if any add-ons are installed 2021-05-19 16:20:25 +10:00
Damien Elmes
63f1a363af use literal for ease type 2021-05-19 16:05:12 +10:00
Damien Elmes
9f3f6bab7d enable redo support
Also:

- fix issues where the Undo action in the Browse screen was not
consistent with the main window. The existing hook signature has been
changed; from a snapshot of the add-on code from a few months ago, it
was not a hook that was being used by anyone.
- change the undo shortcut in the Browse window to match the main
window. It was different because undoing a change in the editing area
could accidentally trigger an undo of an operation, but the damage is
limited now that (most) operations can be redone. If it still proves to
be a problem, perhaps we should just always swallow ctrl+z when an
editing field is focused.
2021-05-19 15:18:39 +10:00
RumovZ
3b5e8e5041 Fix black workaround for format calls 2021-05-18 22:19:09 +02:00
Damien Elmes
fa47f6ec15
Merge pull request #1170 from RumovZ/fix-columns
Fix column issues
2021-05-18 09:24:15 +10:00
Damien Elmes
157f602624 fix detection of shift key at startup
Our regular helper doesn't appear to work during startup.
2021-05-18 09:21:02 +10:00
Damien Elmes
bd24005e08 PreviewDialog was missing from top level browser module 2021-05-18 09:10:28 +10:00
RumovZ
2290a1652d Set column sizes and indicator after state change 2021-05-17 20:13:45 +02:00
RumovZ
9ceee90942 Block events when restoring headers
Restoring headers after switching states was triggering
_on_column_toggled(), leading to unexpected results.
2021-05-17 20:07:52 +02:00
RumovZ
02f86ec352 Make failed sort column change a no-op
The previous behaviour when a non-sortable column was clicked was to
trigger the sorting routine, which was usually a no-op, but would
reorder rows if the configured sort column was hidden.
2021-05-17 18:33:59 +02:00
Damien Elmes
9edac805ad support card state mutator in test scheduler
Documentation to come
2021-05-17 16:59:02 +10:00
Damien Elmes
1a48622d77 experiment with learning count on deck list 2021-05-16 20:23:39 +10:00
Damien Elmes
390a8421aa fix test scheduler undo + implement look-ahead
Instead of using a separate undo queue, the code now defers checking for
newly-due learning cards until the answering stage, and logs the updated
cutoff time as an undoable change, so that any newly-due learning cards
won't appear instead of a new/review card that was just undone.

Queue redo now uses a similar approach to undo, instead of rebuilding the
queues.
2021-05-14 22:16:53 +10:00
Damien Elmes
c41d5ca4bf work around Windows issue on latest Black
Thanks Rumo!
d797900386
2021-05-13 20:15:51 +10:00
Damien Elmes
99081e422b re-enable leech notification for test scheduler 2021-05-13 15:51:02 +10:00
Damien Elmes
dbbcb3e38c expose new sorting options in test scheduler options; move things around 2021-05-13 15:23:16 +10:00
Damien Elmes
49a1580566 use new API for test scheduler
Avoids duplicate work, and is a step towards allowing the next
states to be modified by third-party code.

Also:

- fixed incorrect underlined count, due to reviews being labeled as
learning cards
- fixed reviewer not refreshing when undoing a test review, by splitting
up backend queue rebuilding from frontend reviewer refresh
- moved answering into a CollectionOp
2021-05-11 13:06:03 +10:00
Damien Elmes
3736e63a57 expose step counter and undone op changes in hook 2021-05-08 17:51:36 +10:00
Damien Elmes
4be5d08559 remove some unnecessary checkpoints 2021-05-08 17:04:05 +10:00
Damien Elmes
1918031399 update find_duplicates to use QueryOp/CollectionOp 2021-05-08 16:58:18 +10:00
Damien Elmes
f2db822c08 move query_op into operations/, and add the ability to show progress 2021-05-08 16:35:43 +10:00
Damien Elmes
b887032244 split browser dialogs into separate files 2021-05-08 15:08:45 +10:00
Damien Elmes
0b8733032d the find_and_replace alias is not required
Was only added recently, so nothing should depend on it yet.
2021-05-08 14:34:57 +10:00
Damien Elmes
78a3536bfc move "find duplicates" into separate file
As far as I'm aware, no add-ons were extending that screen, so I've
dropped the old context object and the export in browser/__init__.py
2021-05-08 14:33:43 +10:00
Damien Elmes
010c3da770
Merge pull request #1159 from hgiesel/newapproach
Prefer idiomatic Svelte features over dynamic components
2021-05-08 11:35:31 +10:00
Henrik Giesel
8b0c6ba5df Check for id when inserting dynamic elements
* I'm not sure it behaved, if there were multiple elements
  inserted by different add-ons into the same container
2021-05-07 16:50:17 +02:00
Henrik Giesel
6a804f6775 Use json.dumps instead of backticks in editor.py 2021-05-07 14:22:06 +02:00
Damien Elmes
7442eed41a update docstrings for latest black 2021-05-07 18:12:56 +10:00
Damien Elmes
3d8b7d943c fix find&replace 2021-05-07 14:02:40 +10:00
Henrik Giesel
de8abebcd1 Fix Preview Button after changing from f-string to normal string 2021-05-07 02:12:37 +02:00
Henrik Giesel
2112b419f9 Fix ButtonDropdown 2021-05-07 02:04:44 +02:00
Henrik Giesel
0f4d4eb5a9 Only initialize extension apis if necessary 2021-05-07 02:04:44 +02:00
Henrik Giesel
c9368ed98f Add lefttopbtns as AddonButtons 2021-05-07 02:04:44 +02:00
Henrik Giesel
e80f43e8fc Enable setting of PreviewButton and hiding of cloze button again 2021-05-07 02:04:42 +02:00
Henrik Giesel
6d6c798ca3 Simplify structure of EditorToolbar and ButtonGroup in editor HTML file 2021-05-07 02:03:55 +02:00
Damien Elmes
fc2d3ba07c remove AnkiDroid timezone confirmation
By the time this update reaches stable, AnkiDroid 2.15 should already
be out.
2021-05-06 19:05:15 +10:00
Damien Elmes
2663c891eb fix dmypy action 2021-05-05 15:54:41 +10:00
Damien Elmes
abab4826bb support undo for (renamed) unbury_deck() action 2021-04-30 20:03:20 +10:00
Damien Elmes
248373ef30 undoing of notetype templates 2021-04-30 17:30:48 +10:00
Damien Elmes
9a46ad6352 undoing of notetype fields
- fix stale cache issue
- update add cards screen in response to op changes
2021-04-30 17:15:59 +10:00
Damien Elmes
b9417fc583 notetype rename+options undo 2021-04-30 16:09:44 +10:00
Damien Elmes
394fe86f8f notetype removal undoable 2021-04-30 16:01:47 +10:00
Damien Elmes
ea758f0092 update GUI to allow notetype addition undo
- backend now updates current notetype as part of addition
- frontend no longer implicitly adds, so we can assign a new name and
add in a single operation
2021-04-30 15:58:08 +10:00
RumovZ
abd02d7891 Add separate no_arg_trigger decorator 2021-04-26 08:46:08 +02:00
Damien Elmes
f77983fc9f
Merge pull request #1154 from RumovZ/fix-skip-dec
Fix skip_if_selection_is_empty() for triggers
2021-04-26 09:21:42 +10:00
RumovZ
594fe303da Remove some unnecessary lambdas 2021-04-25 19:51:57 +02:00
RumovZ
9900f73cee Fix skip_if_selection_is_empty() for triggers
It seems to be enough if one decorator calls pyqtSlot(), but to avoid
problems in the future, let's have all decorators do that.
2021-04-25 19:50:56 +02:00
Henrik Giesel
268adf1d03 Move EditorToolbar API into EditorToolbar.svelte 2021-04-25 19:15:00 +02:00
Henrik Giesel
f5fba15435 Initialize editor toolbar via function, not web component 2021-04-25 18:32:01 +02:00
Damien Elmes
b7b329cf90
Merge pull request #1151 from RumovZ/no-sel-dec
Fix some problems with browser actions while selection is empty
2021-04-25 20:48:40 +10:00
Damien Elmes
eb3f3ddd45 enable the new deck options by default
- The old options are still available with a shift+click
- Translations still need updating
- See b7747b6a38 for some examples
of extending the screen in an add-on
2021-04-25 19:58:58 +10:00
Damien Elmes
a1ce048ed5 fix error when user cancels out of set due date/reposition 2021-04-25 19:33:25 +10:00
Damien Elmes
b7747b6a38 experimental support for extending add-ons screen with Svelte 2021-04-25 19:33:18 +10:00
Damien Elmes
b485b8cbb9 deckconfig->deckoptions 2021-04-25 19:02:30 +10:00
RumovZ
b1392980f5 Skip some browser methods if selection is empty
This was handled inconsistently before:
* Select Notes would throw a search error.
* Set Due Date would throw an exception.
* Dialogs with no effect would open.
* No-ops would be pushed to the undo queue.
2021-04-25 08:47:15 +02:00
RumovZ
458d891d28 Add dec to make methods no-op if no selection 2021-04-25 08:36:22 +02:00
Damien Elmes
e2a4d6041c basic support for add-ons in new deck config screen
- expose the data as a writable store
- currently only supports raw HTML; example to come
- fix changes not marking a deck config as modified
- the data is currently packed into the deckconfig object, but we
may move these to a separate store in the collection config in the
future, like is done with decks/notetypes
2021-04-24 11:08:01 +10:00
Henrik Giesel
452fdf05af Remove unused import 2021-04-24 01:32:02 +02:00
Henrik Giesel
1f05ebbcf7 Remove addcards toolbar again for now 2021-04-24 00:10:45 +02:00
Henrik Giesel
9f7a187d4a Add mostly working addcards topbar 2021-04-24 00:00:32 +02:00
Henrik Giesel
8ecd4f8c95 Add simple version of Chooser buttons 2021-04-23 21:25:44 +02:00
Henrik Giesel
48b7cb49f9 Make update algorithm in editor-toolbar/index.ts recursive 2021-04-23 20:50:09 +02:00
Henrik Giesel
6ae368ebac Reduce typing overhead in ts/editor-toolbar/index.ts and export buttonGroup 2021-04-23 19:05:43 +02:00
Henrik Giesel
bda99ee0f1 Add IterableToolbarItem interface for easier typing 2021-04-23 18:53:52 +02:00
Henrik Giesel
7563a3c929 Use rawButton in browser.py 2021-04-23 17:34:42 +02:00
Henrik Giesel
4379f1e84f Make dynamicComponents usable for addons, rather than the components directly
rawButton({ html: ... })

instead of

{ component: RawButton, html: ... }
2021-04-23 16:43:36 +02:00
Damien Elmes
02ebab7491
Merge pull request #1146 from hgiesel/shortcuts
Shortcut API for Editor
2021-04-23 09:44:01 +10:00
Damien Elmes
f6a59ebdfa split deck description into separate screen linked from overview 2021-04-22 21:03:16 +10:00
Henrik Giesel
d2ca94a29d Move other buttons to WithShortcut 2021-04-22 03:25:31 +02:00
Damien Elmes
30f5269304 hook new deck config screen up behind an env var 2021-04-22 10:59:16 +10:00
Henrik Giesel
85f89dc111 Add first shortcuts for bold, italic, underline, removeFormat 2021-04-22 02:37:04 +02:00
Henrik Giesel
b1de095162 Include editor-toolbar as a library in editor 2021-04-20 13:44:44 +02:00
Henrik Giesel
83d5d72777 Generalize inListItem to getAnchorElement 2021-04-20 13:44:43 +02:00
Damien Elmes
41d5cae7db fix Find Dupes activation 2021-04-20 21:13:21 +10:00
Damien Elmes
55277aa90a implement deck config saving on JS end 2021-04-20 19:50:05 +10:00
Damien Elmes
10b7ab2c6d include sourcemaps for pages/* in dev builds 2021-04-20 17:33:46 +10:00
RumovZ
3cecc7157b Add sidebar filter "first review today" 2021-04-18 13:27:10 +02:00
Damien Elmes
76eb119870 add schema change prompt to removal, tweak return struct 2021-04-18 17:33:12 +10:00
Damien Elmes
1648adc126
Merge pull request #1130 from glutanimate/add-deckchooser-to-addcards-legacy-api
Add AddCards.deckChooser property for legacy add-on support
2021-04-16 11:58:34 +10:00
Damien Elmes
6632b63a11 support overriding listening IP during dev 2021-04-16 10:23:13 +10:00
Glutanimate
a446e7320c Add AddCards.deckChooser property for legacy access 2021-04-15 18:18:25 +02:00
Henrik Giesel
5702b3c273 Add type to add_preview_shortcut 2021-04-15 15:50:29 +02:00
Henrik Giesel
82f6e19955 Add Latex formatting options to menu
*  Format shortcuts in monospace font and increase padding a little bit
2021-04-15 15:20:37 +02:00
Henrik Giesel
53ae03becc Add Preview shortcut for browser 2021-04-15 13:09:51 +02:00
Henrik Giesel
a7d24e7159 Add support for Preview button in Browser 2021-04-15 13:09:50 +02:00
Henrik Giesel
920b740c8f Add RawButton and hook old python hooks up to it 2021-04-15 13:09:50 +02:00
Henrik Giesel
eceb98f8e6 Show/Hide Cloze button depending on whether cloze type 2021-04-15 13:09:50 +02:00
Henrik Giesel
37ed3e8209 Fix some code quality issues 2021-04-15 13:09:49 +02:00
Henrik Giesel
7f42b38e7a Add labels and titles to all buttons 2021-04-15 13:09:49 +02:00
Henrik Giesel
a820059b8f Utilize enableButtons disableButtons from Svelte component 2021-04-15 13:09:49 +02:00
Henrik Giesel
a0a9619722 Include icons directly in ts lib 2021-04-15 13:09:49 +02:00
Henrik Giesel
7787a7827f First implementation 2021-04-15 13:09:48 +02:00
Henrik Giesel
de77e40e4d Add ts/editor-toolbar 2021-04-15 13:09:48 +02:00
RumovZ
f7bf90100d Fix ChangeModel combos being cleared after setup() 2021-04-14 23:01:40 +02:00
Damien Elmes
0b8ae7225a add a shortcut to speed up local ts dev
@hgiesel if you're not already doing something like this, you might
find this useful
2021-04-14 23:21:33 +10:00
Damien Elmes
7f738c11a2 deck config prototype work in progress
Still in the early stages, and not hooked up yet.
2021-04-14 22:33:10 +10:00
Damien Elmes
4a406192fa
Merge pull request #1127 from Arthur-Milchior/factorize_current_search
NF: factorize browser.current_search
2021-04-14 19:16:59 +10:00
Damien Elmes
e472375917 fix formatting in dmypy.py 2021-04-14 19:11:01 +10:00
Arthur Milchior
be44d4eeed NF: factorize browser.current_search
I was looking at search code and find out that's already slightly more clear/short even if NF
2021-04-14 10:55:41 +02:00
Damien Elmes
cca9195ea5 run prettier on some sass files 2021-04-14 18:22:33 +10:00
Damien Elmes
c49d6ce49f run black/isort on Python scripts 2021-04-14 18:22:02 +10:00
Damien Elmes
01049b1289 add an updated script to run mypy as a daemon
Sadly doesn't work on Windows
2021-04-14 18:10:38 +10:00
Damien Elmes
fc8a5759d5
Merge pull request #1124 from hgiesel/dropjquerypy2
Remove jQuery from remaining qt/aqt files
2021-04-14 12:43:11 +10:00
Damien Elmes
ca6edc1470
Merge pull request #1123 from hgiesel/reviewerbottomdropjquery
Remove jQuery reviewer-bottom.ts and overview.ts
2021-04-14 12:35:39 +10:00
Damien Elmes
ff944c88fb
Merge pull request #1122 from hgiesel/webviewcss2
Prefer SASS over including files
2021-04-14 11:55:19 +10:00
Damien Elmes
e530b96998 add missing type annotation 2021-04-14 11:28:40 +10:00
Damien Elmes
9ff3ad15a5
Merge pull request #1121 from RumovZ/move-sidebar
More for the browser folder
2021-04-14 11:25:15 +10:00
Damien Elmes
bf46176af9 add contributor 2021-04-14 11:03:17 +10:00
Henrik Giesel
280f78535b Replace jQuery in webview.py 2021-04-13 21:32:53 +02:00
Henrik Giesel
3e1b42bb62 Satisfy formatter 2021-04-13 20:29:59 +02:00
Henrik Giesel
67754494d2 Remvoe jQuery from deckbrowser.py
It's not quite clear why jQuery was necessary here?
2021-04-13 20:26:06 +02:00
Henrik Giesel
7dd12a523d Remove jquery from reviewer.py
- we no longer actually need to focus the default ease button
2021-04-13 20:11:18 +02:00
Henrik Giesel
bdf1e6324e Remove jQuery from toolbar.py 2021-04-13 19:59:00 +02:00
Henrik Giesel
64c7d405f5 Remove jquery from browser.py 2021-04-13 19:54:45 +02:00
Henrik Giesel
191e3cf69b Satisfy formatter 2021-04-13 19:47:03 +02:00
Henrik Giesel
a76f1d64ad Move compile_sass.bzl to /ts + Remove core.css from data/web (unused?) 2021-04-13 19:47:03 +02:00
Henrik Giesel
ffd159f9a0 Declare dependencies in data/web/css 2021-04-13 19:47:03 +02:00
Henrik Giesel
8f0f8f9af8 Use graphs-base and congrats-base 2021-04-13 19:47:03 +02:00
Henrik Giesel
fee6ee7319 Do not include webview.css for editor 2021-04-13 19:47:03 +02:00
Henrik Giesel
825509ba0c Move card_counts and split off fusion_vars 2021-04-13 19:47:03 +02:00
Henrik Giesel
df7c597a8b Add option not include default css in stdHtml 2021-04-13 19:47:03 +02:00
Henrik Giesel
86262030e3 Purge jQuery from reviewer-bottom 2021-04-13 19:41:04 +02:00
Henrik Giesel
ae3f8adbb3 Remove overview.ts 2021-04-13 19:38:57 +02:00
Damien Elmes
18f03d5cb1
Merge pull request #1119 from hgiesel/reviewerdropjquery
Remove last jQuery from reviewer.ts / Remove fadeTime
2021-04-13 23:12:13 +10:00
Henrik Giesel
be7630648d Add setInnerHTML as a Replacement for $.html 2021-04-13 13:32:50 +02:00
RumovZ
594a98eff1 Move previewer.py into browser folder 2021-04-13 11:38:35 +02:00
RumovZ
e43f11339f Declare all legacy pathnames in browser init 2021-04-13 11:30:32 +02:00
RumovZ
88086596b6 Move find_and_replace.py into browser/dialogs 2021-04-13 11:21:36 +02:00
RumovZ
7ee40e3dce Refactor sidebar.py into browser folder 2021-04-13 11:05:49 +02:00
Damien Elmes
e520e8df02 add missing copyright headers to *.ts 2021-04-13 18:57:08 +10:00
Damien Elmes
948fc5f777 add missing copyright headers to *.py 2021-04-13 18:45:35 +10:00
Henrik Giesel
c9fcf955f4 Remove display:none from mark and flag, and preset hidden attribute instead 2021-04-13 01:00:09 +02:00
Henrik Giesel
74a9d0b0a1 Make imageLoaded adhere to its function signature 2021-04-13 00:42:09 +02:00
Henrik Giesel
f4f0298378 Remove jQuery from mark and flag in reviewer.ts 2021-04-13 00:37:58 +02:00
Henrik Giesel
e131b70c4c Remove jQuery from _updateQA 2021-04-13 00:22:00 +02:00
RumovZ
2000c80fd2 Refactor browser and table into folders 2021-04-12 09:50:44 +02:00
Damien Elmes
12ce632605 handle missing default sort column in notes view
Switching to notes mode was throwing:

  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/browser.py", line 449, in on_table_state_changed
    self.table.toggle_state(checked, self._lastSearchTxt)
  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/table.py", line 206, in toggle_state
    self._state = self._model.toggle_state(
  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/table.py", line 996, in toggle_state
    self.search(context)
  File "/Users/dae/Work/code/dtop/bazel-copy/runanki.runfiles/net_ankiweb_anki/qt/aqt/table.py", line 1005, in search
    context.order = self.columns[self._state.sort_column]
2021-04-12 16:02:51 +10:00
RumovZ
d4159fef19 Save separate browser mode headers 2021-04-11 12:28:11 +02:00
RumovZ
fadec3dc5b Merge branch 'master' into backend-columns 2021-04-11 11:18:15 +02:00
RumovZ
db32179a25 Add browser_did_fetch_columns hook and some doc 2021-04-11 10:27:43 +02:00
RumovZ
eafa2afc0d Resolve config sort in table model 2021-04-10 11:33:59 +02:00
RumovZ
48b70873cb Rename column label fields 2021-04-10 09:14:20 +02:00
RumovZ
c74078ea9e Unify state columns
* Remove duplicate backend columns
* Remove duplicate column routines
* Move columns on frontend from state to model
* Generate available columns from Colum enum
* Add second column label for notes mode
2021-04-08 23:48:24 +02:00
RumovZ
8a131da9a2 Add enum for column sorting 2021-04-08 11:40:24 +02:00
RumovZ
d8a0aa922c Add enum for column alignment 2021-04-08 11:28:29 +02:00
RumovZ
f78401619a Remove Column class and use pb class instead 2021-04-08 11:17:25 +02:00
Damien Elmes
1ee4385fcf i18n tts error message 2021-04-08 09:35:19 +10:00
Damien Elmes
28f830730e fix '\\' being converted to single backslash
Appears the default changed in 3.x
https://github.com/mathjax/MathJax/issues/2532

https://forums.ankiweb.net/t/double-backslashes-in-text-of-notes-are-turned-into-single-backslashes-on-display/9048
2021-04-07 21:50:33 +10:00
RumovZ
6abb05d074 Save key for unsupported add-on columns 2021-04-06 23:02:58 +02:00
RumovZ
a5c02910a6 Use backend column objects on frontend 2021-04-06 19:47:03 +02:00
RumovZ
08226e2004 Change notes mode shortcut 2021-04-06 16:48:35 +02:00
Damien Elmes
6e954e82a5 current deck change is now undoable
- make sure we set flag in changes when config var changed
- move current deck get/set into backend
- set_config() now returns a bool indicating whether a change was
made, so other operations can be gated off it
- active decks generation is deferred until sched.reset()
2021-04-06 21:52:06 +10:00
RumovZ
4903a325d4 Fix get_item_from_card_id() 2021-04-06 12:06:08 +02:00
RumovZ
a1277b0919 Tweak new browsing strings 2021-04-06 11:41:18 +02:00
Damien Elmes
5676ad5101 update find&replace, and remove perform_op() 2021-04-06 17:07:38 +10:00
Damien Elmes
84fe309583 update scheduling ops
- migrate to CollectionOp()
- return actual change count when suspending/burying
- add helper to convert vec to vec of newtype
2021-04-06 16:38:42 +10:00
Damien Elmes
2de8cc1a94 update note ops
remove_note() now returns the count of removed cards, allowing us
to unify the tooltip between browser and review screen

I've left the old translation in - we'll need to write a script at
one point that gathers all references to translations in the code,
and shows ones that are unused.
2021-04-06 14:56:36 +10:00
Damien Elmes
bc78b6ef17 migrate more ops to CollectionOp 2021-04-06 14:36:13 +10:00
Damien Elmes
27c032a158 it seems mypy ignores the generic class bound if it's a type alias 2021-04-06 14:14:55 +10:00
Damien Elmes
b8fc195cdf start migrating perform_op() into builder in separate file
By passing back the builder to the calling code to run, we don't need
to plumb extra arguments like success= and handler= through each
operation, and the ability to override the default tooltip behaviour
comes free on all operations
2021-04-06 12:47:55 +10:00
Damien Elmes
1ece868d02 shift keep-current-selection logic into sidebar's refresh()
By calling refresh() manually after performing an op, we were refreshing
twice, and the selection was being lost when changes were made outside
of the sidebar.

Also drop the after_hooks arg to perform_op(), since nothing is using
it now.
2021-04-06 11:18:13 +10:00
Damien Elmes
3f62f54f14 more perform_op() tweaks
- pass the handler directly
- reviewer special-cases for flags and notes are now applied at
call site
- drop the kind attribute on OpChanges which is not needed
2021-04-06 10:14:11 +10:00
Damien Elmes
9c8148ff0d fix error when opening browser during review while notes mode active 2021-04-05 21:57:06 +10:00
Damien Elmes
758550ea17 fix row cache issues
I think this may have accidentally been changed in the refactoring.
If we discard self._rows, it will result in the entire table flashing
"..." until the new data is available. Instead, we leave the cached
rows alone, and just update the cutoff point, so we can serve stale
content (avoiding any visible redraw) until the new data is available.

I've updated search() to reset the rows there, so we free up memory
on a new search.
2021-04-05 14:42:04 +10:00
Damien Elmes
a18bb2af12 add booleans for various screens to OpChanges
The backend knows exactly which op has executed, and it saves us having
to re-implement this logic on each client.

Fixes the browser table refreshing when toggling decks.
2021-04-05 14:28:56 +10:00
Damien Elmes
f6ec5928ae allow ops to pass metadata into perform_op()
Instances can pass handled_by=self to more easily ignore events they
initiate.

Fixes ugly refresh when expanding/collapsing decks, but we're still
refreshing the card/notes area unnecessarily in that case.
2021-04-05 13:43:09 +10:00
Damien Elmes
996d9f9bbc undo support for tag collapse; expand->collapse for consistency w/ decks 2021-04-05 11:47:12 +10:00
Damien Elmes
2168dfe63d add routine to set deck collapse state
Updating a deck via protobuf is now exposed on the backend, but not
currently on the frontend - I suspect we'll be better off writing
separate routines for the actions we need instead, and we get a better
undo description for free.

This is currently causing an ugly redraw in the browse screen, which
will need fixing.
2021-04-05 11:19:04 +10:00
Damien Elmes
c60b88cd2f expose read-only access to new deck objects 2021-04-04 20:39:56 +10:00
Damien Elmes
12a3d9ec87 ensure page is shown when setHtml() called
https://forums.ankiweb.net/t/looked-into-the-bug-when-pressing-e-and-r-together-in-filtered-deck/8951
2021-04-03 16:59:23 +10:00
Damien Elmes
3a6f2a993e move operations into submodule 2021-04-03 16:26:10 +10:00
Damien Elmes
41c5a25dc8 simplify errors
- use a flat enum instead of oneof messages, most of which were empty
- tidy up the Python side
2021-04-03 16:06:46 +10:00
Damien Elmes
f666f15b63 use perform_op() for undo()
Instead of manually updating the UI after undoing, we just rely
on the same change notification infrastructure regular operations
use.
2021-04-03 14:38:49 +10:00
Damien Elmes
e73359510d move filtered deck labels to backend
- use strum to generate an iterator for the protobuf enum so we don't
forget to add new labels if extending in the future
- no add-ons appear to be using dynOrderLabels(), so it has been removed

@RumovZ perhaps a similar approach might work for listing the available
browser columns as well?
2021-04-01 23:53:38 +10:00
Damien Elmes
8449bbe469
Merge pull request #1108 from RumovZ/more-columns
Even more browser fixes and features
2021-04-01 15:59:06 +10:00
Damien Elmes
dd17da7d5c
Merge pull request #1106 from abdnh/fix-deprwarn
Fix deprecated implicit conversion from float to int using __int__()
2021-04-01 15:14:49 +10:00
Damien Elmes
9c1dc2b62e tweak the wording of some of the tag ops 2021-04-01 15:12:13 +10:00
RumovZ
52b66dc985 Add shortcut and tooltip to switch 2021-03-31 18:53:36 +02:00
RumovZ
fd4b5dc695 Delay switch animation
If the switch triggers heavy GUI action, like a lot of paint()s, the
concurrently running switch animation may look choppy.
A small timer makes these events execute first and the animation will
run smoothly afterwards when the event queue has been drained.
2021-03-31 12:13:09 +02:00
RumovZ
c8146c13c1 Make toggle actions checkable 2021-03-31 10:05:44 +02:00
RumovZ
e5d68df527 Change switch knob colour 2021-03-31 09:16:25 +02:00
RumovZ
8779fb5ede Add note interval column 2021-03-30 23:44:35 +02:00
abdo
d7aca8845f Fix deprecated implicit conversion from float to int using __int__() 2021-03-31 00:32:20 +03:00
RumovZ
d7da1c1578 Fix previewer not changing card 2021-03-30 22:06:58 +02:00
RumovZ
1ad91a5312 Add note due column 2021-03-30 21:39:15 +02:00
RumovZ
ffe77b1291 Add browser column enum for backend 2021-03-30 11:59:52 +02:00
Damien Elmes
49e4dba0d1
Merge pull request #1103 from abdnh/win-openfolder
Fix ResourceWarning in openFolder() on Windows
2021-03-30 19:28:12 +10:00
Damien Elmes
325920aa23
Merge pull request #1102 from RumovZ/more-browser
More browser fixes and features
2021-03-30 19:27:55 +10:00
RumovZ
4933b922f7 Add note lapses column 2021-03-29 16:06:15 +02:00
RumovZ
32e538d0db Add note reps column 2021-03-29 15:52:02 +02:00
RumovZ
18e33f24d3 Make note state equate to False as on backend 2021-03-29 15:51:34 +02:00
RumovZ
ad7ac06398 Add switch for browser states 2021-03-29 12:24:24 +02:00
RumovZ
a3e3e56f2b Implement custom qt button Switch 2021-03-29 12:19:48 +02:00
RumovZ
2c7940e247 Fix browser_did_fetch_row hook 2021-03-29 12:16:50 +02:00
RumovZ
13a0e2c82f Remove fixme for card_ids legacy support 2021-03-29 12:07:24 +02:00
RumovZ
c0950eca30 Explain use of deprecated decorator 2021-03-29 12:04:14 +02:00
RumovZ
b1a06fb807 Flag deleted rows as inactive 2021-03-29 11:55:28 +02:00
RumovZ
fb86320038 Fix state toggling when current is deleted 2021-03-29 11:54:35 +02:00
Damien Elmes
bcb1a2a329 fix 'lame missing' message not being shown
https://forums.ankiweb.net/t/cant-use-voice-recorder/8753
2021-03-29 19:52:30 +10:00
RumovZ
d6bac20c58 Fix issues with scrolling row into view
1) Check whether full row height is in viewport instead of just the
top left corner.
2) Add timer before scrolling to current row so editor will already
be set up.
2021-03-29 11:40:18 +02:00
RumovZ
f3915b914a Stop abusing qt accel string 2021-03-29 11:18:10 +02:00
Damien Elmes
ecb6cfdb4b
Merge pull request #1095 from hgiesel/svgloader2
Use svg-loader to load svgs directly into ts packages
2021-03-29 17:56:48 +10:00
Damien Elmes
bb1a2cb78b fix an unused import 2021-03-29 17:26:20 +10:00
Damien Elmes
8e66595c63 fix default note column headers 2021-03-29 17:22:39 +10:00
Damien Elmes
3383f1742a rename BrowserCardState
Use a more verbose name, and use 'note' rather than 'card', so we
can rely on the default of False
2021-03-29 17:12:45 +10:00
Damien Elmes
0269a4a8f4 Item -> ItemId 2021-03-29 16:52:41 +10:00
Damien Elmes
28aae21d51 List->Sequence in a bunch of table/browser methods
Most code doesn't require a list specifically, and build a list
is an extra step.
2021-03-29 16:48:33 +10:00
RumovZ
0d8b1c9d0b squash merge browser refactor
Closes #1100
2021-03-29 16:14:54 +10:00
abdo
47e80da1f8 Fix ResourceWarning in openFolder() on Windows
subprocess.Popen emits ResourceWarning in the destructor if the status of the process was not read.
Fix by using subprocess.run() instead, which takes care of that.
Using run() is also recommended for simple cases like this in the docs.
2021-03-29 09:09:20 +03:00
Henrik Giesel
bbea9ac9d7 Remove bootstrap-icons from css folder 2021-03-28 16:14:52 +02:00
Damien Elmes
73430d966f fix 'strip formatting' option being inverted 2021-03-28 19:41:15 +10:00
Damien Elmes
cfac40febc switch NoteType to Notetype
When used as a variable, we were typically calling it a 'notetype', not
a 'note type'.
2021-03-27 22:03:19 +10:00
Damien Elmes
716b474314 add Dict suffix to Dict aliases in models.py 2021-03-27 21:46:49 +10:00
Damien Elmes
9f4a06abee ID -> Id in protobuf and Python
follow-up to dc81a7fed0
2021-03-27 21:38:20 +10:00
Damien Elmes
d6b9cc4d9b drop the legacy enum from rslib, and pass separate module/message idx 2021-03-27 11:56:31 +10:00
Damien Elmes
b57e9be46f allow js to request specific i18n modules
Brings the payload on the congrats page with a non-English language
down from about 150k to 15k
2021-03-26 21:43:36 +10:00
Damien Elmes
3d366d5264 add types to some more Fluent variables 2021-03-26 16:52:54 +10:00
Damien Elmes
8cc6758eb1 declare variables with some common names as int instead of a union 2021-03-26 16:33:53 +10:00
Damien Elmes
5a094e78fa enable type checking of aqt/forms, and fix the new typing issues
Referencing an invalid translation should now break the build
2021-03-26 16:06:02 +10:00
Damien Elmes
3079eaa460 symlink forms/*.py in for the benefit of editor completions 2021-03-26 15:33:30 +10:00