All platforms:
- rename scripts/ to tools/: Bazelisk expects to find its wrapper script
(used by the Mac changes below) in tools/. Rather than have a separate
scripts/ and tools/, it's simpler to just move everything into tools/.
- wheel outputs and binary bundles now go into .bazel/out/dist. While
not technically Bazel build products, doing it this way ensures they get
cleaned up when 'bazel clean' is run, and it keeps them out of the source
folder.
- update to the latest Bazel
Windows changes:
- bazel.bat has been removed, and tools\setup-env.bat has been added.
Other scripts like .\run.bat will automatically call it to set up the
environment.
- because Bazel is now on the path, you can 'bazel test ...' from any
folder, instead of having to do \anki\bazel.
- the bat files can handle being called from any working directory,
so things like running "\anki\tools\python" from c:\ will work.
- build installer as part of bundling process
Mac changes:
- `arch -arch x86_64 bazel ...` will now automatically use a different
build root, so that it is cheap to switch back and forth between archs
on a new Mac.
- tools/run-qt* will now automatically use Rosetta
- disable jemalloc in Mac x86 build for now, as it won't build under
Rosetta (perhaps due to its build scripts using $host_cpu instead of
$target_cpu)
- create app bundle as part of bundling process
Linux changes:
- remove arm64 orjson workaround in Linux bundle, as without a
readily-available, relatively distro-agonstic PyQt/Qt build
we can use, the arm64 Linux bundle is of very limited usefulness.
- update Docker files for release build
- include fcitx5 in both the qt5 and qt6 bundles
- create tarballs as part of the bundling process
* Call StudyDeck with callback
* StudyDeck w/ callback, remove redundant assignment
* Replace exec() with show() for various dialogs
* Update super init args for Models.__init__
* Make StudyDialog ApplicationModal
* Callback for StudyDeck, use with onModelChange
* Add types to callback function
* Rationalise types
* Update CONTRIBUTORS
* Fix type hints
I'm still getting to grips with the type hints!
* Consistency with callback checks
* | not supported for type hints on 3.9
* Fix button focus highlight on Windows
* Use none instead of none for outline and box-shadow
* Unnest selectors in reviewer-bottom
Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
* Add componentHook functionality
* Register package NoteEditor
* Rename OldEditorAdapter to NoteEditor
* Expose instances in component-hook as well
* Rename NoteTypeButtons to NotetypeButtons
* Move PreviewButton initialization to BrowserEditor.svelte
* Remove focusInRichText
- Same thing can be done by inspecting activeInput
* Satisfy formatter
* Fix remaining rebase issues
* Add .bazel to .prettierignore
* Rename currentField and activeInput to focused{Field,Input}
* Move identifier to lib and registration to sveltelib
* Fix Dynamic component insertion
* Simplify editingInputIsRichText
* Give extra warning in svelte/svelte.ts
- This was caused by doing a rename of a files, that only differed in
case: NoteTypeButtons.svelte to NotetypeButtons.svelte
- It was quite tough to figure out, and this console.log might make it
easier if it ever happens again
* Change signature of contextProperty
* Add ts/typings for add-on definition files
* Add Anki types in typings/common/index.d.ts
* Export without .svelte suffix
It conflicts with how Svelte types its packages
* Fix left over .svelte import from editor.py
* Rename NoteTypeButtons to unrelated to ensure case-only rename
* Rename back to NotetypeButtons.svelte
* Remove unused component-hook.ts, Fix typing in lifecycle-hooks
* Merge runtime-require and register-package into one file
+ Give some preliminary types to require
* Rename uiDidLoad to loaded
* Fix eslint / svelte-check
* Rename context imports to noteEditorContext
* Fix import name mismatch
- I wonder why these issues are not caught by svelte-check?
* Rename two missed usages of uiDidLoad
* Fix ButtonDropdown from having wrong border-radius
* Uniformly rename libraries to packages
- I don't have a strong opinion on whether to name them libraries or
packages, I just think we should have a uniform name.
- JS/TS only uses the terms "module" and "namespace", however `package`
is a reserved keyword for future use, whereas `library` is not.
* Refactor registration.ts into dynamic-slotting
- This is part of an effort to refactor the dynamic slotting (extending
buttons) functionality out of components like ButtonGroup.
* Remove dynamically-slottable logic from ButtonToolbar
* Use DynamicallySlottable in editor-toolbar
* Fix no border radius on indentation button dropdown
* Fix AddonButtons
* Remove Item/ButtonGroupItem in deck-options, where it's not necessary
* Remove unnecessary uses of Item and ButtonGroupItem
* Fix remaining tests
* Fix relative imports
* Revert change return value of remapBinToSrcDir to ./bazel/out...
* Remove typings directory
* Adjust comments for dynamic-slottings
When backups were moved into a separate thread 5 years ago, it improved
performance when switching between different profiles, as the backup
happened in the background. But when closing Anki, we wait on the
background thread to complete, so Anki hangs until the backup finishes.
The performance difference on a large collection is considerable:
- 0.45s without compression
- 7.9s with compression
Given that the majority of users probably aren't using multiple profiles,
I think the speed increase is probably worth the extra disk usage. In
the future, we may want to look into using zstd to compress the backups,
which may even be a performance win over the uncompressed version on
some devices.
* Add fix for users without gnome schema
On some systems, the result of the `gsettings get org.gnome.desktop.interface gtk-theme` command is `No such schema “org.gnome.desktop.interface”`, which causes Anki to fail to find a value, subsequently crashing on some Linux systems.
* Fix whitespace
* NF: rename "fields" into "field_names" for clarity
* NF: remove an useless enumerate
the integral value was never used
* NF: rename new and old into new_note and old_note for clarity
* NF: rename old_field to old_field_value for clarity
Unfortunately 5efaf5a4be broke the Svelte
language tools - presumably having paths outside of the repo is confusing
them.
As a plan B, the symlinks have been shifted to a single subdir. Along
with some exclusions in the VS Code config, this should allow VS Code
to continue to work out of the box, but the docs will need updating
to reflect the extra work required for PyCharm/IntelliJ.
+ fix svelte-check execution on a system without node installed. It
still throws up some errors that are presumably caused by our multiple
rootDirs - not sure if there's an easy way to work around that.
The default symlink location can cause slowdowns and wasted CPU cycles
in VS Code and PyCharm/IntelliJ, as they try to watch Bazel's (large)
build folder for changes. The issue can be mostly ameliorated in VS Code
by excluding the symlinks using globs in settings like watcherExclude,
but the Rust extension doesn't support globs, so each folder needs to be
listed out separately. And because the product name symlink depends on
the name of the directory you're building from, we can't just include
the excludes in .vscode - it will depend on the folder the user is storing
things.
PyCharm and IntelliJ behave even worse here - they continue to monitor
for changes in all folders of the repo, even if those folders have been
marked as excluded in the project settings. Placing the folders into the
IDE-global Editor>File Types>Ignored Files And Folders works around this,
but again we run into troubles making this work out of the box, especially
with the product name in the symlink.
One option would be to turn the symlinks off completely. They are not
required for building, and for scripting/debugging, we can get the folder
locations via 'bazel info'. But with that approach, we would no longer
be able to symlink build products into the source tree, as we do for
things like the generated backend methods and translations, so we'd lose
code completion for them that way.
Another option would be to place the symlinks in .bazel/ inside the repo.
That solves the VS Code case (in conjunction with a workspace config file),
but doesn't fully fix IntelliJ/PyCharm.
The only remaining option I can see is to place the symlinks outside the
repo. Bazel won't expand ~ in the symlink path, so we can't use something
like ~/.cache/bazel/anki to place the files near the other build files.
So we end up having to have the files written to ../bazel/anki, in the
repo's parent folder. Not very clean, but I don't see a better alternative
at the moment.
.gitignore is still ignoring bazel-*, as currently bazel-dist and
bazel-pkg will be created when building/packaging. They should be fairly
innocuous, but we may want to rename them at one point.
Other changes:
- add missing symlink for pylib hooks
- add a sample .user.bazelrc file
* Add _bytes methods for all methods in the backend
Expose get_note in qt/aqt/mediasrv.py
* Satisfy formatter
* Rename _bytes function to _raw and have them bytes as input
* Fix backend generation
* Use lib/proto/deckOptions in deck-options
* Add exposed_backend to qt/aqt/mediasrv.py
* Move some more backend methods to exposed_backend_list
* Use protobufjs for congrats and i18n
* Use protobufjs for completeTag
* Use protobufjs services in change-notetype
* Reorder post handlers in alphabetical manner
* Satisfy tests
* Remove unused collection methods
* Rename access_backend to raw_backend_request
* Use _vendor.stringcase instead of creating a new function
* Remove SKIP_UNROLL_OUTPUT
* Directly call _run_command in non _raw methods
* Remove TranslateString, ChangeNotetype and CompleteTag from SKIP_UNROLL_INPUT
* Remove UpdateDeckConfigs from SKIP_UNROLL_INPUT
* Remove ChangeNotetype from SKIP_UNROLL_INPUT
* Remove SKIP_UNROLL_INPUT
* Fix typing issue with translate_string
- Adds typing support for Protobuf maps in genbackend.py
* Do not emit convenience method for protobuf TranslateString
* Implement custom study on backend
* Switch frontend to backend custom study
* Skip typecheck for new pb classes
* Build tag search string on backend
Also fixes escaping of special characters in tag names.
* `cram.cards` -> `cram.card_limit`
* Assign more meaningful names in `TagLimit`
* Broaden rustfmt glob
* Use `invalid_input()` helper
* Assign `FilteredDeckForUpdate` to temp var
* Implement `SearchBuilder`
* Rewrite `custom_study()` with `SearchBuilder`
* Replace match macros with `SearchBuilder`
* Remove `into_nodes_list` & `concatenate_searches`
* Make webview zoom optional
Also suppress mouse wheel zooming.
* Disable zoom for top and bottom bars in main view
* Factor in macos zoom by scrolling and refactor
* fix: AttributeError: 'QMouseEvent' object has no attribute 'pos'
```
Caught exception:
Traceback (most recent call last):
File "D:\Python\Python39\lib\site-packages\aqt\browser\sidebar\tree.py", line 328, in mouseReleaseEvent
if (index := self.currentIndex()) == self.indexAt(event.pos()):
d
```
* fix: AttributeError: 'QMouseEvent' object has no attribute 'pos'
* Move some AddCards specific code to NoteCreator.svelte
* Add new strings for Toggling the Visual / HTML editor
* Set LabelContainer vertical-align to text-top
- Makes them look more centered
* Remove appendInParentheses helper
* Make all ts/*.html files include only module.js and module.css
* Move any JS from .html to index files
* Remove .html files from ts modules
* Remove Python with Starlark implemenation
* Remove reference to non-existing file
* Remove deck-option.html as well
* fix change-notetype screen (dae)
* fix: try catch excepton on get_windows_dark_mode and global cache that check
* add commitor email to CONTRIBUTORS
* remove is_windows_dark_mode cache
* avoid logging the missing key (dae)
The check happens frequently, so this will fill up the user's console if we print it each time.
- The way mypy gathers site packages has changed slightly, so we had to
update extendsitepkgs.py to work with it.
- Not sure if there's a way to avoid the ignore in
operations/__init__.py. mypy is still ensuring a provided argument has
a .changes attribute, so thankfully we don't seem to have lost much here.
* Forbid inserting object and iframe tags via PlainTextInput
* Add optional browserMode parameter to Editor
* Create new ts modules for three editor instances
- note-creator for AddCards
- browser-editor for the editor in the Browser
- reviewer-editor for the EditCurrent
* Revert "Forbid inserting object and iframe tags via PlainTextInput"
This reverts commit ab90ae8194494d883a1863126496e2d8f332509e.
* Refactor browserMode to editorMode
* Move new editor variants inside /ts/editor directory
* Fix typo
* Fix cardtype icon, add flag-off icon, remove flag.svg
* This removes the old flag.svg, because mdi-icons also has
one icon called `flag.svg`, and there was undefined behavior
which flag icon was being picked, when requesting "flag.svg"
* Sort no-flag to beginning of subtree
* to match tags
Since this commit (ebd2acd98e),
Plasma Desktop will check "X-GNOME-SingleWindow" property to determine
whether to show "Open New Window" action in the context menu of a task.
Anki cannot launch a new instance or open a new window, so add the
property and set it to true to hide the action.
* Allow customization of add-on config help path
This is useful for loading translated versions of the help file if available
* dir -> module
* Allow setting a callback instead to produce config docs
* Fix media playback not terminating when previewer is closed
https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/78
* Fix _on_preview_closed being called twice unnecessarily
The function was being called twice when the preview button is clicked
while the previewer is open.
* Fix console error caused by leftover code
The following error was shown in the console when closing previewer:
`Uncaught TypeError: Cannot read property 'classList' of null`
* Toggle state of preview button via 'active' prop
* Support drag & drop in main window to import files
* Pass drag & drop events to super when not in deck browser
Seems this is required so that JS in the reviewer receives dragover
* Remove unused allowDrops
- Copy identical fields as before, but maintain a list of copied fields
and only add non-empty ones to it.
- Instead of setting remaining fields by their indices, assign remaining non-empty old fields to new fields sequentially
This results in less fields being lost when switching notetypes.
* Preload external css files to prevent flash of unstyled content
This is an implementation of the approach mentioned in the commit
message of 46b85d5.
* Tweak max_age value for css files
Ensure that css preloading works even on a slow PC.
We want to preserve the backend checks, because they may also detect
bugs. So we do the debouncing on the frontend instead, transitioning
into a temporary state until the background op completes.
https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/74
When we updated to flask 2.0, the default caching time changed to
0. When setting the HTML of a new card side in the DOM, the browser
first removes the existing content (including styling), then sends a
HTTP request to us to check whether the file has changed or not. By the
time the answer has arrived, the browser has repainted without the
styling, and thus we get a flicker.
A side-effect of reverting to flask 1.x behaviour is that external changes
to media files will not be reflected in Anki for an hour, unless Anki
is restarted, or the caches are cleared manually with an add-on. An
alternative approach would be to pre-fetch the css files like we do with
images, but there are other things like fonts to think about as well.
Closes#1455
* Add "Show duplicates" to LabelContainer
* Avoid bubbling down the duplicate logic into EditorField
* Move duplicate link into its own slot
to center it between name/description and field-state.
* Revert "Move duplicate link into its own slot"
This reverts commit 3a4511042da7083a52d67b58550b13d873dcbea5.
* Justify dupes within FieldState
to achieve the same result as before while avoiding additional logic within EditorField.
Co-Authored-By: Henrik Giesel <hengiesel@gmail.com>