Commit graph

8965 commits

Author SHA1 Message Date
RumovZ
5c64aadb7a Garbage collect unused Fluent strings (#1482)
* Canonify import of i18n module

Should always be imported as `tr`, or `tr2` if there is a name collision
(Svelte).

* Add helper for garbage collecting ftl strings

Also add a serializer for ftl asts.

* Add helper for filter-mapping `DirEntry`s

* Fix `i18n_helpers/BUILD.bazel`

* run cargo-raze

* Refactor `garbage_collection.rs`

- Improve helper for file iterating
- Remove unused terms as well
- Fix issue with checking for nested messages by switching to a regex-
based approach (which runs before deleting)
- Some more refactorings and lint fixes

* Fix lints in `serialize.rs`

* Write json pretty and sorted

* Update `serialize.rs` and fix header

* Fix doc and remove `dbg!`

* Add binaries for ftl garbage collection

Also relax type constraints and strip debug tests.

* add rust_binary targets for i18n helpers (dae)

* add scripts to update desktop usage/garbage collect (dae)

Since we've already diverged from 2.1.49, we won't gain anything
from generating a stable json just yet. But once 2.1.50 is released,
we should run 'ftl/update-desktop-usage.sh stable'.

* add keys from AnkiMobile (dae)

* Mention caveats in `remove-unused.sh`
2021-11-12 18:19:01 +10:00
Damien Elmes
6220bdc33c fix card info layout & test code
Closes #1479

Related: #1470
2021-11-12 16:24:08 +10:00
Damien Elmes
ac23757e82 update translations 2021-11-12 15:02:17 +10:00
Damien Elmes
0637f3190b another external workspace fix for sass 2021-11-12 15:02:17 +10:00
Abdo
212344bad8 Fix incorrect card count in timebox after undo (#1485)
* Fix incorrect card count in timebox after undo

Can happen after undoing reviews done in a previous study session.

* Fix lints
2021-11-12 12:29:48 +10:00
Damien Elmes
2fc7dec0a0 update bug report template 2021-11-12 12:20:02 +10:00
Damien Elmes
8f6b6d13e9 update issue template 2021-11-12 12:17:02 +10:00
Damien Elmes
10e902150e when a post handler fails, log the traceback to the console
https://forums.ankiweb.net/t/cant-change-note-type/14809
2021-11-12 11:54:13 +10:00
Henrik Giesel
dccd86c346 Save and restore location on ContentEditable (#1481)
* Add utility functions for saving and restoring the caret location

* Implement cross-browser.getSelection

* Save and restore location on ContentEditable

* Fix refocus by clicking on a field that had a non-collapsed selection
2021-11-09 12:53:39 +10:00
Damien Elmes
a96fcc8c85 Python 3.10 not usable on Windows
No winrt wheel is available yet

https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703
2021-11-08 19:23:00 +10:00
Damien Elmes
594f957bbb add a builder for Collection 2021-11-06 14:43:41 +10:00
RumovZ
388849a3ef Rework v3 fuzzing (#1474)
* Remove flooring in v3 scheduler code

It is no longer supposed to be an exact port of the old Python code.

* Rework v3 fuzzing

https://github.com/ankitects/anki/issues/1416#issuecomment-958208149

* Ensure length of fuzz range is larger than 1

Only for new intervals larger than 1 and respecting max review interval.

* add the beginnings of a unit test

* Clarify `fuzz_factor` doc string

* Fix Python tests for 2021 scheduler

* Fix fuzz test

1.0 is not a valid fuzz factor.

* Add tests for fuzzing in Rust

* Use range notation in fuzz factor doc

* Strip redundant tests
2021-11-06 10:39:24 +10:00
Damien Elmes
3d9e52a635 fix profile with older keys being reported as corrupt
Older Anki versions like 2.1.35 used sip 5.2, which appears to
(presumably incorrectly) serialize QByteArrays as Unicode:

    0: (    MARK
    1: d        DICT       (MARK at 0)
    2: p    PUT        0
    5: V    UNICODE    'mainWindowGeom'
   21: p    PUT        1
   24: c    GLOBAL     'sip _unpickle_type'
   44: p    PUT        2
   47: (    MARK
   48: V        UNICODE    'PyQt5.QtCore'
   62: p        PUT        3
   65: V        UNICODE    'QByteArray'
   77: p        PUT        4
   80: (        MARK
   81: c            GLOBAL     '_codecs encode'
   97: p            PUT        5
  100: (            MARK
  101: V                UNICODE    "[...]"
  354: p                PUT        6
  357: V                UNICODE    'latin1'
  365: p                PUT        7
  368: t                TUPLE      (MARK at 100)

Our unpickle_type() was incorrectly ignoring any non-PyQt class when
unpickling, so it was choking on the reference to _codecs.
2021-11-06 09:44:00 +10:00
Matthias Metelka
1592fd0295 Editor Field Descriptions (#1476)
* Add description input to fields dialog

QLineEdit seems like the best option, as it saves space and motivates users to keep their descriptions concise.

* Add setDescriptions to note initialization script

Went for the extra function instead of including it in setFields to prevent potential add-on breakages.

* Add tooltip next to field name if description is set

* Refactor code according to suggestions

Set default tooltip placement to right instead of bottom

Use .get() for fld["description"]

Fix tab order in fields dialog

Swap out abbreviation "desc" for full length name to keep consistency

* Update Protobuf and Rust for description

Add description to notetypes.proto and schema11

Co-authored-by: RumovZ <RumovZ@users.noreply.github.com>

* Fix tooltips not updating with description

Remove redundant variable tooltipOptions

Update previousTooltip within reactive function

* Move LabelDescription out of LabelName

Co-authored-by: Henrik Giesel <hgiesel@users.noreply.github.com>

* Decrease icon size and fix alignment

Co-Authored-By: Henrik Giesel <hengiesel@gmail.com>

* the new key needs to be cleared from fields, not the notetype itself

Co-authored-by: RumovZ <RumovZ@users.noreply.github.com>
Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2021-11-06 09:42:48 +10:00
Damien Elmes
fc5914275b update Python deps; pin jsonschema
jsonschema 4.2 introduced a change that broke our current workaround
for in-memory support.

https://github.com/Julian/jsonschema/pull/873
https://github.com/indygreg/PyOxidizer/issues/457
2021-11-06 08:28:42 +10:00
Damien Elmes
980f2eec94 fix Python update script 2021-11-05 15:02:48 +10:00
Henrik Giesel
b97dc23b96 Several editor fixes (#1478)
* Declare toolbar api via modifiable property

* Fix addon buttons

* Assign editing areas in a synchronous way

* Restore the Tab shortcut that moves the caret to end

- moveCaretToEnd is called twice now: The moveCaretToEnd calls in
  *TextInput causes the caret to be moved to the end when switching back
  from the window and back.
- To fix this, I will need the code for saving and restoring locations
  from #1377

* Restore selections in the PlainTextInput

* Improve type safety of destroyable

- clearable-array was renamed to destroyable
2021-11-05 11:29:02 +10:00
Abdo
854fd71c26 Fix invalid path in cargo-env.bat (#1477)
* Fix invalid path in cargo-env.bat

* Assume cargo-env.bat is run from repo root; fix package script (dae)

* mention cargo-raze doesn't work on Windows (dae)
2021-11-05 11:08:23 +10:00
Damien Elmes
4fa8bad822 speed up Svelte compile
Approx 27s -> 16s when rebuilding editor after making a change to
lib. Still slower than I'd like.
2021-11-04 15:18:28 +10:00
Damien Elmes
bb427c9d26 add a missing references line in ts/graphs 2021-11-04 14:56:50 +10:00
Henrik Giesel
d654a57a90 Set "no-non-null-assertion: off" by default (#1475) 2021-11-04 11:42:51 +10:00
Damien Elmes
5e8580e137 ensure revlog headers match alignment of columns
+ right-align interval; it looks bad centered
2021-11-02 16:32:09 +10:00
Damien Elmes
600cbe5ded use absolute package paths in eslint.bzl 2021-11-02 13:49:19 +10:00
Damien Elmes
cc325d74b8 add lint checks for unsupported browser API calls 2021-11-02 13:44:41 +10:00
Damien Elmes
37df65d0c8 avoid Object.fromEntries() and some instances of globalThis
Not supported on early iOS 12. This can be reverted after iOS 12
support is dropped, which should be soon.
2021-11-02 12:54:06 +10:00
Damien Elmes
dd4c4eb07c include subfolders in eslint/prettier checks 2021-11-02 12:50:27 +10:00
Damien Elmes
5bad3d067c revert congrats h3 style change from #1470
Presumably bootstrap is overriding the styling of headers; this is a
quick fix to make the header be bold again, like the graphs screen.
2021-11-01 12:55:31 +10:00
Damien Elmes
43be693cc5 set local=False for python/protoc/clang
Suspect this will fix these repos being unnecessarily restarted on
changes to the workspace.
2021-11-01 11:38:20 +10:00
Damien Elmes
032c7e49c3 allow passing npm repo name in compile_svelte() 2021-10-31 18:10:11 +10:00
Damien Elmes
a3a9523f6f use absolute path for sql_format 2021-10-31 11:13:38 +10:00
Henrik Giesel
d74c38abe5 Several CSS fixes - Editor Cleanup (#1470)
* Refactor editor css, fix editor button highlight

- Avoid using webview.css
- Move more buttons css into button_mixins

* Fix DropdownItem appearance

* Fix the visuals of tags

* Make dropdown font slightly smaller

* Give SelectOption a background color

* Move some css from deck-options-base to CardStateCustomizer

* Avoid using core.scss for CardStats

* Avoid using sass/core in congrats package

* Inline core.scss into webview.scss

* Include fusion-vars for base.scss

* need to keep core.scss around for now (dae)
2021-10-31 08:29:22 +10:00
Matthias Metelka
f85e2e8cef Highlight field badges when toggled to non-default state (#1466) 2021-10-31 07:48:37 +10:00
Damien Elmes
82ab53c249 fix ts-run
Closes #1468
2021-10-30 09:14:43 +10:00
Damien Elmes
8ef362e7ed fix scripts/mypy*
Broken in switch to rules_python
2021-10-30 09:14:43 +10:00
Damien Elmes
455e0ce63b fix sort order toggling
We're getting an enum instead of an int in Qt6

normal/reversed have been renamed to ascending/descending; no add-ons
appear to be using the old versions.
2021-10-30 09:14:43 +10:00
Damien Elmes
670690fd64 fix broken startup on macOS due to incorrect mpv path 2021-10-30 09:14:43 +10:00
Damien Elmes
ce12b00c8e fix missing protobuf C extension on darwin-arm 2021-10-30 09:14:43 +10:00
RumovZ
e49b81bf88 Disable renaming of no-flag item (#1467) 2021-10-30 09:08:51 +10:00
RumovZ
d62d23c525 Use backend for getting deck children (#1465)
* Add backend routine for child deck names and ids

* Use backend for getting deck children

Instead of flawed case-sensitive Python logic.
2021-10-29 19:43:17 +10:00
Damien Elmes
0facadcf91 ignore requested graphics driver on Qt6 for now 2021-10-29 19:34:05 +10:00
Damien Elmes
a3c7628931 avoid printing compat warning on Qt5 2021-10-29 19:29:12 +10:00
Damien Elmes
c0a812cf9a tweaks for Linux package 2021-10-29 19:26:35 +10:00
Damien Elmes
56e432cf16 tweaks for Windows package
- move audio tools into subfolder
- add buildmanifest.py
2021-10-29 18:11:28 +10:00
Damien Elmes
951339a6fa show warning instead of crashing when recording on darwin-arm64 2021-10-29 14:43:59 +10:00
Damien Elmes
6774f81895 rename some of the files in aqt/qt/ 2021-10-29 13:54:24 +10:00
Damien Elmes
faf4ddf55f remove PyQt 6.2.0 workarounds
Fixed in the 6.2.1 release, and attempting to sign again on ARM
breaks the build.
2021-10-29 13:48:39 +10:00
Damien Elmes
a1a65fe4ff fix new cards not being correctly limited
https://forums.ankiweb.net/t/ios-beta-20080-2-more-new-cards-after-review-limit-is-met/13728/10
2021-10-29 12:12:34 +10:00
Damien Elmes
5f929cc959 add a flag to disable PyQt5 compat 2021-10-29 10:08:07 +10:00
Damien Elmes
62ec17adc6 fix missing icons in browse screen
Introduced in 4a0fa32d3c
2021-10-29 10:08:07 +10:00
Damien Elmes
4ce839b8d8 update to PyQt 6.2.1 2021-10-29 08:40:22 +10:00