Commit graph

9828 commits

Author SHA1 Message Date
Yoshi
5037968470 Facilitate hook updating/replacement (#2213)
* Facilitate updating of hooks

- Add instructions in contributing.md
- Change addon_config_editor_will_update_json hook to work with the new
  hookslib code

* Fix typo in docs

* Always run replaced hook

* Use lowercase list for typing

* Forbid defining both a replaced and a legacy hook
2022-12-07 15:39:57 +10:00
Matthias Metelka
a480a1c91f Persist field states with SessionOptions object (#2241)
* Persist collapsed- and field states with SessionOptions object

* Format types.ts

* Replace format function with f-string

* Give setters more descriptive parameter names

* Do not use default prefix for descriptions and fonts

since they are not meant to be changed via Svelte.
2022-12-07 15:37:46 +10:00
Matthias Metelka
6565939db6 Improve Select component and add it back to Change Notetype screen (#2239)
* Do not include oldIdx in Select change event

I included it due to confusion about the variable names in the Change Notetype components.

* Remove redundant on:change listener from NotetypeSelector

* Use Select component in Change Notetype MapperRow (again)

* Remove redundant --cols and --col-size definitions

Bootstrap divides rows into columns of equal width by default.

* Add highlight to active DropdownItem

* Remove bootstrap dropdown item styling

* Fix JS error on dropdown accept action

cause: When closing the dropdown, buttonRef was removed before the callback in setTimeout was run.
2022-12-07 15:31:37 +10:00
Damien Elmes
45387f708c Switch back to winrt to see if it fixes slow TTS
https://forums.ankiweb.net/t/slow-tts-and-duplicated-voices/25157/7

winrt blocks an upgrade from Python 3.9, so this will be a temporary
solution at best.
2022-12-06 20:30:54 +10:00
Abdo
baae784583 Fix Esc not closing TS pages (#2240) 2022-12-06 20:03:34 +10:00
Damien Elmes
ed77c9d4fa Revert to setFormat() to fix color setting
The surrounder code is somewhat complicated, and it could do with either
more documentation, or a simplification.

Closes #2121
2022-12-05 17:00:47 +10:00
Abdo
7beffe3529 Close MathJax editor when Esc is pressed (#2237) 2022-12-05 15:08:38 +10:00
Damien Elmes
a34a7c72b7 Fix the wrong notetype being selected by default
Regressed in #2082

https://forums.ankiweb.net/t/anki-2-1-55-beta-7/25130/7
2022-12-05 15:08:00 +10:00
Damien Elmes
af44926fb6 Tweak graph margins again
76901b7436 (commitcomment-91940936)
2022-12-04 21:50:58 +10:00
Damien Elmes
133300bb7c Avoid hiding webview when refreshing
When opening the graphs screen in dark mode, we want to load the
page first and then reveal the webview, to prevent a flash of white
that can appear as the page loads. Previously we did this for any
call to load_ts_page(), but this results in flicker when refreshing
an existing webview, such as the move from deck list to congrats screen.
In those cases, at least on the machines I have to test with here, the
refresh is smoother without the hide and show step.

The new window case is still not ideal - while the hide+show prevents a
flash of white, there is a flash of black instead, presumably as the
webview draws the initially-blank framebuffer with the contents of the
webview.
2022-12-04 21:17:57 +10:00
Damien Elmes
fcdd7dc23d Exempt MathJax images from image shrinking
https://forums.ankiweb.net/t/anki-2-1-55-beta-mathjax-preview/23529/18
2022-12-04 20:03:27 +10:00
Damien Elmes
76901b7436 Fix graphs not taking up full width 2022-12-04 19:48:18 +10:00
Damien Elmes
757f55cb6d Collapse margins on narrow screens 2022-12-04 19:47:03 +10:00
Damien Elmes
73009377af Fix pie chart disappearing in 2/3 column graph modes 2022-12-04 19:24:37 +10:00
Damien Elmes
01af958336 Bump Mathjax version 2022-12-04 18:01:26 +10:00
Damien Elmes
89ffab5795 Fix deck options sticky hiding itself 2022-12-04 15:07:48 +10:00
Damien Elmes
0ae9ad2053 Make the NoData overlay match the normal background color 2022-12-04 14:49:04 +10:00
Damien Elmes
5448319bb0 Allow unit tests to pass even when Qt translations overridden 2022-12-04 14:25:54 +10:00
Damien Elmes
c2bc714bac Add some left/right margins to congrats page 2022-12-04 13:58:50 +10:00
Damien Elmes
db9625532b Update translations 2022-12-04 13:38:38 +10:00
Damien Elmes
abca04aecf Rework spinner buttons (#2230)
* Align spinner buttons on right

The initial rationale for splitting them up was to be more touch friendly,
but we won't be able to use them on mobile anyway due to the conflicts
with double taps zooming in. On desktop, having them apart requires more
mouse movement when overshooting, so it's better to have them in one
place.

Text is now left-aligned again, which matches our other inputs like
learning steps.

The left/right buttons have been changed to up/down, which matches our
Qt spinners, and avoids RTL concerns.

This commit also removes the border on hover/select - it caused the
left-aligned content to flicker, and didn't look correct. Perhaps we could
add it back in a better way in the future.

* Hide spinner buttons on mobile devices

Tapping on them conflicts with the page zoom gesture.

* Remove min-height on spinner buttons

* Only show spinner on hover

Since they're only useful with a mouse, and only useful when they're
under the cursor, hiding them when focused keeps things less cluttered.
2022-12-04 13:18:49 +10:00
Matthias Metelka
7f6b57c1df Add profile manager setting to force custom qt stylesheets (#2233) 2022-12-04 12:54:39 +10:00
Matthias Metelka
c34f754526 Make button color and hover gradient fit together (#2232)
* Fix QMenu item not having different color on hover

due to the color changes in #2220.

* Remove strong border on pressed Qt widgets

* Make button gradient more subtle

by changing gradient-start on hover instead of gradient-end.

* Apply QPushButton style to QSpinBox buttons

* Improve margin of QComboBox arrow

* Make button-bg same color as button-gradient-end

This makes the hover gradient more subtle.
2022-12-04 11:48:09 +10:00
Matthias Metelka
ea7faac1a3 Decrease block padding for deck browser rows (#2231) 2022-12-04 11:45:59 +10:00
Damien Elmes
8b1e3bf6f2 Partially revert #2215
This fixes the issues mentioned on 
https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/78

I can't seem to reproduce the extra tag being added when auto-completing
anymore, but perhaps I'm just not getting the steps right.
2022-12-04 11:37:16 +10:00
Damien Elmes
aebf9652a7 Add env var to enable sourcemaps
They slow down the build, so are not on by default.
2022-12-04 11:37:16 +10:00
Damien Elmes
805d997a69 Skip minify in debug builds 2022-12-04 10:05:16 +10:00
Damien Elmes
8e83ed45e9 Ensure certifi refresh repeats 2022-12-03 23:31:08 +10:00
Damien Elmes
9b056bb55c Revert "Probable workaround for mpv failing after a few days on macOS"
This reverts commit 30d9b819f9.

Issue turned out to be a packaging problem, and this should not be
required as the socket should be held open even if removed.
2022-12-03 23:30:19 +10:00
Damien Elmes
de0b24f745 Fix mpv being placed in incorrect bundle location on macOS 2022-12-03 23:29:26 +10:00
Damien Elmes
819d16e9b6 Revert "Reset zoom on page transition"
This reverts commit e2dcc49284.

There have been a number of people complaining that the current
behaviour is not intuitive, and they have a point - it's not the
way browsers behave when you navigate between pages.
2022-12-03 23:14:45 +10:00
Damien Elmes
5b3abe537a Revert to old select in change notetype screen for now
Fixes https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/25,
introduced in #2082
2022-12-03 23:04:08 +10:00
Damien Elmes
04ba7e5569 Fix typed text not being saved if saving immediately
https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/43
2022-12-03 22:41:17 +10:00
Damien Elmes
85fc60843e Fix alternate table row color on macOS
https://forums.ankiweb.net/t/anki-2-1-55-beta-3/24295/102
2022-12-03 22:21:22 +10:00
Damien Elmes
30d9b819f9 Probable workaround for mpv failing after a few days on macOS
Also fix the certifi bumper: it was supposed to repeat
2022-12-03 22:11:39 +10:00
Damien Elmes
d633a7b926 Fix formatting inside selection not being removed
Regression introduced in #2017 while fixing another bug.

Closes #2072
2022-12-03 21:41:54 +10:00
Damien Elmes
296ba2fe32 Try to address crashes on shutdown
I was able to reproduce the crashes fairly reliably by opening the
prefs screen on startup and shutting down the app after 600ms; after
this change the crashes no longer seem to occur.
2022-12-03 19:33:51 +10:00
Damien Elmes
8e5f2eb137 Stop removing build file
Since we reconfigure automatically, this should no longer be necessary.
2022-12-03 19:32:07 +10:00
RumovZ
530e28ac91 Cap calculated hard delay secs at again delay + 1d (#2229) 2022-12-03 18:54:40 +10:00
Damien Elmes
e9719e03d2 Automatically regenerate build.ninja and re-run when build fails quickly 2022-12-01 19:40:49 +10:00
Matthias Metelka
d034a84a64 Refactor Select component | Fix CSV import issue (#2227)
* Refactor Select component and implement/update it in various screens

* Remove redundant select CSS

* Tweak DeckOptionsPage

* Fix CSV import layout

* Fix save button margin in change notetype screen

* Fix sticky header positioning

* Remove unused imports

* Make StickyHeader sticky instead of fixed
2022-12-01 19:24:26 +10:00
Matthias Metelka
a8a1bbd710 Use third grid column in graphs layout on wide screens (#2226)
* Use third grid column on graphs page when width > 1400px

* Define column width more precisely

* Center graphs inside containers

* Fix graphs always showing 2+ columns (dae)
2022-12-01 16:33:52 +10:00
Matthias Metelka
da85477375 Tweak scrollbar colors for better visibility in dark theme (#2225) 2022-12-01 16:15:17 +10:00
Matthias Metelka
9aee451ae5 Fix glitchy animation of floating elements (#2224)
* Set max-height of 400px to scrollable Popover

* Pass computed placement to user components

to set different animation directions when the placement changes.

* Move elevation effect from WithFloating/WithOverlay to Popover

* Apply same changes as in WithFloating to WithOverlay

* Adjust FloatingArrow CSS to Popover

* Run eslint and formatter
2022-12-01 15:45:52 +10:00
Matthias Metelka
a112c9d9b7 Refactor SpinBox component (#2223)
this fixes the increment button not showing.
2022-12-01 15:34:54 +10:00
Damien Elmes
1bb6afb394 Avoid setting RTL on first run
I'm not sure why, but this seems to address the first issue mentioned on
https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/58
2022-11-30 19:19:22 +10:00
Damien Elmes
5311210849 Fix cargo-deny exclusion 2022-11-30 13:52:49 +10:00
Damien Elmes
5168eed79a Enable cargo-deny in CI
We have quite a few duplicate crate deps at the moment, so those warnings
are currently disabled.
2022-11-30 13:20:50 +10:00
Damien Elmes
bb65daf8fd Update incompatible crates 2022-11-30 12:38:10 +10:00
Damien Elmes
9cf6a1f2d7 Pin chrono; update compatible Rust crates
Also pin reqwest in our other crates
2022-11-30 12:38:10 +10:00