Commit graph

8735 commits

Author SHA1 Message Date
Damien Elmes
098bdc1771 fix broken links_pb2.pyi link 2021-10-01 22:52:15 +10:00
Damien Elmes
8b4030a1b5 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
fe24525aa5 Add the homepage property to manifest.json 2021-10-01 14:40:36 +03:00
Damien Elmes
b2f05fff4e update Bazel version 2021-10-01 20:54:48 +10:00
Damien Elmes
e1e2be65e6 update translations 2021-10-01 20:48:20 +10:00
Damien Elmes
181bfab3d9 Merge pull request #1397 from RumovZ/column-tooltips
Add tooltips for some browser columns
2021-10-01 19:12:59 +10:00
Damien Elmes
1b4d3a9047 "number of cards a note has" 2021-10-01 19:12:49 +10:00
Damien Elmes
af88b480f9 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
8ba252a53e 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
a437e02973 Merge pull request #1396 from blue-putty/contributing-correction
Typo correction
2021-10-01 14:48:04 +10:00
Damien Elmes
bc7c43ac67 avoid extra allocation in replacement 2021-10-01 14:43:38 +10:00
Damien Elmes
964a52a338 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
4897a6fcfa 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
61fd7327bd 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
a5c7134d43 yarn upgrade --latest
bootstrap still held back
2021-10-01 12:52:53 +10:00
Damien Elmes
5d7eb8c425 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
c04c8db9a4 Remove workaround for Qt completer bug
Reverts  #803.
2021-09-30 17:56:37 +02:00
RumovZ
0d68e1d59c Add tooltips for some browser columns 2021-09-30 13:15:09 +02:00
Damien Elmes
c7f4d30e7f fix uncaught error when int over 64 bits passed into db_command() 2021-09-30 16:46:33 +10:00
blue-putty
2d64c89c51 Typo correction
test changed to tense
2021-09-29 20:59:57 -04:00
Damien Elmes
7ce0b944bd 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
899d0556e8 handle changed aria-expanded typing 2021-09-29 12:20:27 +10:00
Damien Elmes
6db52323dd 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
9b994ac537 silence execCommand deprecation warnings for now 2021-09-29 11:36:37 +10:00
RumovZ
2fca3de03e Remove redundant call to len_columns() 2021-09-28 12:11:20 +02:00
RumovZ
7c376e0172 Tweak comment
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2021-09-28 11:48:35 +02:00
RumovZ
6be0de0310 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
17ece47beb Cache selectionModel().selectedRows() 2021-09-28 11:45:22 +02:00
RumovZ
014220959a 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
4245a6bbc3 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
abdo
4d3f2c0232 Strip isolation chars from filenames in Check Media screen 2021-09-27 22:15:37 +03:00
Damien Elmes
b1e7a25623 Revert "Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file""
This reverts commit a2ac197fd7.

Looks like it wasn't the cause of the previously reported problem:

https://forums.ankiweb.net/t/2-1-48-tts-problem/13587/2
2021-09-27 18:43:16 +10:00
Damien Elmes
04a620ff1a Merge pull request #1382 from RumovZ/tags-from-sidebar
Tags from sidebar
2021-09-27 18:41:32 +10:00
Damien Elmes
c3c51af7a9 Merge pull request #1388 from lolilolicon/patch-1
Quote $PREFIX properly for paths with spaces
2021-09-27 18:39:25 +10:00
Damien Elmes
da1f890115 Merge pull request #1391 from sobjornstad/change_note_type_hook
Add hook for selecting a new note type in the add window
2021-09-27 18:38:40 +10:00
RumovZ
94eafcf831 Calculate number of selected rows manually
`len(self._view.selectionModel().selectedRows())` is slow for large
selections, because Qt queries flags() for every selected cell, so we
calculate the number of selected rows ourselves.
2021-09-27 10:15:53 +02:00
RumovZ
8daecb94e5 Switch to new row before deleting notes
The table now properly deselects deleted rows, but that takes effort and
it's more convenient to have a selected row after deleting.
2021-09-25 17:28:38 +02:00
RumovZ
c0616fe820 Handle deleted or restored rows
- Cache the result of 'table.len_selection()'
- Update this cache manually when a row was deleted or restored
- Emit 'dataChanged()' after such a change to fix flags not updating
correctly to the shortcut in 'model.flags()'
- Remove/retsore focus if the current element was deleted/restored
2021-09-25 17:16:53 +02:00
RumovZ
053bbe8f01 Only check flags of cached rows
Speeds up the selection process (esp. Ctrl+A) by avoiding to fetch rows.

Co-authored-by: BlueGreenMagick <BlueGreenMagick@users.noreply.github.com>
2021-09-25 15:32:22 +02:00
RumovZ
0a95d69735 Add callbacks to row fetching routine
Called when a row is detected that has been deleted or restored.
2021-09-25 15:27:19 +02:00
RumovZ
a77c65006f Check 'index.isValid()' in 'table.model' 2021-09-25 15:21:06 +02:00
Soren Bjornstad
834118ce8a Add hook after selecting a new note type in the add window 2021-09-24 21:54:33 -05:00
Damien Elmes
5d0736ab96 update svelte2tsx
We can now use the typings from the Svelte library instead of the
svelte2tsx shims
2021-09-25 11:07:31 +10:00
lolilolicon
739d3d3cb5 Update CONTRIBUTORS 2021-09-24 13:46:01 +00:00
lolilolicon
1120e6d644 Quote $PREFIX properly for paths with spaces 2021-09-23 01:24:52 +00:00
lolilolicon
ad9497aaf7 Quote $PREFIX properly for paths with spaces 2021-09-23 01:20:53 +00:00
Damien Elmes
8f7e7498da update to TypeScript 4.4.x 2021-09-23 09:53:37 +10:00
Damien Elmes
81104f47f4 fixes for TypeScript 4.4.x
closes #1386
2021-09-23 09:52:21 +10:00
RumovZ
b42379bf96 Apply suggestions from code review
Capitalise "selected"

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2021-09-22 16:59:05 +02:00
Damien Elmes
df26c61164 update ts deps
typescript and bootstrap have been pinned for now:

https://github.com/ankitects/anki/issues/1386
https://github.com/ankitects/anki/issues/1385

hint failures for svelte-check have also been temporarily turned
off, due to it now complaining about document.execCommand():

Hint: The signature '(commandId: string, showUI?: boolean, value?: string): boolean' of 'document.execCommand' is deprecated. (ts)
    const wrapWithForecolor = (color: string) => () => {
        document.execCommand("forecolor", false, color);
    };

Will follow up in #1377
2021-09-22 23:21:39 +10:00