Commit Graph

9033 Commits

Author SHA1 Message Date
Damien Elmes
db3ce467a3 clarify QueryOp docstring
Maybe there's a better name we could use than QueryOp - suggestions
welcome.
2021-12-04 08:55:11 +10:00
Damien Elmes
5cc261fce7 use QueryOp for unused media deletion
Closes #1517
2021-12-04 08:55:11 +10:00
Damien Elmes
42455eca64 QueryOp() was attempting to open progress window on background thread 2021-12-04 08:55:11 +10:00
Matthias Metelka
936323e430
Show downwards arrow on SelectButton (#1521)
* Show downwards arrow on SelectButton

The arrow wasn't showing because the button linear-gradient background overrides the background-image for the arrow.

Select can't have pseudo-elements, so I had to add an extra div.

* Remove height definition

to fix text cutting off on Windows.

* Hide default arrow in light theme

to keep consistency with dark theme, where the arrow has to be custom due to the button gradient.

* Use alternative approach to prevent text getting cropped

and add height definition back again.

Co-Authored-By: Hikaru Y. <47855854+hikaru-y@users.noreply.github.com>

* Adjust arrow position for rtl

Co-authored-by: Hikaru Y. <47855854+hikaru-y@users.noreply.github.com>
2021-12-04 08:08:20 +10:00
Matthias Metelka
3015ddd2c1
Fix bug(s) caused by deleting a notetype currently selected in AddCards (#1514)
* Remove unneeded old.note_type() call

Fixes TypeError thrown after deleting a notetype that's currently selected in the editor.

* Handle IndexError on notetype change

Occurs in the Add window when changing the notetype via NotetypeChooser from
- the notetype that's auto-selected after deleting the currently selected notetype
- to a notetype with fewer fields than the auto-selected one

* Add return to exception handler

to properly ignore the command.
2021-12-04 07:55:22 +10:00
Henrik Giesel
d0c6f0d7ba
Fix focus lost after adding note if non-sticky (#1523) 2021-12-03 21:41:12 +10:00
Damien Elmes
ae29c8c333 update PyOxidizer 2021-12-03 21:00:15 +10:00
Damien Elmes
661f769700 update Node deps
TypeScript is currently pinned. Before updating to 4.5, we will likely
need to use --preserveValueImports in svelte.ts:
https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#preserve-value-imports

There's also an issue with missing types when importing from bootstrap
.js files that will need investigating.
2021-12-03 20:35:53 +10:00
Damien Elmes
195361ed46 add script to put node/yarn on path 2021-12-03 20:35:53 +10:00
Damien Elmes
47b701688f fix update-licenses.sh 2021-12-03 20:35:53 +10:00
Damien Elmes
c2ab0de34f update Rust deps 2021-12-03 20:35:53 +10:00
Damien Elmes
67ee6f9c0e update to Rust 1.57 + latest rules_rust 2021-12-03 20:35:52 +10:00
Damien Elmes
8de3eaea65 fix Clippy lints in Rust 1.57 2021-12-03 19:53:37 +10:00
Damien Elmes
763932cbed update translations 2021-12-03 19:51:28 +10:00
Damien Elmes
2687e11b86 update to PyQt6.2.2 2021-12-03 19:42:43 +10:00
Damien Elmes
06fb8badfb update Python deps + fix update script
Script should now work properly for PyQt as well.
2021-12-03 19:39:39 +10:00
Damien Elmes
d7f5555642 deck_tree() could be made to unbury the current day's cards
When provided with a future timestamp to estimate the next day's cards,
it lead to the current day's buried cards being unburied.

Fixes
https://forums.ankiweb.net/t/inconsistent-card-counts-when-syncing/15496
2021-12-02 21:07:21 +10:00
Damien Elmes
9daa0c9acb fix new cards not appearing in correct order in v3
This was broken by an SQLite upgrade - previously we received the rows
in ix_cards_sched order, but recent versions use a table scan for that
query when the order is unspecified. Solved by being explicit about the
order we expect results to arrive.

https://forums.ankiweb.net/t/skipping-new-cards/15410
2021-12-02 17:20:48 +10:00
Damien Elmes
7fcb8cbb62 fix position showing as date in card stats
Fixes #1519
2021-12-02 16:10:29 +10:00
Abdo
5a3999d0c8
Adjust arrows direction for RTL layouts in previewer (#1513) 2021-11-29 12:41:08 +10:00
Matthias Metelka
8edca4e6c1
Add missing editorToolbar export (#1511) 2021-11-29 12:40:31 +10:00
Damien Elmes
04fee0dc10 update Visual Studio instructions 2021-11-29 12:32:39 +10:00
Hikaru Y
d2cbd15bbe
Fix memory leak in AnkiWebView (#1510) 2021-11-29 12:31:37 +10:00
RumovZ
627f910635
Remove redundant camelcase aliases (#1509) 2021-11-26 12:29:48 +10:00
Damien Elmes
b9eccec2b0 move aqt/platform.py code into theme.py
We have other platform-specific code scattered through the codebase,
and better it lives in a location where it is used.
2021-11-25 19:10:57 +10:00
Damien Elmes
9ed13eee80 convert invariant assertions to if statements
The packaged builds of 2.1.50 use python -OO, which means our assertion
statements won't be run. This is not an issue for unit tests (as we
don't run them from a packaged build), or for type assertions (which are
added for mypy's benefit), but we do need to ensure that invariant checks
are still run.
2021-11-25 17:47:50 +10:00
Damien Elmes
88392634a8 fix check for user exporting into data folder on Windows
https://forums.ankiweb.net/t/unable-to-export-colpkg-file/10527
2021-11-25 09:30:17 +10:00
Damien Elmes
ebad6ad379 update platform checks (eg isWin -> is_win) + devMode 2021-11-25 09:06:16 +10:00
Damien Elmes
9d444b40e0 avoid duplicate work in overview screen 2021-11-25 09:01:02 +10:00
Damien Elmes
f16bd9a9a8 minor docstring fix 2021-11-25 08:57:33 +10:00
Damien Elmes
f0fedf6ab8 add minimal theme detection on Linux
Closes #1116
2021-11-25 08:45:14 +10:00
RumovZ
f2173fddb0
Live theme changes (#1497)
* Allow theme change at runtime and add hook

* Save or restore default palette on theme change

* Update aqt widget styles on theme change

* styling fixes

- drop _light_palette, as default_palette serves the same purpose
- save default platform theme, and restore it when switching away
from nightmode
- update macOS light/dark mode on theme switch
- fix unreadable menus on Windows

* update night-mode classes on theme change

This is the easy part - CSS styling that uses standard_css or our
css variables should update automatically. The main remaining issue
is JS code that sets colors based on the theme at the time it's run -
eg the graph code, and the editor.

* switch night mode value on toggle

* expose current theme via a store; switch graphs to use it

https://github.com/ankitects/anki/issues/1471#issuecomment-972402492

* start using currentTheme in editor/components

This fixes basic editing - there are still components that need updating.

* add simple xcodeproj for code completion

* add helper to get currently-active system theme on macOS

* fix setCurrentTheme not being immediately available

* live update tag color

* style().name() doesn't work on Qt5

* automatic theme switching on Windows/Mac

* currentTheme -> pageTheme

* Replace `nightModeKey` with `pageTheme`

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2021-11-25 07:17:41 +10:00
Damien Elmes
63404de5df prettier: don't depend on system node being available 2021-11-25 07:14:15 +10:00
Damien Elmes
7143e8f3d0 change previous card info shortcut
https://forums.ankiweb.net/t/option-i-shortcut-conflicts-with-language-input/15206
2021-11-24 15:44:25 +10:00
Damien Elmes
c20bc0a726 update translations 2021-11-24 14:44:02 +10:00
Damien Elmes
cb8c83a405 run ftl/remove-unused.sh 2021-11-24 14:44:02 +10:00
Damien Elmes
7f40d6d2a5 retire the v1 scheduler 2021-11-24 14:12:56 +10:00
Matthias Metelka
68092082f2
Change Notetype UI Rework (#1499)
* Enable access to old notetype name

* Set minimum height for ChangeNotetypeDialog

* Add bootstrap icons to change-notetype

* Move alert up and make it collapsible

* Tweak some CSS

- Add variables --sticky-bg and --sticky-border to StickyContainer
- Tweak base.css

* Add translatable string "(Nothing)"

* Rework ChangeNotetype screen

* Initially load option at newIndex and remaining options on focus

Optimization for big notetypes:
Should increase efficiency from O(n²) to O(n). Test on notetype with 500 templates shows significant improvement in load time (~10s down to ~1s).

* Try to satisfy rust test

* Change arrow direction depending on reading direction

+ add 0.5em top padding to main

* Create Alert.svelte

* Introduce CSS variable --pane-bg

* Revert "Initially load option at newIndex and remaining options on focus"

This reverts commit f42beee45c27dba9433d76217fb583b117fb5231.

* Final cleanup

* Refine padding/gutter
2021-11-24 12:09:55 +10:00
Henrik Giesel
97b28398ea
Fix some issues with new surround buttons (#1505)
* Add a store to indicate whether input trigger is active

Button state is then indicated by: caretIsInBold XOR boldTriggerActive

* Fix surrounding where normalization is tripped up by empty text nodes

* Add failing test for unsurrounding

* Fix failing test

* prohibitOverlapse does not need to be active, if aboveEnd is null

* Reinsert Italic and Underline button

* Refactor find-adjacent to use sum types

* Simplify return value of normalizeAdjacent
2021-11-24 10:33:14 +10:00
Henrik Giesel
4886f5772d
Fix Cloze button (#1504) 2021-11-24 10:25:24 +10:00
Damien Elmes
675155e025 minor wording tweaks and a docstring 2021-11-23 12:18:50 +10:00
evandrocoan
6d0f7e7f05
Fix issue 1362 and add a default favicon.ico (#1369) 2021-11-23 12:18:32 +10:00
Damien Elmes
7a556fb6ea remove experimental comment and update link 2021-11-23 11:13:04 +10:00
Damien Elmes
18b7691e2c drop beta tag from v3 scheduler
Will exit beta when 2.1.50 is released as stable
2021-11-23 11:10:04 +10:00
Arthur Milchior
74151ef60f
Remove all_names in notetypechooser (#1501)
The only purpose is to stop having warning in my console because all_names is deprecated
2021-11-23 10:27:57 +10:00
Henrik Giesel
2778b9220c
Mathjax editor improvements (#1502)
* Remove unnecessary stopPropagation of mathjax-overlay events

* Use CodeMirror component for MathjaxHandle

* Refactor ResizeObserver code in MathjaxHandle

* Wrap setRange in CodeMirror in try/catch

* Add Mathjax Editor bottom margin

* Add custom Enter and Shift+Enter shortcuts for the MathjaxHandle

* Format

* Move placeCaretAfter to domlib

* Move focus back to field after editing Mathjax

* Put Cursor after Mathjax after accepting

* Add delete button for Mathjax

* Change border color of mathjax menu

* Refactor into MathjaxMenu

* Put caretKeyword in variable

* Use one ResizeObserver for all Mathjax images

* Add minmimum width for Mathjax editor

* is still smaller than minimal window width

* Add bazel directories to .prettierignore and format from root

* exclude ftl/usage (dae)

the json files that live there are output from our tooling, and
formatting them means an extra step each time we want to update them

also exclude .mypy_cache, which is output by scripts/mypy*

* minor ftl tweak: newline -> new line  (dae)
2021-11-23 10:27:32 +10:00
Damien Elmes
3db3ae28af SELinux fixes
https://forums.ankiweb.net/t/anki-installer-for-linux-install-sh-should-change-file-owners-and-selinux-labels-while-installation/15143
2021-11-22 11:06:21 +10:00
Henrik Giesel
1a874b184d
Fix missing left margin in CongratsPage (#1498) 2021-11-19 11:02:54 +10:00
Damien Elmes
11042a16ce Fix latest Rusqlite on Windows
https://github.com/bazelbuild/rules_rust/pull/1025
2021-11-19 10:44:02 +10:00
Damien Elmes
8b3d964866 roll rusqlite back due to Windows breakage 2021-11-18 21:39:23 +10:00