Commit Graph

2512 Commits

Author SHA1 Message Date
Damien Elmes
1e57693b36
Merge pull request #1270 from RumovZ/flag-manager
Add flag manager and hook
2021-07-04 15:45:11 +10:00
Damien Elmes
14110add55 stop (un)escaping media filenames
Back in the WebKit days, images with Unicode filenames would fail to
appear if they weren't percent-escaped. This no longer seems to be the
case - with this patch, images appear correctly on the Mac and Windows
platforms I tested with.

Fixes https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/96
Fixes #1219
2021-07-04 15:27:29 +10:00
hikaru-y
9782d39ced Preload images to be displayed on answer side 2021-07-03 21:33:00 +09:00
Henrik Giesel
5989fb8ef6 Satisfy qt formatter 2021-07-03 01:54:10 +02:00
Henrik Giesel
7f7e5c2702 Execute Ctrl+C/V/X/A through execCommand in editor (so we can customize it) 2021-07-03 01:48:49 +02:00
RumovZ
a5dacf0d0a Add flag manager and hook
'FlagManager' allows cached access to the flag objects, takes care of
renaming flags and notifies GUI components with the hook
'flag_label_did_change'.
2021-07-02 11:16:10 +02:00
Henrik Giesel
24af5bada3 More uniform file naming
kebap-case for .ts, .scss, .html, and directories
2021-07-01 12:24:16 +02:00
Henrik Giesel
8edcc54aae Add flag icons from mdi after all
- This way, we can also use their modifier versions with little pluses/minuses
2021-07-01 01:16:50 +02:00
Henrik Giesel
bcfbd2f680 Remove multiple icons, new notetype/cardtype icons 2021-07-01 01:12:11 +02:00
Henrik Giesel
fe7057b3f2 Remove name_prefix from field sidebar item 2021-06-30 21:02:23 +02:00
Henrik Giesel
0156af268e Add missing type hint 2021-06-30 21:02:23 +02:00
Henrik Giesel
803295341e Replace card state and clock icon 2021-06-30 21:02:23 +02:00
Henrik Giesel
39075039de Replace saved search icon 2021-06-30 21:02:23 +02:00
Henrik Giesel
aacf20531e Add NOTETYPE_FIELD sidebar items 2021-06-30 21:02:23 +02:00
Henrik Giesel
6f201bdfe4 Add notetype icons 2021-06-30 21:02:23 +02:00
Henrik Giesel
da69a5e352 Add new icons for decks 2021-06-30 21:02:23 +02:00
Henrik Giesel
dedddd7f8d Add tag_multiple icon 2021-06-30 21:02:23 +02:00
Damien Elmes
45b790ec3c minor follow-up to #1257
No need for a separate argument, as we only want to scroll when
searching.
2021-06-29 11:53:10 +10:00
Damien Elmes
f8f6b828aa
Merge pull request #1257 from abdnh/sidebar-scroll-to-first-match
Scroll to first sidebar search match
2021-06-29 11:44:28 +10:00
Damien Elmes
ecabf35350 use inner function instead of return value in _expand_where_necessary() 2021-06-29 11:40:59 +10:00
abdo
33e6662dda Scroll to first sidebar search match 2021-06-28 14:44:09 +03:00
RumovZ
19a36414e8 Fix id check for today and card state items 2021-06-28 12:55:59 +02:00
Damien Elmes
8942677c4b
Merge pull request #1252 from RumovZ/fix-tag-expand
Fix expanding/collapsing tags triggering refresh
2021-06-27 18:45:29 +10:00
Damien Elmes
1b15069b24 PEP8 collection.py 2021-06-27 15:12:22 +10:00
Damien Elmes
17533e6a78 PEP8 models.py 2021-06-27 14:30:00 +10:00
Damien Elmes
62c23c6816 PEP8 decks.py 2021-06-27 14:02:48 +10:00
Damien Elmes
2a93355824 PEP8 cards.py 2021-06-27 12:12:23 +10:00
Damien Elmes
fee486aaa1 PEP8 notes.py
An example of how we can start migrating the codebase to PEP8:

- enable invalid-name at the top
- use bazel run pylib:pylint to identify names that need renaming
- use PyCharm or similar to rename the functions/variables
- in the cases where the conversion is not just snake_case, use
.register_deprecated_aliases()

+ removed the __repr__() definition, it dumps all the note content
and obscures the error message
2021-06-26 11:38:59 +10:00
Damien Elmes
0ddd316388 add a helper so we can get semi-automatic camelCase conversion 2021-06-26 11:33:35 +10:00
Damien Elmes
7e358707e5
Merge pull request #1254 from RumovZ/sidebar-menu-hook
Add hook "browser_sidebar_will_show_context_menu"
2021-06-26 08:42:59 +10:00
Damien Elmes
7099b6ea49 revert to % format string to avoid breaking add-on
partially reverts d8c3e71105

https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/50
2021-06-26 08:39:16 +10:00
Damien Elmes
fb5e8d5f3b fix error when user confirms adding cloze to basic type 2021-06-26 08:35:24 +10:00
RumovZ
17009638c1 Add hook "browser_sidebar_will_show_context_menu" 2021-06-25 17:01:17 +02:00
RumovZ
72146c4b22 Fix expanding/collapsing tags triggering refresh 2021-06-24 17:27:53 +02:00
hikaru-y
ac47ef54a2 Set background-color of body to var(--window-bg)
required to emulate day mode in clayout
if background-color is not set in .card styling
2021-06-24 23:47:14 +09:00
hikaru-y
342f75f0f6 Toggle night-mode class of documentElement when action triggered 2021-06-24 23:47:06 +09:00
hikaru-y
4bff3f4854 Set --window-bg of day/night mode to proper colors
including the following changes:
- rename "_getWindowColor" to "get_window_bg_color" to follow PEP8
- add "night_mode" argument to "get_window_bg_color"
- make it possible to get the correct colors regardless of the current theme
2021-06-24 23:46:48 +09:00
hikaru-y
fa0e3540eb Store default palette before "fusion" QStyle is applied
Once a QStyle different from the system default is applied, the system default palette can no longer be retrieved with standardPalette().
2021-06-24 23:46:11 +09:00
Damien Elmes
0e3ada4fcf fix pin toggle causing saved tags to get lost 2021-06-24 20:16:21 +10:00
Damien Elmes
a190697fd7 v3 scheduler: experimental -> beta 2021-06-24 14:46:09 +10:00
Damien Elmes
8e5e277ee4 don't wait for images before revealing
Currently there's a nasty blink when revealing the answer if the answer
has images on it, as the entire card is hidden, and not shown again until
the images have loaded. This patch removes the wait, so text should appear
more quickly, but it will mean the images may pop in.

We still wait for images before scrolling, to avoid a scroll to the wrong
location.

There's plenty of scope to improve this further - preloading images,
rendering MathJax in advance, etc, but those changes will need to wait
for now. #1120 has some related discussion.
2021-06-24 12:22:25 +10:00
Damien Elmes
114eec6585 allow customization of default search text
https://forums.ankiweb.net/t/whats-the-default-search-when-browsing-now-also-how-do-i-choose-to-browse-current-deck/8922
2021-06-24 11:24:30 +10:00
Damien Elmes
d85f978b72 drop crash.log support
I don't recall it ever helping to resolve a bug, and presumably we can
still use it in the future via the PYTHONFAULTHANDLER env var if
necessary.
2021-06-24 10:08:31 +10:00
Henrik Giesel
d5b44654b0 Call update_notetype_legacy after toggling sticky 2021-06-21 15:48:22 +02:00
Damien Elmes
c79f8ba88f in/out -> request/response
The saved characters weren't worth the increased difficulty when
reading, and the fact that we were deviating from protobuf norms.
2021-06-20 15:49:20 +10:00
Damien Elmes
2e53dc63c8
Merge pull request #1230 from RumovZ/fields-check
Check for misplaced or missing clozes when adding and in the editor
2021-06-17 21:26:16 +10:00
Damien Elmes
d0ca61a608 show correct card count when removing multiple templates
https://forums.ankiweb.net/t/error-in-card-type-deletion/10868
2021-06-17 15:51:21 +10:00
Henrik Giesel
3aebae9f13 Allow inclusion of external icons into aqt/forms/icons
+ Replace old tag icon with mdi tag and tag-off icon
2021-06-16 17:19:21 +10:00
Henrik Giesel
c5faf39d7c Make Browser root nodes use "_*" uniformly 2021-06-16 17:19:21 +10:00
Damien Elmes
d120cd7f8a update to latest mypy
mypy's move to external types-* packages is a PITA, as it requires them
to be installed in site-packages, and provides no way to specify a custom
site-packages folder, necessitating extra scripts to mock the
site-packages path, and copy+rename the stub packages into a separate
folder.
2021-06-16 16:04:59 +10:00
RumovZ
0f549d2b82 Merge cloze hint divs into one 2021-06-15 08:43:18 +02:00
RumovZ
5574cb1cfe Make missing cloze a warning again 2021-06-15 08:43:00 +02:00
Thore
066a2e8e1d
Add hook to onDelete in AddonsDialog (#1232)
* add hook

* add me to CONTRIBUTORS

* adjust hook to comments

* Update CONTRIBUTORS
2021-06-15 10:01:29 +10:00
RumovZ
0033d49646 Fix filtered deck from browser
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/14
2021-06-13 08:59:23 +02:00
RumovZ
d8c3e71105 Add editor hints for cloze errors 2021-06-12 17:35:40 +02:00
RumovZ
9acc03773a Check for out-of-place/missing clozes when adding 2021-06-12 10:05:42 +02:00
Damien Elmes
d448bd9cb6 prevent cmd+c in webview with empty selection from crashing on macOS
https://forums.ankiweb.net/t/command-c-on-crashes-anki-2-1-41-on-mac/10684
2021-06-11 19:58:20 +10:00
Damien Elmes
75917f452b
Merge pull request #1224 from kelciour/mpv-playlist-fix
Keep the internal mpv playlist from growing on
2021-06-10 22:28:24 +10:00
Damien Elmes
61e86cc29d new change notetype implementation for the frontend
- changes can now be undone
- the same field can now be mapped to multiple target fields, allowing
fields to be cloned
- the old Qt dialog has been removed
- the old col.models.change() API calls the new code, to avoid
breaking existing consumers. It requires the field map to always
be passed in, but that appears to have been the common case.
- closes #1175
2021-06-10 22:19:24 +10:00
kelciour
c950745ab4 keep the internal mpv playlist from growing on
https://forums.ankiweb.net/t/audio-tracks-get-clipped-at-the-end/10289/5
2021-06-10 11:28:57 +03:00
Damien Elmes
2b8bbda55f when focusing current card, position at top
trying out the changes mentioned on
https://github.com/ankitects/anki/pull/1222#discussion_r648051997
2021-06-09 21:01:29 +10:00
Damien Elmes
c5e56a5fe8 ensure current card centered even if it was already visible
Otherwise if a user reviews a card while keeping Browse open, the
card may not be centered if it was already in view.
2021-06-08 16:22:56 +10:00
Damien Elmes
5bd2dc65ed add card info action to reviewer; move note actions together 2021-06-08 14:23:23 +10:00
Damien Elmes
afaaa763ec don't wait before scrolling to current card
https://github.com/ankitects/anki/pull/1222#discussion_r647017566
2021-06-08 12:54:05 +10:00
Damien Elmes
6878d4ca24 fix preferences screen indiscriminately triggering queue rebuild 2021-06-08 12:11:31 +10:00
Damien Elmes
1479957538 fix note changes triggering a queue rebuild 2021-06-08 12:09:35 +10:00
Damien Elmes
df600c094a
Merge pull request #1222 from RumovZ/browser-card
Change handling of browser's card parameter
2021-06-08 09:32:43 +10:00
Damien Elmes
0c69854b71
Merge pull request #1221 from kelciour/audio-pause-fix
Audio pause fix
2021-06-08 09:23:11 +10:00
RumovZ
8a9c9829e8 Change handling of browser's card parameter
If a search is provided execute it, else search for current deck.
Then try to select and scroll to the provided card.
2021-06-07 16:42:17 +02:00
kelciour
63dc301ef0 use 'cycle' command to toggle pause 2021-06-07 01:54:07 +03:00
kelciour
f1d1301fe6 workaround for audio tracks get clipped at the end 2021-06-07 01:45:59 +03:00
kelciour
c352314ed8 fix audio is paused unusual
closes #1164
2021-06-07 01:09:44 +03:00
Damien Elmes
e3ce9d05c7 add Rescheduled to Today section of sidebar
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/105
2021-06-05 12:55:07 +10:00
Damien Elmes
f5fbad2c20 fix CSV import ignoring selected deck
This is a stop-gap - once the importing code is refactored, we
should pass in the desired deck directly.

https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/102
2021-06-04 20:37:45 +10:00
Damien Elmes
8555a977cb
Merge pull request #1218 from cherryblossom000/help-links
fix documentation links
2021-06-04 15:44:16 +10:00
Damien Elmes
5d477d7e11 another workaround for timeboxing issue 2021-06-04 15:25:30 +10:00
Damien Elmes
cff8069ef9 remove 'flag ' prefix from flag names 2021-06-04 15:03:17 +10:00
cherryblossom
92fe68abfe
fix documentation links 2021-06-03 16:51:03 +10:00
Damien Elmes
6e724ea480 make sure install.sh is run from the correct folder
https://forums.ankiweb.net/t/upgrade-doesnt-work-free-disk-space-is-written-full/10500/2
2021-06-03 10:50:32 +10:00
Damien Elmes
be9bbf2157 catch all recording errors; mention permission
https://forums.ankiweb.net/t/i-have-an-error-when-i-try-to-record-of-audio/10483
2021-06-02 12:20:40 +10:00
Damien Elmes
578b1b0552
Merge pull request #1213 from RumovZ/new-flags
Add pink, turquoise and purple flags
2021-06-02 11:22:26 +10:00
Damien Elmes
0f5627bb7a limit custom study to 100 tags
The hard limit from sqlite may be larger, but things slow down as more
tags are selected.

https://forums.ankiweb.net/t/unable-to-create-custom-test/10467

There are a number of things that could be improved here:

- we should show a live count so users are aware of the limit
- we should be filling in the parent tags when they're not explicitly
listed on a card
- we should reconsider disabling the 'tags to include' by default

It may make sense to defer these changes until we can move this screen
into Svelte/handle the processing in the backend.
2021-06-02 11:15:39 +10:00
Damien Elmes
6e992752ca prevent error storm when browser table encounters panic 2021-06-02 11:15:39 +10:00
Damien Elmes
a53c130177 close Anki after a panic occurs
Once the mutex has been poisoned the app is unusable, and users were
struggling to close it. This also ensures we'll receive the original
error report, instead of the follow-up poison errors that don't tell us
what caused the issue.

https://forums.ankiweb.net/t/error-message-keeps-popping-up/10494
2021-06-02 11:15:39 +10:00
RumovZ
daa696e703 Tweak flag colors 2021-06-01 18:14:54 +02:00
RumovZ
5e7a47fdc7 Rename violet to pink 2021-06-01 18:14:43 +02:00
Damien Elmes
70d20dfbec
Merge pull request #1209 from RumovZ/drop-saved-search
Drag & drop for saved search
2021-06-01 17:50:55 +10:00
Damien Elmes
479e19844b fix incorrect platform specifier
It should have been isLin, but we don't even need to check it -
the env var alone should suffice.
2021-06-01 17:41:15 +10:00
Damien Elmes
b9f8cdb8bc try to fall back to xcb if wayland forced on packaged build
https://forums.ankiweb.net/t/anki-doesnt-start-under-wayland-linux/10409/5
2021-06-01 17:38:35 +10:00
Damien Elmes
595e23189b handle ctrl+numpad enter on Windows
https://forums.ankiweb.net/t/ctrl-enter-with-the-number-pad-doesnt-work/10323/5
2021-06-01 16:25:12 +10:00
Damien Elmes
e124f935a5 fix timebox causing crash
When a modal was created with another window as its parent, the other
window was being returned, when it was the current window that we
actually wanted. This caused nextCard() to be called again when it
presented the timebox modal, leading to a stack overflow.

https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/71
2021-06-01 15:35:18 +10:00
Damien Elmes
688f22b4c8 require reposition to start at 0; cap maximum
https://forums.ankiweb.net/t/unable-to-reposition-cards-to-negative-start-position/10370/2
2021-06-01 10:09:24 +10:00
RumovZ
c97c6c6e98 Add violet, turquoise and purple flags 2021-05-31 12:03:30 +02:00
Damien Elmes
29c4869aef remove deck protobuf from frontend
Like the previous change, avoid exposing the protobuf as a public API
for now. It requires more thought, and is probably better done with
either extra helper accessors like decks.name(), or via a native class.
2021-05-31 16:31:06 +10:00
RumovZ
c85ae24347 Make a new item the current item after refresh 2021-05-30 10:46:59 +02:00
RumovZ
985ce2466b Skip saving search if it already exists 2021-05-30 10:11:40 +02:00
RumovZ
37fec02f88 Enable drop to create saved search 2021-05-30 09:30:22 +02:00
Damien Elmes
a894c720de
Merge pull request #1206 from RumovZ/fix-sidebar
Fix some sidebar issues
2021-05-29 10:33:52 +10:00
Damien Elmes
93459cc48f
Merge pull request #1200 from RumovZ/template-checks
Template checks
2021-05-29 10:28:06 +10:00
RumovZ
24b4f15038 Fix renaming of unused tag
Unused tags can't be renamed, but since the CollectionOp returns success
in any case, the provisionally renamed sidebar item needs to be reset.
2021-05-28 19:18:21 +02:00
RumovZ
2597038fe5 Prevent sidebar toolbar from folding
If there is little space, Qt replaces some tools of the toolbar with an
expandable menu indicated by an arrow. But this arrow is invisible in
night mode.
2021-05-28 18:09:44 +02:00
RumovZ
af50db9fd3 Fix restoring current sidebar element for cards 2021-05-28 17:46:46 +02:00
Damien Elmes
7caaf0c735 remove sticky setting from fields dialog
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/60
2021-05-28 18:33:29 +10:00
Damien Elmes
a02890a84b make update all toggle clearer
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/59

+ remove background color; it did not look good in dark mode
2021-05-28 18:33:28 +10:00
Damien Elmes
aa7d2721c9 avoid bumping mtime when nothing has changed
+ update sync indicator after every op
+ skip mtime bump on undo/redo
2021-05-28 11:09:16 +10:00
RumovZ
935fbb6289 Use implicit failure handling and self as parent 2021-05-27 16:51:03 +02:00
Damien Elmes
6cc713cbe8 add v3 scheduler to prefs screen 2021-05-27 23:09:49 +10:00
Damien Elmes
4e95cac5c8 remove 'update later' button 2021-05-27 22:42:21 +10:00
Damien Elmes
83a1d99e22 fix remembered tags not being applied to next added note
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/56
2021-05-27 13:18:34 +10:00
Damien Elmes
f26c7ed99e ask user to confirm which deck they want when opening options in reviewer
Also fixes https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/57
2021-05-27 13:15:28 +10:00
Damien Elmes
7c5e974ae5 hook up some missing translations in deck options screen 2021-05-26 14:41:18 +10:00
Damien Elmes
57ec4cc7b5 change get_queued_cards() to no longer return congrats info 2021-05-26 12:59:45 +10:00
Damien Elmes
0026506543 update ts deps
- prettier's formatting has changed, so files needed to be reformatted
- dart is spitting out deprecation warnings like:

254 │   2: $spacer / 2,
    │      ^^^^^^^^^^^
    ╵
    bazel-out/darwin-fastbuild/bin/ts/sass/bootstrap/_variables.scss 254:6  @import
    ts/sass/button_mixins.scss 2:9                                          @use
    ts/components/ColorPicker.svelte 2:5                                    root stylesheet

DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($grid-gutter-width, 2)
2021-05-26 09:37:40 +10:00
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