Commit Graph

8805 Commits

Author SHA1 Message Date
Ren Tatsumoto
48f8427592
Keep the list of duplicates up-to-date before tagging (#1404)
* keep the list of dupes up-to-date before tagging

* get rid of a redundant parameter

* unnecessary lambda
2021-10-07 12:49:41 +10:00
Damien Elmes
46b80ca773 move node_modules into root folder [action required]
Recommend removing ts/node_modules folder before attempting to
build after this update.

This moves ts/node_modules into the root of the project to work around
https://github.com/ankitects/anki/pull/1405#issuecomment-936213861

Also fixes the sass errors shown when running scripts/svelte-check
2021-10-07 11:42:27 +10:00
Damien Elmes
b9251290ca run pyupgrade over codebase [python upgrade required]
This adds Python 3.9 and 3.10 typing syntax to files that import
attributions from __future___. Python 3.9 should be able to cope with
the 3.10 syntax, but Python 3.8 will no longer work.

On Windows/Mac, install the latest Python 3.9 version from python.org.
There are currently no orjson wheels for Python 3.10 on Windows/Mac,
which will break the build unless you have Rust installed separately.

On Linux, modern distros should have Python 3.9 available already. If
you're on an older distro, you'll need to build Python from source first.
2021-10-04 15:05:48 +10:00
Damien Elmes
8833175bb4 strip extras from requirements.txt
The extra was preventing use as a pip constraints file.
2021-10-04 15:05:48 +10:00
Damien Elmes
e9c7b2287f bump minimum Python to 3.9 2021-10-04 15:05:15 +10:00
Damien Elmes
5dc385c9b7 fix pylinthome warning 2021-10-03 12:23:52 +10:00
Damien Elmes
daf2e0a78f fix profile save not working on Python 3.10 2021-10-03 12:23:37 +10:00
Damien Elmes
7c70d26fe7 update Python deps 2021-10-02 23:52:23 +10:00
Damien Elmes
5801da13b3 apply some f-string updates via flynt 2021-10-02 23:52:02 +10:00
Damien Elmes
fe576a865d convert some range(len()) calls for pylint 2021-10-02 23:51:59 +10:00
Damien Elmes
553ce808e5 add missing encoding argument to open calls 2021-10-02 23:51:50 +10:00
Damien Elmes
9a103b3716 use extra variable in stdHtml() to work around a pylint crash 2021-10-02 22:47:13 +10:00
Damien Elmes
944b064e54 update Rust deps 2021-10-02 20:42:03 +10:00
Damien Elmes
faec7f8e3d update cargo-raze instructions 2021-10-02 16:24:44 +10:00
Damien Elmes
86572f09fd update to the latest rules_rust 2021-10-02 15:13:37 +10:00
Damien Elmes
8e56853c50 fix a clippy lint in latest Rust 2021-10-02 14:13:49 +10:00
Damien Elmes
0000a3b302
Merge pull request #1402 from RumovZ/row-changed
Connect `currentChanged()` and add legacy alias for `onRowChanged()`
2021-10-02 09:06:05 +10:00
RumovZ
c146f33faa Add legacy alias browser.onRowChanged() 2021-10-01 18:36:12 +02:00
RumovZ
3a5d86c344 React to currentChanged() signal
Decouples changes of the current element and changes of the selection.
Introduces `browser.current_card` which has previously been amalgamated
with the previewer card `browser.card`.
2021-10-01 16:40:25 +02:00
Damien Elmes
0bb273a0ed replace the old stripHTML() methods with the backend implementation
Python's regex engine performs pathologically on regexes like
'<!--.*?-->' when fed a large string of repeating '<!--' clauses.
Thanks to JaimeSlome / security@huntr.dev for the report; closes #1380.

Solved by switching to the Rust implementation, which does not suffer
from this issue.

entsToText(), minimizeHTML(), and the old regex constants have been
removed; they do not appear to be used by any add-ons.
2021-10-01 23:15:45 +10:00
Damien Elmes
a28df026b8 fix broken links_pb2.pyi link 2021-10-01 22:52:15 +10:00
Damien Elmes
812bf76b96
Merge pull request #1399 from abdnh/addon-homepage-manifest-prop
Add the homepage property to manifest.json
2021-10-01 21:52:00 +10:00
Abdo
3822568667 Add the homepage property to manifest.json 2021-10-01 14:40:36 +03:00
Damien Elmes
8d4a623dae update Bazel version 2021-10-01 20:54:48 +10:00
Damien Elmes
60aa75226b update translations 2021-10-01 20:48:20 +10:00
Damien Elmes
a174c41801
Merge pull request #1397 from RumovZ/column-tooltips
Add tooltips for some browser columns
2021-10-01 19:12:59 +10:00
Damien Elmes
c413a0d9f2
"number of cards a note has" 2021-10-01 19:12:49 +10:00
Damien Elmes
046c6c55d3 use extra rootDir in tsconfig instead of symlinks
The nice thing about the symlink approach is that it allowed tsc -b
to function without any changes to the tsconfig.json file, but it meant
there were extra links we had to maintain. So instead, we just add an
extra rootDirs entry, and add two commented-out lines that can be
uncommented when wanting to build with tsc directly.
2021-10-01 18:36:52 +10:00
Damien Elmes
7a81a1c7b6
Merge pull request #1400 from RumovZ/revert-hide-completer
Remove workaround for Qt completer bug
2021-10-01 15:30:37 +10:00
Damien Elmes
1b41376620
Merge pull request #1396 from blue-putty/contributing-correction
Typo correction
2021-10-01 14:48:04 +10:00
Damien Elmes
3940b0587d avoid extra allocation in replacement 2021-10-01 14:43:38 +10:00
Damien Elmes
98aa162608
Merge pull request #1394 from abdnh/strip-unicode-isolation
Strip isolation characters from filenames in Check Media screen
2021-10-01 14:42:36 +10:00
Damien Elmes
ee99578c06
Merge pull request #1392 from RumovZ/missing-row-handling
Handle missing rows consistently and speed up selections
2021-10-01 14:24:04 +10:00
Damien Elmes
3ab544e487
Merge pull request #1398 from ankitects/ts_project [note: Windows users]
update to latest rules_nodejs & switch to ts_project

Windows users with an existing checkout will likely need to use 'bazel clean' before building, due to old files lying around in the wrong place
2021-10-01 13:09:59 +10:00
Damien Elmes
e9d71bfbe4 yarn upgrade --latest
bootstrap still held back
2021-10-01 12:52:53 +10:00
Damien Elmes
a3d9f90af5 update to latest rules_nodejs & switch to ts_project
ts_library() is deprecated and will presumably be dropped from a
future rules_nodejs, and it wasn't working with the jest tests
after updating, so we switch over to ts_project().

There are some downsides:

- It's a bit slower, as the worker mode doesn't appear to function
at the moment.
- Getting it working with a mix of source files and generated files
was quite tricky, especially as things behave differently on Windows,
and differently when editing with VS Code. Solved with a small patch
to the rules, and a wrapper script that copies everything into the
bin folder first. To keep VS Code working correctly as well, the built
files are symlinked into the source folder.
- TS libraries are not implicitly linked to node_modules, so they
can't be imported with an absolute name like "lib/proto" - we need
to use relative paths like "../lib/proto" instead. Adjusting "paths"
in tsconfig.json makes it work for TS compilation, but then it fails
at the esbuild stage. We could resolve it by wrapping the TS
libraries in a subsequent js_library() call, but that has the downside
of losing the transient dependencies, meaning they need to be listed
again.  Alternatively we might be able to solve it in the future by
adjusting esbuild, but for now the paths have been made relative to
keep things simple.

Upsides:

- Along with updates to the Svelte tooling, Svelte typing has improved.
All exports made in a Svelte file are now visible to other files that
import them, and we no longer rebuild the Svelte files when TS files
are updated, as the Svelte files do no type checking themselves, and
are just a simple transpilation. Svelte-check now works on Windows again,
and there should be no errors when editing in VS Code after you've
built the project. The only downside seems to be that cmd+clicking
on a Svelte imports jumps to the .d.ts file instead of the original now;
presumably they'll fix that in a future plugin update.
- Each subfolder now has its own tsconfig.json, and tsc can be called
directly for testing purposes (but beware it will place build products
in the source tree): ts/node_modules/.bin/tsc -b ts
- We can drop the custom esbuild_toolchain, as it's included in the
latest rules_nodejs.

Other changes:

- "image_module_support" is moved into lib/, and imported with
<reference types=...>
- Images are now imported directly from their npm package; the
extra copy step has been removed.

Windows users may need to use "bazel clean" before building this,
due to old files lying around in the build folder.
2021-10-01 12:52:53 +10:00
RumovZ
e5cf649d6a Remove workaround for Qt completer bug
Reverts  #803.
2021-09-30 17:56:37 +02:00
RumovZ
ee2ecd0700 Add tooltips for some browser columns 2021-09-30 13:15:09 +02:00
Damien Elmes
57f4d6588f fix uncaught error when int over 64 bits passed into db_command() 2021-09-30 16:46:33 +10:00
blue-putty
77995148c2 Typo correction
test changed to tense
2021-09-29 20:59:57 -04:00
Damien Elmes
e46ca4ee54 update svelte-check
Invoking from scripts/svelte-check is currently broken due to sass
imports - it appears to have been broken some time back.
2021-09-29 12:27:27 +10:00
Damien Elmes
604247482d handle changed aria-expanded typing 2021-09-29 12:20:27 +10:00
Damien Elmes
d44b49294b make 'for' argument optional in TooltipLabel
The latest svelte-check has revealed we were not passing 'for' in
when we should have been. This is a quick hack to get the tests passing
again, but a better approach that actually makes this accessible again
would be good in the future.
2021-09-29 12:20:03 +10:00
Damien Elmes
04ba24cb54 silence execCommand deprecation warnings for now 2021-09-29 11:36:37 +10:00
RumovZ
326cf0f77f Remove redundant call to len_columns() 2021-09-28 12:11:20 +02:00
RumovZ
72f6f9a47a
Tweak comment
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2021-09-28 11:48:35 +02:00
RumovZ
46ffbb936d Speed up to_row_of_unselected_note()
Skip rows between selected rows and return fetched note ids.
2021-09-28 11:47:13 +02:00
RumovZ
a592c5b3a9 Cache selectionModel().selectedRows() 2021-09-28 11:45:22 +02:00
RumovZ
eac8972a28 Calculate len_selection depending on modifiers
If no modifiers are pressed, a single row has probably been clicked and
`selectedRows()` is fast, while a lot of rows might have been deselcted.
2021-09-28 10:22:20 +02:00
RumovZ
287854d014 Prefer selectionModel().reset() over .clear()
The latter triggers `selectionChanged()` unreliably, probably due to the
aggregation of chronologically close events, causing problems in
tracking `_len_selection`. `reset()` never emits signals.
2021-09-28 10:19:33 +02:00