Commit graph

9701 commits

Author SHA1 Message Date
Damien Elmes
532f0d89f7 If a backup fails before close, ensure collection closed
Otherwise when user returns to profiles screen, they'll be unable to
open a different profile, as the collection is still open.

Encountered when opening the collection that triggered
https://github.com/ankitects/anki/issues/2123
2022-10-29 11:08:58 +10:00
Matthias Metelka
d2ee52edc9 Add comments to Sass variables and tweak main window (#2137)
* Prevent multiple inclusion of variables in CSS files

* Use dict instead of tuple for variables

* Add comments to variables

* Improve appearance of main window

* Tweak main window styles

* Use json.dumps over pprint.format

* Make study button primary

* Improve header margin

* Make bottom toolbar slimmer

* Make congrats page more balanced

* Fix type issue

* Replace day/night with light/dark

* Exclude top-level-drag-row from hover effect

* Create dataclass for variables

* Run formatter

* Apply CSS variables from Python side

Why go full-circle with the Sass variables? This way we only need one interface for add-on authors to interact with. It also makes it easier for us to apply additional themes in the future.

* Fix typing

* Fix rgba values in Qt

* Darken button background

* Fix palette not being applied in light theme

For some odd reason this problem arose much later than #2016.

* Tweak default button look

* Reformat

* Apply CSS vars to ts pages

* Include elevation in button_mixins_lib

* Cast opacity to int

* Add some margin to studiedToday info

* Tweak light theme button gradient

* Tweak highlight-bg for light theme

* Add back default button color

as it made the browser sidebar tool icons dark in light theme.

* Reformat

* Tweak light theme buttons once more

Sorry for the back-and-forth. Sass only compiles when there are changes in user files, not when I only change the vars.

* Fix bottom toolbar button indicators

* Make buttons more clicky

* Fix button padding

* Handle macOS separately again

* Decrease elevation effect for main window buttons to 1

* Imitate box-shadow for Qt elements

* Adjust shadow vars

* Adjust primary border color

because the save button in the deck options had a lighter color than its background gradient.

* Boost box-shadow color of primary buttons

* Format

* Adjust Qt box-shadow imitation and shadow colors

* Use more subtle default shadow color

* Add some more padding to top toolbar

* Revert "Apply CSS vars to ts pages"

This reverts commit 5d8e7f6b7f.

* Revert "Apply CSS variables from Python side"

This reverts commit 87db774412.

* Better match the standard macOS buttons

In the dark theme the standard color is a lighter grey, but at least
the size/shape is similar again.

This doesn't work for the editor buttons.

* Reduce the top margin of the congrats screen

* Fix illegible buttons when changing theme on macOS; match dark button style
2022-10-29 10:48:53 +10:00
Abdo
2499e44cae Fix issue when dragged deck is a prefix of target (#2149) 2022-10-29 09:42:34 +10:00
Abdo
0a586b2a04 Fix grandchild tag not being reparentable under the same root (#2148)
Introduced in #2146
2022-10-29 09:39:44 +10:00
Abdo
1b84707f64 Fix command to run Rust tests in docs (#2147) 2022-10-28 21:42:32 +10:00
Abdo
798debe1f1 Fix some issues with tag reparenting (#2146)
* Fix reparented_name not correctly handling tags that are prefixes of the
new parent

To reproduce the issue:
1. Add two tags: `a` and `ab`.
2. From the browser's sidebar, drag & drop `a` into `ab`.

Result: panic

* Fix reparent_tags panicking if new parent is a child of source tag

This is the "foo, foo::bar" case that should be a no-op.

* Add more tests for tag reparenting
2022-10-28 21:42:10 +10:00
Abdo
535ece296a Add aqt.operations helper for col.update_notes() (#2145) 2022-10-28 20:52:04 +10:00
Matthias Metelka
8b3739c5a2 Finish #2070: Single overlay instead of per field (#2144)
* Move up MathjaxOverlay to be initialized only once

* Move ImageOverlay to NoteEditor root

* Move Symbols Overlay to NoteEditor root

* Refactor image overlay to not require second mutation observer

* Use elevation + overflow:hidden  in Editorfield

* Make it possible to show input next to each other again

* Set handle background color to code bg

* Make Collapsible unmount the component

* Simplify how decorated elements are mounted

* Set RichTextInput background to frame-bg again

* Strip out FocusTrap code

* Revert "Make Collapsible unmount the component"

This reverts commit 52722065ea.

* Allow clicking on label container to unfocus field

* Fix mathjax overlay resetting too its api too soon

* Allow scrolling on overlays

* Set focus-border border-color in focused field

* Fix background color of fields

* Add back grid-gap

removed it during merge to see if margin-top would behave any differently - which is not the case.

* Fix double border issue within Collapsible.svelte

* Format

* Edit appearance of focused fields a bit

* Remove unused properties

* Include elevation in button_mixins_lib

* Give label-container a background color

Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
2022-10-27 09:11:36 +10:00
Damien Elmes
8b419a09b4 Update translations 2022-10-27 08:24:58 +10:00
Damien Elmes
c8bc80e293 Minor wording tweaks to help.ftl; remove an unused entry 2022-10-27 08:24:38 +10:00
Damien Elmes
7d75a151a3 Fix indent/outdent shortcuts not working
https://forums.ankiweb.net/t/keyboard-shortcut-for-indent-not-working/24114/6
2022-10-26 12:38:13 +10:00
Matthias Metelka
932498aa29 Use badge to link manual chapter (#2143) 2022-10-26 11:32:18 +10:00
Matthias Metelka
96c3dd7a1b Redesign deck options screen, swap tooltips for help modals (#2139)
* Redesign deck config, swap tooltips for help modals, link to manual

* Replace canvas-inset with canvas-code for custom scheduling

* Make section header link to manual too

* Include elevation Sass library

* Remove two unused exports

* Fix tabbed spinboxes

* Update ftl/core/deck-config.ftl

* Update ftl/core/deck-config.ftl

* Fix format

* Make border-radius and box-shadow more subtle

* Fix margin for vertical aspect ratio

* Make direct hover on info badge apply effect instantly

* Add redirect line to manual underneath chapter
2022-10-25 16:18:50 +10:00
Matthias Metelka
bd4bb83f50 Center add-on icons and allow text buttons to expand in width (#2138)
* Fix text buttons not expanding in width

* Adjust icon and font size of add-on buttons
2022-10-24 13:51:04 +10:00
Damien Elmes
7eb8b65f99 With the new duplicate appearance, excluding the bg color becomes viable
https://forums.ankiweb.net/t/incorrect-text-formatting-copied/24060
2022-10-24 09:26:02 +10:00
Damien Elmes
f459c7f4bc Protobuf now ships with a macOS arm64 wheel 2022-10-21 21:13:28 +10:00
Damien Elmes
e0b7096462 Update translations 2022-10-21 20:50:53 +10:00
Damien Elmes
a88d8e2c1b Update protoc for new Python codegen
Pylint is no longer able to detect available members in the generated
protobuf files, so we need to exclude them from processing. This should
not be a problem as we get these checks from mypy already, and as a
bonus we no longer need to exclude protobuf classes manually.

The fact that anki.sync_pb2 needs to be added after the wildcard appears
to be a bug.
2022-10-21 20:23:31 +10:00
RumovZ
5db6318465 Refactor error handling (#2136)
* Add crate snafu

* Replace all inline structs in AnkiError

* Derive Snafu on AnkiError

* Use snafu for card type errors

* Use snafu whatever error for InvalidInput

* Use snafu for NotFoundError and improve message

* Use snafu for FileIoError to attach context

Remove IoError.
Add some context-attaching helpers to replace code returning bare
io::Errors.

* Add more context-attaching io helpers

* Add message, context and backtrace to new snafus

* Utilize error context and backtrace on frontend

* Rename LocalizedError -> BackendError.
* Remove DocumentedError.
* Have all backend exceptions inherit BackendError.

* Rename localized(_description) -> message

* Remove accidentally committed experimental trait

* invalid_input_context -> ok_or_invalid

* ensure_valid_input! -> require!

* Always return `Err` from `invalid_input!`

Instead of a Result to unwrap, the macro accepts a source error now.

* new_tempfile_in_parent -> new_tempfile_in_parent_of

* ok_or_not_found -> or_not_found

* ok_or_invalid -> or_invalid

* Add crate convert_case

* Use unqualified lowercase type name

* Remove uses of snafu::ensure

* Allow public construction of InvalidInputErrors (dae)

Needed to port the AnkiDroid changes.

* Make into_protobuf() public (dae)

Also required for AnkiDroid. Not sure why it worked previously - possible
bug in older Rust version?
2022-10-21 18:02:12 +10:00
RumovZ
edb615c4f1 Explicitly evaluate symlink on Windows (#2135) 2022-10-19 20:08:58 +10:00
Damien Elmes
16fd0a4c80 Use protoc from Bazel if missing from path
Closes #2134
2022-10-17 09:58:51 +10:00
Damien Elmes
f794a7fb78 Add Christos to about 2022-10-15 10:58:43 +10:00
Hikaru Y
6b2e161740 Fix maximized browser window not being restored (#2132) 2022-10-14 10:19:20 +10:00
Matthias Metelka
e4c7329afb Make resizer snap to closest end and improve toggle (#2129)
* Make resizer snap to closest end and improve toggle

* Snap on window resize

* Remove event parameter

* Remove nested ternary expression
2022-10-13 10:13:19 +10:00
Matthias Metelka
4cc50d76f7 Add background to tag editor and improve autocomplete items (#2130) 2022-10-13 10:08:30 +10:00
Damien Elmes
39b021f54e Switch back to clearing MathJax preview on blur
This means two clicks are required again, but that's the lesser of two
evils:

https://forums.ankiweb.net/t/anki-2-1-55-beta-mathjax-preview/23529/8

Better fixes welcome :-)
2022-10-12 14:56:38 +10:00
Damien Elmes
0571449969 Update translations 2022-10-12 14:48:26 +10:00
Matthias Metelka
cc8b09f433 Move MathJax toggle to OptionsButton and fix two bugs (#2126)
* Rename MathJax toggle and move it to OptionsButton

* Apply MathJax setting to newly added blocks

* Actually remove MathJax element on delete
2022-10-12 14:34:25 +10:00
Matthias Metelka
b086dcb026 Fix SpinBox initially neglecting passed value (#2125) 2022-10-12 14:31:54 +10:00
Matthias Metelka
47523925e7 Add stylesheet for QMenu (#2122)
* Give QMenu cursor: pointer

* Darken border colors in dark theme

* Refactor cursor: pointer event filter

* Add QMenu stylesheet

* Remove min-width for QMenu item

* Add QMenuBar styles

with increased height for touchscreen users and more visible highlight color.

* Fix type

* Revert "Add QMenuBar styles"

This reverts commit 6ae405a073.

* Remove strong border from QMenu checkbox style

* Keep highlight color consistent

* Adjust highlight-bg

* Increase horizontal padding and adjust checkbox margin

* Introduce border-faint var and make default border brighter in dark mode

* Fix 1px move on hover and make highlight color more subtle

* Remove win10 styles

because the properties are set in the other stylesheets anyway.

* Fix bottom border of QMenuBar not showing underneath entries

* Remove unused import

* Make border-faint one shade darker in light theme
2022-10-12 14:29:06 +10:00
Matthias Metelka
eefefa98bb Experiment with labelled note view switch (#2117)
* Swap initial letter for full label on switch.py

* Tweak note/card accent colors

* Decrease knob radius by 1px

* Make label font smaller, but bold
2022-10-10 18:36:11 +10:00
Matthias Metelka
4a51c4e605 Fix QToolTip styling issue on Windows (#2120)
* Fix QToolTip styling issue on Windows

* Remove QToolTip styling entirely
2022-10-10 18:32:45 +10:00
Matthias Metelka
7d84827e4a Darken border colors in dark theme (#2119) 2022-10-10 14:02:15 +10:00
Matthias Metelka
f3e3dacf73 Increase vertical padding on bottom toolbar buttons (#2118) 2022-10-10 13:54:22 +10:00
Matthias Metelka
35368a1707 Set floating shift value to fit area occupied by box-shadow (#2116)
* Set floating shift value to fit area occupied by box-shadow

* Disable shift on Select dropdown
2022-10-10 13:53:13 +10:00
Matthias Metelka
74fc0d90fa Add min-width to QPushButton stylesheet (#2115)
to improve look on windows systems
2022-10-10 13:50:24 +10:00
Matthias Metelka
1098771f9f Make Qt stylesheets fully responsive to RTL (#2114)
* Make Qt stylesheets fully responsive to RTL

* Fix typing
2022-10-10 13:29:09 +10:00
BlueGreenMagick
6afe42c92d fix --frame-bg renamed to --canvas-elevated (#2107) 2022-10-10 13:15:07 +10:00
Damien Elmes
8dc37e92f2 Update to latest rules_rust
Closes #2100
2022-10-10 13:07:11 +10:00
Damien Elmes
cef47965fc Update macOS bundle to Qt 6.4.0
This bumps the minimum OS version to 10.14
2022-10-10 12:56:47 +10:00
Damien Elmes
9bcb6cf6b2 Update to Qt 6.4.0 2022-10-10 12:29:02 +10:00
Abdo
f32148416b Use showText to show add-on import errors (#2103)
* Use showText to show add-on import errors

Long error messages can be completely unreadable as QMessageBox doesn't
show a scrollbar and the text can't be selected and copied by default (on Windows at least).

* HTML-escape error
2022-10-06 18:15:56 +10:00
Matthias Metelka
bd2a7c93e0 Fix selected tags not being highlighted (#2104)
* Give selected AutocompleteItem primary button style

* Fix formatting
2022-10-03 13:25:55 +10:00
Matthias Metelka
cf31dc36ce Fix duplicate highlight and improve aesthetic (#2102) 2022-10-03 13:16:54 +10:00
Matthias Metelka
7376b238ed Make auto-closing of HTML tags default but optional (#2101) 2022-10-03 13:14:57 +10:00
Hikaru Y
8546facdd0 Fix scrolling with keys / keyboard event listeners not working on answer side (#2099)
* Revert "Fix reviewer shortcuts being inaccessible due to IME"

This reverts commit b1208aad15.

* Work around WebEngine/IME bug in Qt6
2022-10-03 12:53:09 +10:00
Aristotelis
8c4c18c0e5 Add API shim for webview.get_window_bg_color (#2095)
* Maintain shim for webview.get_window_bg_color

Used by the AMBOSS add-on

* Fix deprecation message
2022-10-03 12:50:22 +10:00
Damien Elmes
c2f32eed04 Update d3 deps for CWE 2022-09-30 14:22:23 +10:00
Damien Elmes
8c89a7fc44 Fix type answer warning making text bold 2022-09-30 14:08:03 +10:00
Damien Elmes
b781123d41 Fix font size not being removed when pasting between fields 2022-09-30 14:05:03 +10:00