Commit Graph

3139 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Damien Elmes
26123ce229 update to edition 2021 2021-11-18 20:51:10 +10:00
RumovZ
be0fe849c5
Fix close button for add cards dialog (#1496) 2021-11-18 07:22:23 +10:00
Abdo
65d10c2765
Add hotkey to save add-on config (#1492) 2021-11-17 07:18:48 +10:00
Abdo
a7afa15462
Fix duplicate conflicting add-on names being shown (#1489) 2021-11-14 11:36:32 +10:00
RumovZ
90e7ee2e18
Add fullscreen shortcut (#1488) 2021-11-14 11:35:43 +10:00
RumovZ
63316f763d
Make add cards dialog a main window (#1486)
Closes #980.
2021-11-14 11:33:59 +10:00
Damien Elmes
7a6acc83a5 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
Damien Elmes
5a9a03e65a 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
371f731e30
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
Henrik Giesel
c9bd39c6a2
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
896d11546b
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
Henrik Giesel
09c29219b4
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
Damien Elmes
aa9a79a545 fix scripts/mypy*
Broken in switch to rules_python
2021-10-30 09:14:43 +10:00
Damien Elmes
3843a4509e 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
a447c3eb12 fix broken startup on macOS due to incorrect mpv path 2021-10-30 09:14:43 +10:00
Damien Elmes
13de09d783 fix missing protobuf C extension on darwin-arm 2021-10-30 09:14:43 +10:00
RumovZ
f15fe9cf86
Disable renaming of no-flag item (#1467) 2021-10-30 09:08:51 +10:00
Damien Elmes
a5ed0b0bc7 ignore requested graphics driver on Qt6 for now 2021-10-29 19:34:05 +10:00
Damien Elmes
20c1a3af56 avoid printing compat warning on Qt5 2021-10-29 19:29:12 +10:00
Damien Elmes
94001273cc tweaks for Linux package 2021-10-29 19:26:35 +10:00
Damien Elmes
ba86502a27 tweaks for Windows package
- move audio tools into subfolder
- add buildmanifest.py
2021-10-29 18:11:28 +10:00
Damien Elmes
dc56b43c32 show warning instead of crashing when recording on darwin-arm64 2021-10-29 14:43:59 +10:00
Damien Elmes
83af294a8c rename some of the files in aqt/qt/ 2021-10-29 13:54:24 +10:00
Damien Elmes
b1dda8db64 add a flag to disable PyQt5 compat 2021-10-29 10:08:07 +10:00
Damien Elmes
21c03f67d0 fix missing icons in browse screen
Introduced in 7e8bbad55e
2021-10-29 10:08:07 +10:00
Damien Elmes
7e8bbad55e print a deprecation warning for old-style enums
https://github.com/ankitects/anki/pull/1440#issuecomment-948622876
2021-10-28 20:21:52 +10:00
Damien Elmes
492e515c18 use aqt.qt to (partially) mock the old PyQt5 module
We can't import the Qt5 libraries to do it - they are not usually
available, and it will lead to crashes if both are imported at once.
2021-10-28 20:17:18 +10:00
Aristotelis
2d1c058106
Maintain compatibility with PyQt5 add-ons in PyQt6 builds (#1440)
* Alias PyQt5 to PyQt6 on PyQt6 builds

Restores basic compatibility with PyQt5 add-ons

* Register QtCore early to work around sip error

* Monkey-patch unscoped enums that are in use by add-ons back in

Enums whose namespace moved with PyQt6 were determined using the tooling in https://github.com/qutebrowser/qutebrowser/issues/5904

Relevant enums for the Anki add-on ecosystem were found by grepping through all AnkiWeb add-ons and a selection of GitHub-released add-ons.

* Add full Qt.Key namespace

Maintains compatibility with add-ons that allow specifying key bindings via Qt.Key enums

* Reintroduce PyQt6.Qt as an alias for QtCore.Qt

* Alias classes shifted from QtWidgets to QtGui

* Add missing enums

Adds ≈200 enums that were missed during the initial grep

* Map exec_ calls to exec

* Tweak section headers

* Fix QtWebEngineWidgets imports failing due to delayed import

Addesses: "QtWebEngineWidgets must be imported before a QCoreApplication instance is created"

* Register additional aliases for top-level Qt modules

Given how we have had to deal with side-effects when not registering other aliased imports ahead of time, it seems safer to also register the remaining few with sys.modules.

* Handle calls to deprecated PyQt resource API graciously

* Create QtWebEngineWidgets aliases for classes moved to QtWebEngineCore

* Alias QShortcut

* Restore QWebEnginePage.view()

* Alias sip to PyQt6.sip

* Alias QtCore.QRegExp to QtCore.QRegularExpression

* Restructure aqt.qt into package

Pre-requirement for aliasing the PyQt5.Qt namespace correctly.

Should hopefully also make it easier to keep an overview as Qt-compat-related modules were proliferating.

* Properly alias PyQt5.Qt

PyQt5.Qt used to serve as a common namespace for all Qt classes, not just QtCore.Qt.*

While this changes does not make all classes accessible via PyQt5.Qt, it does so for the most important Qt submodules, which should cover most add-on breakages.

* Simplify Qt resource system legacy handling

* Also alias PyQt6.Qt

Covers imports of the form `from PyQt5 import import Qt` (due to previous aliasing of PyQt5 to PyQt6)

* Add missing enums

Better approach to grepping through add-ons yielded additional hits

* Run formatters

* Satisfy pylint
2021-10-28 19:57:42 +10:00
Damien Elmes
7e17f9e2ad ignore a spurious mypy error 2021-10-28 19:19:37 +10:00
Damien Elmes
568dbe798a make console optional on Windows 2021-10-28 18:57:21 +10:00
Damien Elmes
5a8e064a7d updated package scripts 2021-10-28 18:46:45 +10:00
Damien Elmes
b5e9eba26f use ResourceReader for serving bundled web files 2021-10-28 18:31:12 +10:00
Damien Elmes
3f321f08f1 add missing wheel/helper for darwin-arm64 2021-10-28 18:29:18 +10:00
RumovZ
9dc3cf216a
PEP8 for rest of pylib (#1451)
* PEP8 dbproxy.py

* PEP8 errors.py

* PEP8 httpclient.py

* PEP8 lang.py

* PEP8 latex.py

* Add decorator to deprectate key words

* Make replacement for deprecated attribute optional

* Use new helper `_print_replacement_warning()`

* PEP8 media.py

* PEP8 rsbackend.py

* PEP8 sound.py

* PEP8 stdmodels.py

* PEP8 storage.py

* PEP8 sync.py

* PEP8 tags.py

* PEP8 template.py

* PEP8 types.py

* Fix DeprecatedNamesMixinForModule

The class methods need to be overridden with instance methods, so every
module has its own dicts.

* Use `# pylint: disable=invalid-name` instead of id

* PEP8 utils.py

* Only decorate `__getattr__` with `@no_type_check`

* Fix mypy issue with snakecase

Importing it from `anki._vendor` raises attribute errors.

* Format

* Remove inheritance of DeprecatedNamesMixin

There's almost no shared code now and overriding classmethods with
instance methods raises mypy issues.

* Fix traceback frames of deprecation warnings

* remove fn/TimedLog (dae)

Neither Anki nor add-ons appear to have been using it

* fix some issues with stringcase use (dae)

- the wheel was depending on the PyPI version instead of our vendored
version
- _vendor:stringcase should not have been listed in the anki py_library.
We already include the sources in py_srcs, and need to refer to them
directly. By listing _vendor:stringcase as well, we were making a
top-level stringcase library available, which would have only worked for
distributing because the wheel definition was also incorrect.
- mypy errors are what caused me to mistakenly add the above - they
were because the type: ignore at the top of stringcase.py was causing
mypy to completely ignore the file, so it was not aware of any attributes
it contained.
2021-10-25 14:50:13 +10:00
Abdo
1fab547d46
Flip sidebar position for RTL languages (#1453) 2021-10-25 13:27:19 +10:00
Hikaru Y
b660e9d95e
Fix chooser label not being updated when current notetype/deck renamed (#1452)
* Switch to PEP 604 syntax

* Fix chooser label not being updated when current notetype/deck renamed

- fixes #1450
- fixes https://forums.ankiweb.net/t/deck-name-not-updated/14330
2021-10-25 13:23:06 +10:00
Damien Elmes
c930732a29 fix qt5/windows-only attribute reference in aqt/__init__.py 2021-10-25 09:42:32 +10:00
Damien Elmes
8cd905a35f remove a few unnecessary PyQt workarounds
https://www.riverbankcomputing.com/pipermail/pyqt/2021-October/044314.html
2021-10-24 14:24:35 +10:00
Damien Elmes
ee644e08a3 fixes and documentation for Linux ARM64
+ add qt6 dep to wheel install docs
+ remove x86_64 constraint on orjson
2021-10-23 15:22:24 +10:00
RumovZ
3cdb3d72c1
Do not bury suspended cards (#1447)
* Skip burying for suspended cards

* Inform about number of buried cards
2021-10-23 11:04:26 +10:00
Damien Elmes
a14eb6a1e8 improve PyQt install
- use a single script for all PyQt versions
- add hashes
- add a new ./run-qt5.14 script for testing with PyQt5.14
2021-10-23 10:56:17 +10:00
RumovZ
d665dbc9a7
PEP8 pylib (#1443)
* PEP8 scheduler/base.py

* PEP8 _backend/__init__.py

* PEP8 _backend/genbackend.py

* PEP8 _backend/genfluent.py

* PEP8 scheduler/__init__.py

* PEP8 __init__.py

* PEP8 _legacy.py

* PEP8 syncserver/__init__.py

- Make 'ip' a good name
- Overrule `global col` being identified as a constant

* PEP8 syncserver/__main__.py

* PEP8 buildinfo.py

* Implement `DeprecatedNamesMixin` for modules

* PEP8 browser.py

* PEP8 config.py

* PEP8 consts.py

* PEP8 db.py

* Format

* Improve AttributeError for DeprecatedNamesMixin

* print the line that imported/referenced the legacy module attr (dae)

* DeprecatedNamesMixinStandalone -> ...ForModule
2021-10-22 20:39:49 +10:00
Damien Elmes
048a9a2b60 vendor stringcase
It's a tiny library that has not been updated in years, and it was
leading to a warning on startup:

 DeprecationWarning: invalid escape sequence \W
  return re.sub("\W+", "", string)
2021-10-22 08:56:44 +10:00
Henrik Giesel
4678b12570
Fix Preview button not showing and cloze button not hiding (#1437) 2021-10-20 07:09:12 +10:00
Henrik Giesel
c2768e2188
Translate Editor entirely to Svelte (#1403)
* Translate editor to Svelte

Make editor fields grid rather than flexbox

Refactor ButtonToolbar margins

Remove remaining svelte.d.ts symlinks

Implement saveNow

Fix text surrounding

Remove HTML editor button

Clean up some empty files

Add visual for new field state badges

* Adds new IconConstrain.svelte to generalize the icon handling for
IconButton and Badge

Implement sticky functionality again

Enable Editable and Codable field state badges

Add shortcuts to FieldState badges

Add Shift+F9 shortcut back

Add inline padding back to editor fields, tag editor and toolbar

Make Editable and Codable only "visually hidden"

This way they are still updated in the background
Otherwise reshowing them will always start them up empty

Make empty editing area focusable

Start with moving fieldsKey and currentFieldKey to context.ts

Fix Codable being wrong size when opening for first time

Add back drag'n'drop

Make ButtonItem display: contents again

* This will break the gap between ButtonGroup items, however once we
  have a newer Chromium version we should use CSS gap property anyway

Fix most of typing issues

Use --label-color background color LabelContainer

Add back red color for dupes

Generalize the editor toolbar in the multiroot editor to widgets

Implement Notification.svelte for showing cloze hints

Add colorful icon to notification

Hook up Editable to EditingArea

Move EditingArea into EditorField

Include editorField in editor/context

Fix rebasing issues

Uniformly use SvelteComponentTyped

Take LabelContainer out of EditingArea

Use mirror-dom and node-store to export editable content

Fix editable update mechanism

Prepare passing the editing inputs as slots

Pass in editing inputs as slots

Use codable options again in codemirror

Delete editor/lib.ts

Remove CodableAdapter, Use more generic CodeMirror component

Fix clicking LabelContainer to focus

Use prettier

Rename Editable to ContentEditable

Fix writing Mathjax from Codable to Editable

Correctly adjust output HTML from editable

Refactor EditableStyles out of EditableContainer

Pass Image and Mathjax Handle via slots to Editable

Make Editable add its editingInputApi

Make Editable hideable

Fix font size not being set correctly

Refactor both fieldFocused and focusInCodable to focusInEditable

Fix focusIfField

Bring back $activeInput

Fix ClozeButton

Remove signifyCustomInput

Refactor MathjaxHandle

Refactor out some logic into store-subscribe

Fix Mathjax editor

Use focusTrap instead of focusing div

Delegate focus back to editingInput when refocusing focusTrap

Elegantly move focus between editing inputs when closing/opening

Make Codable tabbable

Automatically move caret to end on editable and codable

+ remove from editingInput api

Fix ButtonDropdown having two rows and missing button margins

Make svelte_check and eslint pass

Satisfy editor svelte_check

Save field updates to db again

Await editable styles before mounting content editable

Remove unused import from OldEditorAdapter

Add copyright header to OldEditorAdapter

Update button active state from contenteditable

* Use activateStickyShortcuts after waiting for noteEditorPromise

* Set fields via stores, make tags correctly set

* Add explaining comment to setFields

* Fix ClozeButton

* Send focus and blur events again

* Fix Codable not correctly updating on blur with invalid HTML

* Remove old code for special Enter behavior in tags

* Do not use logical properties for ButtonToolbar margins

* Remove getCurrentField

Instead use noteEditor->currentField or noteEditor->activeInput

* Remove Extensible type

* Use context-property for NoteEditor, EditorField and EditingArea

* Rename parameter in mirror-dom.allowResubscription

* Fix cutOrCopy

* Refactor context.ts into the individual components

* Move focusing of editingArea up to editorField

* Rename promiseResolve -> promiseWithResolver

* Rename Editable->RichTextInput and Codable->PlainTextInput

* Remove now unnecessary type assertion for `getNoteEditor` and `getEditingArea`

* Refocus field after adding, so subscription to editing area is refreshed
2021-10-18 22:01:15 +10:00
Damien Elmes
5e604df306 pip/ -> python/ 2021-10-18 19:50:40 +10:00
Damien Elmes
75932db734 enable eslint on aqt/data/web/js 2021-10-18 19:39:45 +10:00
Damien Elmes
89279f7f5e use ts_project for aqt/data/web/js
We're now ts_project only, and are less likely to run into issues
with future rules_nodejs updates.
2021-10-18 19:39:45 +10:00
RumovZ
8eed005db6 Use null for unset cardId 2021-10-18 09:11:00 +02:00
RumovZ
dc4f5adc44 Default to includeRevlog = true 2021-10-18 09:04:49 +02:00
RumovZ
ca57cb964c Format 2021-10-18 09:01:25 +02:00
RumovZ
b6104fa10b Use language that mypy understands 2021-10-18 09:01:25 +02:00
RumovZ
bbba21126f Improve clarity in card info code a tiny little bit 2021-10-18 09:01:25 +02:00
RumovZ
ec02a4218e Keep Card Info Dialog open even if no card is set 2021-10-18 09:01:24 +02:00
RumovZ
5062024974 Move update logic into CardInfo.svelte 2021-10-18 09:01:24 +02:00
RumovZ
1d63253b4f Make window titles more user-friendly 2021-10-18 09:01:23 +02:00
RumovZ
7eec241c82 Add utility func for setting window icon 2021-10-18 09:01:23 +02:00
RumovZ
f0d7e6f4d1 Use updating card infos in browser and reviewer 2021-10-18 09:01:23 +02:00
RumovZ
13024fcccc Add update handler for Card Info Dialog 2021-10-18 09:01:22 +02:00
RumovZ
859b1d1a39 Make Card Info Dialog non-modal 2021-10-18 09:01:22 +02:00
Damien Elmes
e58646909f get PyQt working directly with ./run on macOS
It's no longer necessary to copy everything into bazel-copy, and you
can safely remove that folder.
2021-10-16 18:07:29 +10:00
Damien Elmes
d0feffde74 avoid pulling qt5 in unless requested 2021-10-16 16:54:34 +10:00
Damien Elmes
281f1b2bf9 build all the UI files in one go
On macOS, the overhead of importing PyQt for each file far exceeds
any gains we get from incremental recompilation.
2021-10-16 09:20:20 +10:00
Damien Elmes
2c17105a35 use string replacements to generate Qt5 forms
They are mostly compatible, and this means a Qt5 install is not required
as part of the build process.
2021-10-16 08:59:09 +10:00
Damien Elmes
4a8e2bdc2d download wheels using rules_python 2021-10-15 16:02:26 +10:00
Damien Elmes
819ec40a3e update rules_python 2021-10-15 15:07:31 +10:00
Damien Elmes
b10aebc8b8 use separate header state for each Qt version
https://forums.ankiweb.net/t/new-toolkit-and-packaging-test-windows/14081/15
2021-10-15 13:15:38 +10:00
Damien Elmes
52642d693b drop PyAudio support
I do not recall anyone reporting that it worked better than the Qt
implementation for them, and the lack of recent wheels on PyPI is a pain.
We can always add it back in the future if enough people come out of
the woodwork to report they were using it.
2021-10-15 13:15:16 +10:00
Damien Elmes
7962c8107f qt recording support for qt6
+ fix inefficient bytes concatenation
2021-10-15 12:57:19 +10:00
Damien Elmes
2e9b4b3454 hide the video driver selection in qt6 2021-10-15 12:57:19 +10:00
Damien Elmes
e2c8dc92c1 fix placeholder text color on win/lin 2021-10-15 12:57:19 +10:00
Damien Elmes
58d17a51f3 fix incorrect web background color being picked up in qt6+win/lin 2021-10-15 12:57:19 +10:00
Damien Elmes
0d246c9e0b update wheel definitions to require Python 3.9; make PyQt optional
While we do require PyQt, it's not possible to declare that we require
either 5 or 6, and so we need to mark it as optional. Instead, we
provide optional dependencies, so the user can e.g. 'pip install aqt[qt6]'
2021-10-15 12:57:19 +10:00
Damien Elmes
36fdc607c6 add run-qt5 script to run with 5.x 2021-10-15 12:57:19 +10:00
Damien Elmes
a7812dedc0 switch to new-style PyQt scoped enums and Qt6
The enum changes should work on PyQt 5.x, and are required in PyQt 6.x.
They are not supported by the PyQt5 typings however, so we need to run
our tests with PyQt6.
2021-10-15 12:57:19 +10:00
Damien Elmes
b0272f0336 generate pyqt6 forms 2021-10-15 12:57:19 +10:00
Damien Elmes
dfcefaebe3 miscellaneous pyqt6 compat fixes
- add a few gates for qt5-specific behaviour
- prepare for some changes to the typings in qt6
- map pickled Qt5 ByteArrays to Qt6 when running Qt6
2021-10-15 12:57:19 +10:00
Damien Elmes
4d0a915610 move QtAudioInputRecorder into separate PyQt5-only file
New API required for PyQt6.
2021-10-15 10:47:53 +10:00
Damien Elmes
1701937cba expose pyqt6 packages - not yet used 2021-10-15 10:47:53 +10:00
Damien Elmes
2a3072191f avoid importing directly from PyQt5 where possible 2021-10-15 10:47:53 +10:00
Damien Elmes
5f19d39f15 add ready-research to about screen 2021-10-14 21:02:44 +10:00
evandrocoan
2a12d44b34
Increased max visible items from clayout_top.ui (#1425)
10 is too small for big decks.
2021-10-14 19:36:04 +10:00
Damien Elmes
e8c5802a96 pass sole arg to cardStats as a dictionary
Easier to extend in the future, or (de)serialize in a strongly-typed
language.
2021-10-14 19:28:51 +10:00
RumovZ
3672b0fe73
Switch CardInfoDialog to ts page (#1414)
* Only collect card stats on the backend ...

... instead of rendering an HTML string using askama.

* Add ts page Card Info

* Update test for new `col.card_stats()`

* Remove obsolete CardStats code

* Use new ts page in `CardInfoDialog`

* Align start and end instead of left and right

Curiously, `text-align: start` does not work for `th` tags if assigned
via classes.

* Adopt ts refactorings after rebase

#1405 and #1409

* Clean up `ts/card-info/BUILD.bazel`

* Port card info logic from Rust to TS

* Move repeated field to the top

https://github.com/ankitects/anki/pull/1414#discussion_r725402730

* Convert pseudo classes to interfaces

* CardInfoPage -> CardInfo

* Make revlog in card info optional

* Add legacy support for old card stats

* Check for undefined instead of falsy

* Make Revlog separate component

* drop askama dependency (dae)

* Fix nightmode for legacy card stats
2021-10-14 19:22:47 +10:00
zhangsn
7c74f7805b
add new hook: add_cards_did_change_deck (#1420)
* add new hook which will be executed after the user selects a new different deck when adding cards.

* Update qt/aqt/deckchooser.py
2021-10-12 17:55:21 +10:00
Damien Elmes
a403b957cc fix error in webview __del__ on shutdown 2021-10-12 17:07:07 +10:00
Damien Elmes
4e405f1cc3 remove unused locale_dir 2021-10-12 16:27:57 +10:00
Damien Elmes
d9bff1e8ce provide root_path to flask
Flask tries to look up root_path using __file__, which may not be
available. It's used for static file hosting and templates, neither
of which we use.
2021-10-12 16:27:57 +10:00
Damien Elmes
c01ced6ecb remove unused moduleDir 2021-10-12 16:27:57 +10:00
Damien Elmes
d33c66e195 change setHtml() to serve content via media server
- fixes https://forums.ankiweb.net/t/deck-list-is-blank/2241/2
- fixes the security warnings on Qt 6, by ensuring our pages and
resources are coming from the same origin
2021-10-12 16:27:03 +10:00
Damien Elmes
4b5004c472 refactor mediasrv request processing
_redirectWebExports was doing more than it was originally intended for,
and it was difficult to follow.
2021-10-12 16:22:09 +10:00
Damien Elmes
70dbd06be3 add qtmajor qualification to version checks; update outdated min ver 2021-10-12 16:20:33 +10:00
Damien Elmes
46a1cc575c update a deprecated API call in clayout 2021-10-12 16:20:12 +10:00
Damien Elmes
974378f2be remove old unused build_ui.sh 2021-10-12 16:19:27 +10:00
Damien Elmes
b85ee30c70 stop migrating from old folder locations
Closes #1390
2021-10-12 16:18:31 +10:00
Damien Elmes
c39a5e17e8 Revert "Merge pull request #610 from evandroforks/ask_confirmation_before_moving_anki_collection"
This reverts commit a53aac40f8, reversing
changes made to e323a8f902.

Migration is about to be dropped (#1390), and the references to modules
like QtGui complicate a PyQt5/6 shim.
2021-10-12 16:18:24 +10:00
Damien Elmes
aaceeec25a Revert "Allow copying of images using context menu"
This reverts commit d5b3927d0b.

This approach no longer appears to work in Qt6. There is a
QWebEngineView.lastContextMenuRequest() that may work, though whether
onCopy() qualifies as "during contextMenuEvent" is not clear.

https://doc.qt.io/qt-6/qwebengineview.html#lastContextMenuRequest
2021-10-12 16:18:24 +10:00
Damien Elmes
aabf693bb8 Revert "Allow <audio> to play without user interaction in accordance to autoplay setting"
This reverts commit 54f51da944.

This breaks in the PyQt6 upgrade. There are no globals anymore, only
page profiles - but the code should probably be modifying a specific
webview instead of globals anyway.
2021-10-12 16:18:24 +10:00
Damien Elmes
69c196b409 .exec_() -> .exec()
The former is not supported in PyQt6
2021-10-12 16:17:37 +10:00
Damien Elmes
e9d0e672cf update runtime Python version check 2021-10-12 16:17:23 +10:00
Damien Elmes
e357dbf6b3 use Qt search path instead of resource system
Means URLs like :/icons/foo.jpg should become icons:foo.jpg

This is part of the prep work for a PyQt6 update. PyQt6 has dropped
pyrcc, so we can longer generate the icons_qrc.py file we did previously.

Qt Designer expects us to use the resource system, so we continue to
generate the icons.qrc file to make editing the UI files easier. But at
runtime, we no longer use that file.
2021-10-12 16:17:08 +10:00
Abdo
ebe7125e81
Fix deck change after toggling sticky fields (#1415) 2021-10-09 10:26:10 +10:00
Henrik Giesel
c64bac57a6
Put sass into repo directory (#1409)
Fix Sass build
2021-10-09 10:25:03 +10:00
Damien Elmes
3814385e41 add trailing newline to profiles readme
closes #1407
2021-10-07 13:31:44 +10:00
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
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
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
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
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
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
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
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
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
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
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
Damien Elmes
2a2469e7a2 Revert "Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file""
This reverts commit a2ac197fd786b31880c8334735b4a2d6bd76b0bd.

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
96798f018a
Merge pull request #1382 from RumovZ/tags-from-sidebar
Tags from sidebar
2021-09-27 18:41:32 +10:00
Damien Elmes
339fd159aa
Merge pull request #1388 from lolilolicon/patch-1
Quote $PREFIX properly for paths with spaces
2021-09-27 18:39:25 +10:00
RumovZ
f89811870e 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
18f0d026b5 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
f54f15cd44 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
3a8c494544 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
73ec0a2b2e 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
2b5bf23bbd Check 'index.isValid()' in 'table.model' 2021-09-25 15:21:06 +02:00
Soren Bjornstad
67f9fc519e Add hook after selecting a new note type in the add window 2021-09-24 21:54:33 -05:00
lolilolicon
ae7693a8a7
Quote $PREFIX properly for paths with spaces 2021-09-23 01:24:52 +00:00
lolilolicon
383cd44119
Quote $PREFIX properly for paths with spaces 2021-09-23 01:20:53 +00:00
hikaru-y
fc232eb0f7 Fix memory leak in previewer
Related thread:
https://forums.ankiweb.net/t/high-memory-usage-over-time-on-2-1-44/13544/
2021-09-22 17:21:08 +09:00
RumovZ
75f210a66c Enable adding/removing tags from the sidebar ...
... to selected notes.
2021-09-21 11:48:43 +02:00
Damien Elmes
d091a547a4
Merge pull request #1375 from RumovZ/disable-actions
Disable unusable browser actions on row change
2021-09-21 18:38:30 +10:00
Damien Elmes
81a8fe039b
Merge pull request #1379 from BlueGreenMagick/dont-fill-empty-on-add-cards
set CardLayout fill_empty=False for add cards editor
2021-09-21 15:08:54 +10:00
Damien Elmes
1ceb9965ad add hidden option to disable tooltips in browse screen
https://forums.ankiweb.net/t/browser-text-pop-up-when-hovering-over-card-poll/13254
2021-09-21 15:03:37 +10:00
Damien Elmes
9720592519 temporary fix for error on deleting (#1374) 2021-09-20 22:02:44 +10:00
Damien Elmes
66fc9cdbd8 add startup message about forcing Wayland 2021-09-20 21:42:16 +10:00
Damien Elmes
cdad1efdcf Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file"
This reverts commit c05475a49e54ed7a56bc635e5e5528334d4ba6ac.

Revert "possible fix for reported audio issues"

This reverts commit f00f7f099f.

Reverting in case https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/10
is related to this change. If the issue persists, we'll know this was
not the cause.
2021-09-20 21:39:15 +10:00
bluegreenmagick
f3db3fa768 set CardLayout fill_empty=False for add cards editor
Card layout view functions as a previewer in add cards dialog
so displaying accurately is more important than having placeholders.
Especially for card layouts using conditional-not fields {{^Field}}
card layout is rendered badly.
2021-09-20 18:34:49 +09:00
RumovZ
94b261f1ef Simplify sidebar context menu separators
Qt can collapse consecutive menu separators, so no need to check if a
subroutine has actually added any actions to the menu.
2021-09-19 18:33:36 +02:00
RumovZ
40bad0f65d Disable unusable browser actions on row change 2021-09-17 16:16:34 +02:00
Damien Elmes
f00f7f099f possible fix for reported audio issues
https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/6

This is the only area of the sound code that has changed since 2.1.47
2021-09-16 10:27:37 +10:00
Henrik Giesel
c227c7dc39 Make StickyBottom actually stick and make editor fullsize + flexbox 2021-09-15 15:21:37 +02:00
Henrik Giesel
cd36fe2518 Correctly include editable css 2021-09-15 13:32:31 +02:00
Henrik Giesel
9b2378c3d2 Introduce editable module 2021-09-15 13:32:30 +02:00
Damien Elmes
9daf037c0b
Merge pull request #1264 from hgiesel/tageditor2
Svelte Tag Editor v2
2021-09-15 20:21:16 +10:00
evandrocoan
7e32e4efd5 Fix previous card attribute not initialized 2021-09-13 23:16:25 -03:00
Damien Elmes
926f0c7929 disable wayland again, but allow enabling it
Will add an entry to the known issues page.
2021-09-14 09:53:23 +10:00
Damien Elmes
18bd821a1f preserve focus on notetype change
Closes #1360
2021-09-13 15:31:24 +10:00
Damien Elmes
806fb0f102 allow wayland again
See #1368
2021-09-13 15:18:32 +10:00
Damien Elmes
b877026248 don't check state of current card when repositioning
closes #1365
2021-09-13 14:56:53 +10:00
Damien Elmes
bbd7d057d8
Merge pull request #1358 from evandroforks/lastcardinfo
Add option to reveal previous card's info
2021-09-13 12:06:10 +10:00
evandrocoan
c7cff516e4 Add clone stdin to another _process deletion 2021-09-09 18:36:21 -03:00
Henrik Giesel
ae225f9569 Remove hiding Qt autocompleter from AddCards 2021-09-09 15:38:10 +02:00
Damien Elmes
4da1c77220 add basic tag completion to backend
Matches should arrive in alphabetical order. Currently results are not
capped (JS should be able to handle ~1k tags without too much hassle),
and no reordering based on match location is done. Matches are substring
based, and multiple can be provided, eg "foo::bar" will match
"foof::baz::abbar".

This is not hooked up properly on the frontend at the moment -
updateSuggestions() seems to be missing the most recently typed character,
and is not updating the list of completions half the time.
2021-09-09 15:38:08 +02:00
Henrik Giesel
5505925e64 Remove Python TagEdit from Editor view 2021-09-09 15:37:48 +02:00
Henrik Giesel
5575482e38 Save tags back to Python 2021-09-09 15:37:47 +02:00
Henrik Giesel
375a96e263 Set tags from Python 2021-09-09 15:37:47 +02:00
Henrik Giesel
f056851c1e Port Focus tags shortcut to webview 2021-09-09 15:37:34 +02:00
Henrik Giesel
1026d26793 Display a tag-outline icon in the bottom left 2021-09-09 15:37:33 +02:00
evandrocoan
23891918cb Use Alt+i for previous/last card info because Ctrl+i could
easily confuse a user that Ctrl+i is for the current card.
Ctrl was first added because it is easier to press,
at least for me, then, I press first using Ctrl and if
not available go to Alt.
2021-09-08 21:26:48 -03:00
evandrocoan
133e22dbe4 Fix ResourceWarning: unclosed file <_io.BufferedWriter name=5>
https://forums.ankiweb.net/t/aqt-sound-py-resourcewarning-unclosed-file-io-bufferedwriter-name-5/13070
2021-09-08 21:02:12 -03:00
evandrocoan
e295c4ccfb Fix #1355 2021-09-07 23:53:47 -03:00
Ren Tatsumoto
de974f94db avoid possible performance hit 2021-09-05 16:10:34 +03:00
Ren Tatsumoto
7451ad68b1 fix test complaints 2021-09-05 15:04:24 +03:00
Ren Tatsumoto
9ff37d9baa Add a hook for modifiying pasted MIME data 2021-09-05 13:52:54 +03:00
Damien Elmes
1ae45c5445 quote fonts added via the Add Field dialog 2021-09-02 21:05:16 +10:00
Damien Elmes
ab20f215b1
Merge pull request #1349 from RumovZ/rename-with-parents
Disable 'Rename with Parents' for top-level items
2021-08-30 22:27:44 +10:00
RumovZ
d044360ff9 Disable 'Rename with Parents' for top-level items 2021-08-30 11:10:14 +02:00
RumovZ
3c53a961a3 Reset flags when loading a profile...
... not only on startup.
2021-08-30 11:07:40 +02:00
Damien Elmes
dc156f3471
Merge pull request #1344 from glutanimate/add-dialog-manager-hooks
Add a hook for subscribing to dialog creation / opening
2021-08-29 11:36:11 +10:00
Damien Elmes
395119bafe
Merge pull request #1345 from hgiesel/windowsfocus
Use different artificial reviewer button highlight for Windows
2021-08-29 11:35:32 +10:00
Damien Elmes
e4f8ba000e more checks for package name
Follows up #1343
2021-08-29 11:23:47 +10:00
Henrik Giesel
3b90b27095 Use different artificial reviewer button highlight for Windows 2021-08-28 21:30:07 +02:00
Glutanimate
5eac3b9061 Add a hook for subscribing to dialog creation / opening 2021-08-28 20:37:31 +02:00
bluegreenmagick
20424a7ef7 Fix bug when add-on package string is ""
which deleted the entire add-on folder
2021-08-27 21:49:55 +09:00
Damien Elmes
94a0355389 avoid spurious warning in addcards startup 2021-08-20 11:37:23 +10:00
Damien Elmes
886ce15f27 mark old editing code as deprecated
https://forums.ankiweb.net/t/emacs-style-shortcuts-with-ctrl-t-in-the-editor-in-45/12280/6
2021-08-20 11:37:11 +10:00
Damien Elmes
f6ae0b73be show v3 scheduler in error info 2021-08-20 10:47:41 +10:00
Damien Elmes
79cf49f38d fix default deck being shown in deck options deck prompt 2021-08-19 12:33:36 +10:00
Damien Elmes
d92913eb8c preferences update needs to be a collection op
- fixes https://forums.ankiweb.net/t/v3-bug-card-modified-without-updating-queue/12418
- fixes undo menu not updating after closing preferences screen
2021-08-19 10:47:55 +10:00
Damien Elmes
b9d42af423 add a small .wait() after terminating player process
Avoids python3.8/subprocess.py:942:
ResourceWarning: subprocess 90387 is still running
  _warn("subprocess %s is still running" % self.pid,
2021-08-19 10:33:56 +10:00
Damien Elmes
79fbf9ad3e
Merge pull request #1333 from kelciour/mpv-property-list-timeout
A possible fix for "mpv timed out, restarting"
2021-08-18 16:39:50 +10:00
Damien Elmes
273be14fd3
Merge pull request #1331 from hikaru-y/fix-fragment-autoplay
Fix <audio>/<video> with 'autoplay' issue
2021-08-18 16:37:14 +10:00
Damien Elmes
5296bf0a00 shift timebox check to post-answer
- should prevent non-review actions from triggering display
- should prevent next card's audio from playing before diag. dismissed
- the timer hack should no longer be required, as the webview will
have already been loaded

https://forums.ankiweb.net/t/timebox-pop-up-suddenly-appears-when-daily-cutoff-hour-rolls-over-even-when-not-in-the-reviewer/12385
2021-08-18 16:25:23 +10:00
Damien Elmes
546d32cfda ctrl+alt+n for forget
https://forums.ankiweb.net/t/anki-2-1-44-make-cards-new/12247/7
2021-08-18 15:32:45 +10:00
Damien Elmes
40c1a86a25 add symlink to generated icons.qrc
Otherwise Qt Designer tries to remove the reference.
2021-08-18 15:32:45 +10:00
kelciour
fae816e68e A possible fix for "mpv timed out, restarting"
https://forums.ankiweb.net/t/anki-wont-open-mpv-timed-out/7579/6
2021-08-18 00:47:04 +03:00
hikaru-y
dd9528aa73 Silence 'link preload' warning on the first card
Due to 207e425, a harmless warning about 'link preload' will be output
to the console on the first card.
2021-08-18 02:25:51 +09:00
Arthur Milchior
7568eda031 Add Card history: keep & instead of replacing them by underline 2021-08-15 06:32:03 +02:00
Damien Elmes
57f3d300bb fix deprecation warning in modelchooser.py 2021-08-04 12:05:11 +10:00
Damien Elmes
5de3918dbf fix notetype selection in import screen
Accidental rename in "PEP8 cards.py"
2021-08-04 12:01:28 +10:00
Damien Elmes
fc931c3edb fix redo menu item showing undo text 2021-08-04 10:28:45 +10:00
Henrik Giesel
357a6c5cc6 Add toggle sticky shortcuts F9 and Shift+F9 2021-08-03 05:52:07 +02:00
Damien Elmes
87f9bd8021
Merge pull request #1320 from hgiesel/colorpickerplus
Remember last text and highlight color again
2021-08-03 09:07:46 +10:00
Henrik Giesel
4db7cebf62 Remember last text and highlight color again 2021-08-02 23:12:00 +02:00
Damien Elmes
528343b417
Merge pull request #1319 from abdnh/sidebar-scroll-center
Use PositionAtCenter for sidebar scrolling
2021-08-02 18:35:38 +10:00
Damien Elmes
f0b8b10314
Merge pull request #1311 from hikaru-y/flag-mark-icons-in-previewer
Show flag and mark icons in previewer
2021-08-02 18:33:36 +10:00
abdo
ad6f5c7404 Use PositionAtCenter for sidebar scrolling 2021-08-02 10:57:54 +03:00
Damien Elmes
c6c9721c53 update congrats screen periodically; automatically move back to study 2021-08-02 16:05:18 +10:00
Damien Elmes
d077d9509a fix study deck->add deck->cancel 2021-07-30 11:35:55 +10:00
Damien Elmes
68dddfe93b prevent hiding of sidebar
https://forums.ankiweb.net/t/browser-format-issues/11504/10
2021-07-28 11:14:09 +10:00
hikaru-y
80e15ff6aa Show flag and mark icons in previewer 2021-07-26 20:13:42 +09:00
Damien Elmes
03e76d522a reload card if there are registered hooks
https://forums.ankiweb.net/t/2-1-45-release-candidate/11362/54
2021-07-26 20:48:30 +10:00
Damien Elmes
4e133e7d8a
Merge pull request #1303 from Arthur-Milchior/paste_post_hook
Add a hook to execute after pasting in a field
2021-07-26 11:01:29 +10:00
RumovZ
a7315732f6 Prevent DeckChooser from setting filtered deck 2021-07-25 08:54:39 +02:00
Arthur Milchior
3dbe44217b Add a hook to execute after pasting in a field
I expect to use it to ensure that images are resizable after they get pasted in a field
2021-07-25 01:53:25 +02:00
Damien Elmes
e7189f4af5 fix ugly js confirm box
https://forums.ankiweb.net/t/2-1-45-release-candidate/11362/2
2021-07-24 22:04:06 +10:00
Damien Elmes
cd9f8d883c clarify deck description message
+ drop the reference to overview screen
2021-07-24 21:45:09 +10:00
Damien Elmes
7043e6f6f3 drop traceback in importing error message 2021-07-24 20:05:32 +10:00
Damien Elmes
e1f9d0fc1b fix Python lints 2021-07-23 20:22:32 +10:00
RumovZ
f2f19e8b45 Remove native HelpPage enum
Also remove oneof from pb enum and handle strs in Python.
2021-07-22 16:32:49 +02:00
RumovZ
d8d69a3810 Switch frontend to use backend links 2021-07-22 10:07:13 +02:00
RumovZ
0d45df8551 Fix browser search completer
Adding an empty entry at the top fixes
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/45
and allows for scrolling back to an empty line.
2021-07-17 12:23:19 +02:00
Damien Elmes
cba0735c59
Merge pull request #1297 from hgiesel/browsershortcuts
Allow Using Ctrl+Shift+P from Browser when focusing Qt components
2021-07-17 15:18:36 +10:00
Henrik Giesel
22e735266e Remove unnecessary lambda 2021-07-17 04:17:28 +02:00
Henrik Giesel
fb56576e36 Allow Using Ctrl+Shift+P from Browser when focusing Qt components 2021-07-17 03:39:27 +02:00
Damien Elmes
ce5f9bb9b0
Merge pull request #1292 from hgiesel/reviewerplus
Move reviewer to ts/reviewer v2
2021-07-17 09:10:14 +10:00
hikaru-y
16a1eb05a2 Revert "Follow-up to #1271 (Preload answer images)" 2021-07-16 23:57:49 +09:00
Henrik Giesel
272f2f7d1a Revert to MathJax through script tag 2021-07-16 16:56:57 +02:00
Henrik Giesel
ddf3adfc8e Remove protobuf important from reiewer (no longer necessary (?)) 2021-07-16 16:56:56 +02:00
Henrik Giesel
05771b7598 Include MathJax over ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
5cbb582d0b Export jquery via ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
68ac505d81 Include css-browser-selector via ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
f203562c58 Include protobuf in clayout and browser (p)reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
afa8f8a6f0 Export getTypedAnswer 2021-07-16 16:56:56 +02:00
Henrik Giesel
af12756980 Move reviewer to ts/reviewer 2021-07-16 16:56:55 +02:00
Damien Elmes
87185d5365
Merge pull request #1288 from evandroforks/clayout_next_card_shortcut
Created shortcut to switch between card types on clayout.py
2021-07-16 10:51:40 +10:00
Damien Elmes
96e6e216a7
Merge pull request #1293 from RumovZ/find-and-replace
Find & Replace
2021-07-16 10:47:16 +10:00
Damien Elmes
e97c381a6f Revert "stop (un)escaping media filenames"
This was flawed - while non-Latin text is now acceptable
in an IRI, we still need to be concerned with reserved characters
such as spaces, and Anki unfortunately has been storing the filenames
in unencoded form in the DB, meaning we must encode them at display
time. We won't be able to move away from this until existing notes
are rewritten, and it will probably require breaking compatibility with
older clients.

https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier

This reverts commit 14110add55.
2021-07-16 10:37:59 +10:00
evandrocoan
85c236a417 Created shortcut to switch between card types on clayout.py
editor window (F3 and F4) because it should be simple to use them
single hand and together with Ctrl+1, 2 and 3 combos.
2021-07-15 20:51:08 -03:00
RumovZ
9f777ad009 Remove redundant QueryOp in rename_deck() 2021-07-15 08:56:47 +02:00
Damien Elmes
33afe8aa32 support numpad enter in type answer
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/149

regression introduced in f4f0298378
2021-07-15 14:46:39 +10:00
RumovZ
3a1f8d4241 Remove unused name prefix of sidebar templates 2021-07-13 16:41:50 +02:00
RumovZ
eab51dce40 Add sidebar actions
- Find & Replace for notetype fields
- Rename with Parents for decks and tags
2021-07-13 16:34:02 +02:00
RumovZ
a5193339e7 Rework Find & Replace dialog:
- Add option to affect whole collection
- Allow to open without selection
- Add parameter for presetting field
2021-07-13 16:33:45 +02:00
Damien Elmes
780a254ac8
Merge pull request #1291 from RumovZ/addon-cols
Show key of unknown browser columns
2021-07-13 13:35:54 +10:00
RumovZ
51af0ba7d4 Show key of unknown browser columns 2021-07-12 19:03:51 +02:00
RumovZ
e24f562f8c Add mock browser model to support legacy resetting 2021-07-12 12:36:26 +02:00
Damien Elmes
e61a611af7 rename Config in protobuf to avoid conflict with module name
+ use the enum directly, instead of wrapping it in an object

Python code retains the old "Config" name.
2021-07-11 19:27:08 +10:00
Damien Elmes
7ac1fa17e6 move proto files into separate py_library in same namespace
Will allow importing the Protobuf without pulling in the rest of
the library. This is not a full PEP420 namespace, and the wheel still
bundles everything - it just makes things easier in a Bazel workspace.
I originally tried with PEP420, but it required more invasive changes,
and I ran into issues with mypy.
2021-07-11 14:51:25 +10:00
Damien Elmes
616db33c0e refactor protobuf handling for split/import
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:

- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.

The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.

The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.

Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
2021-07-10 19:17:05 +10:00
Damien Elmes
1d4b58419e add workaround for protobufjs requiring uppercase package names
I mourn the time lost trying to track this down :-(

https://github.com/protobufjs/protobuf.js/issues/1014

We can't patch the minified file in dist without essentially duplicating
it, so this change also switches from the external file to including
the src file as part of the bundle.
2021-07-10 15:24:01 +10:00
Damien Elmes
c322f68ab8 more friendly message for v2 import into v1 2021-07-08 10:32:27 +10:00
Damien Elmes
44ef810f67
Merge pull request #1277 from RumovZ/config-keys
Add constants for literal config keys
2021-07-07 09:14:40 +10:00
RumovZ
5067622751 Add pylib/browser.py for literal config keys
Also, remove config bools for sort order.
2021-07-05 12:44:48 +02:00
hikaru-y
09d1cc08c6 Follow-up to #1271
- remove no-longer-required 'escape_media_filenames()' 14110add
- clean up previewer.py
2021-07-05 01:13:17 +09:00
Damien Elmes
581c3e2486
Merge pull request #1273 from hgiesel/macshortcuts
Execute Ctrl+C/V/X/A via execCommand in editor
2021-07-04 16:02:52 +10:00
Damien Elmes
a54f181ae0 remove old Mac shortcut code completely
The shortcuts seem to work correctly without it on Qt 5.14, so this
code seems to have only been required for older Qt releases.
2021-07-04 16:00:23 +10:00
Damien Elmes
209a646d63
Merge pull request #1271 from hikaru-y/preload-images
Preload answer images
2021-07-04 15:50:55 +10:00
Damien Elmes
1e57693b36
Merge pull request #1270 from RumovZ/flag-manager
Add flag manager and hook
2021-07-04 15:45:11 +10:00
Damien Elmes
14110add55 stop (un)escaping media filenames
Back in the WebKit days, images with Unicode filenames would fail to
appear if they weren't percent-escaped. This no longer seems to be the
case - with this patch, images appear correctly on the Mac and Windows
platforms I tested with.

Fixes https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/96
Fixes #1219
2021-07-04 15:27:29 +10:00
hikaru-y
9782d39ced Preload images to be displayed on answer side 2021-07-03 21:33:00 +09:00
Henrik Giesel
5989fb8ef6 Satisfy qt formatter 2021-07-03 01:54:10 +02:00
Henrik Giesel
7f7e5c2702 Execute Ctrl+C/V/X/A through execCommand in editor (so we can customize it) 2021-07-03 01:48:49 +02:00
RumovZ
a5dacf0d0a Add flag manager and hook
'FlagManager' allows cached access to the flag objects, takes care of
renaming flags and notifies GUI components with the hook
'flag_label_did_change'.
2021-07-02 11:16:10 +02:00
Henrik Giesel
24af5bada3 More uniform file naming
kebap-case for .ts, .scss, .html, and directories
2021-07-01 12:24:16 +02:00
Henrik Giesel
8edcc54aae Add flag icons from mdi after all
- This way, we can also use their modifier versions with little pluses/minuses
2021-07-01 01:16:50 +02:00
Henrik Giesel
bcfbd2f680 Remove multiple icons, new notetype/cardtype icons 2021-07-01 01:12:11 +02:00
Henrik Giesel
fe7057b3f2 Remove name_prefix from field sidebar item 2021-06-30 21:02:23 +02:00
Henrik Giesel
0156af268e Add missing type hint 2021-06-30 21:02:23 +02:00
Henrik Giesel
803295341e Replace card state and clock icon 2021-06-30 21:02:23 +02:00
Henrik Giesel
39075039de Replace saved search icon 2021-06-30 21:02:23 +02:00
Henrik Giesel
aacf20531e Add NOTETYPE_FIELD sidebar items 2021-06-30 21:02:23 +02:00
Henrik Giesel
6f201bdfe4 Add notetype icons 2021-06-30 21:02:23 +02:00
Henrik Giesel
da69a5e352 Add new icons for decks 2021-06-30 21:02:23 +02:00
Henrik Giesel
dedddd7f8d Add tag_multiple icon 2021-06-30 21:02:23 +02:00
Damien Elmes
45b790ec3c minor follow-up to #1257
No need for a separate argument, as we only want to scroll when
searching.
2021-06-29 11:53:10 +10:00
Damien Elmes
f8f6b828aa
Merge pull request #1257 from abdnh/sidebar-scroll-to-first-match
Scroll to first sidebar search match
2021-06-29 11:44:28 +10:00
Damien Elmes
ecabf35350 use inner function instead of return value in _expand_where_necessary() 2021-06-29 11:40:59 +10:00
abdo
33e6662dda Scroll to first sidebar search match 2021-06-28 14:44:09 +03:00
RumovZ
19a36414e8 Fix id check for today and card state items 2021-06-28 12:55:59 +02:00
Damien Elmes
8942677c4b
Merge pull request #1252 from RumovZ/fix-tag-expand
Fix expanding/collapsing tags triggering refresh
2021-06-27 18:45:29 +10:00
Damien Elmes
1b15069b24 PEP8 collection.py 2021-06-27 15:12:22 +10:00
Damien Elmes
17533e6a78 PEP8 models.py 2021-06-27 14:30:00 +10:00
Damien Elmes
62c23c6816 PEP8 decks.py 2021-06-27 14:02:48 +10:00
Damien Elmes
2a93355824 PEP8 cards.py 2021-06-27 12:12:23 +10:00
Damien Elmes
fee486aaa1 PEP8 notes.py
An example of how we can start migrating the codebase to PEP8:

- enable invalid-name at the top
- use bazel run pylib:pylint to identify names that need renaming
- use PyCharm or similar to rename the functions/variables
- in the cases where the conversion is not just snake_case, use
.register_deprecated_aliases()

+ removed the __repr__() definition, it dumps all the note content
and obscures the error message
2021-06-26 11:38:59 +10:00
Damien Elmes
0ddd316388 add a helper so we can get semi-automatic camelCase conversion 2021-06-26 11:33:35 +10:00
Damien Elmes
7e358707e5
Merge pull request #1254 from RumovZ/sidebar-menu-hook
Add hook "browser_sidebar_will_show_context_menu"
2021-06-26 08:42:59 +10:00
Damien Elmes
7099b6ea49 revert to % format string to avoid breaking add-on
partially reverts d8c3e71105

https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/50
2021-06-26 08:39:16 +10:00
Damien Elmes
fb5e8d5f3b fix error when user confirms adding cloze to basic type 2021-06-26 08:35:24 +10:00
RumovZ
17009638c1 Add hook "browser_sidebar_will_show_context_menu" 2021-06-25 17:01:17 +02:00
RumovZ
72146c4b22 Fix expanding/collapsing tags triggering refresh 2021-06-24 17:27:53 +02:00
hikaru-y
ac47ef54a2 Set background-color of body to var(--window-bg)
required to emulate day mode in clayout
if background-color is not set in .card styling
2021-06-24 23:47:14 +09:00
hikaru-y
342f75f0f6 Toggle night-mode class of documentElement when action triggered 2021-06-24 23:47:06 +09:00
hikaru-y
4bff3f4854 Set --window-bg of day/night mode to proper colors
including the following changes:
- rename "_getWindowColor" to "get_window_bg_color" to follow PEP8
- add "night_mode" argument to "get_window_bg_color"
- make it possible to get the correct colors regardless of the current theme
2021-06-24 23:46:48 +09:00
hikaru-y
fa0e3540eb Store default palette before "fusion" QStyle is applied
Once a QStyle different from the system default is applied, the system default palette can no longer be retrieved with standardPalette().
2021-06-24 23:46:11 +09:00
Damien Elmes
0e3ada4fcf fix pin toggle causing saved tags to get lost 2021-06-24 20:16:21 +10:00
Damien Elmes
a190697fd7 v3 scheduler: experimental -> beta 2021-06-24 14:46:09 +10:00
Damien Elmes
8e5e277ee4 don't wait for images before revealing
Currently there's a nasty blink when revealing the answer if the answer
has images on it, as the entire card is hidden, and not shown again until
the images have loaded. This patch removes the wait, so text should appear
more quickly, but it will mean the images may pop in.

We still wait for images before scrolling, to avoid a scroll to the wrong
location.

There's plenty of scope to improve this further - preloading images,
rendering MathJax in advance, etc, but those changes will need to wait
for now. #1120 has some related discussion.
2021-06-24 12:22:25 +10:00
Damien Elmes
114eec6585 allow customization of default search text
https://forums.ankiweb.net/t/whats-the-default-search-when-browsing-now-also-how-do-i-choose-to-browse-current-deck/8922
2021-06-24 11:24:30 +10:00
Damien Elmes
d85f978b72 drop crash.log support
I don't recall it ever helping to resolve a bug, and presumably we can
still use it in the future via the PYTHONFAULTHANDLER env var if
necessary.
2021-06-24 10:08:31 +10:00
Henrik Giesel
d5b44654b0 Call update_notetype_legacy after toggling sticky 2021-06-21 15:48:22 +02:00
Damien Elmes
c79f8ba88f in/out -> request/response
The saved characters weren't worth the increased difficulty when
reading, and the fact that we were deviating from protobuf norms.
2021-06-20 15:49:20 +10:00
Damien Elmes
2e53dc63c8
Merge pull request #1230 from RumovZ/fields-check
Check for misplaced or missing clozes when adding and in the editor
2021-06-17 21:26:16 +10:00
Damien Elmes
d0ca61a608 show correct card count when removing multiple templates
https://forums.ankiweb.net/t/error-in-card-type-deletion/10868
2021-06-17 15:51:21 +10:00
Henrik Giesel
3aebae9f13 Allow inclusion of external icons into aqt/forms/icons
+ Replace old tag icon with mdi tag and tag-off icon
2021-06-16 17:19:21 +10:00
Henrik Giesel
c5faf39d7c Make Browser root nodes use "_*" uniformly 2021-06-16 17:19:21 +10:00
Damien Elmes
d120cd7f8a update to latest mypy
mypy's move to external types-* packages is a PITA, as it requires them
to be installed in site-packages, and provides no way to specify a custom
site-packages folder, necessitating extra scripts to mock the
site-packages path, and copy+rename the stub packages into a separate
folder.
2021-06-16 16:04:59 +10:00
RumovZ
0f549d2b82 Merge cloze hint divs into one 2021-06-15 08:43:18 +02:00
RumovZ
5574cb1cfe Make missing cloze a warning again 2021-06-15 08:43:00 +02:00
Thore
066a2e8e1d
Add hook to onDelete in AddonsDialog (#1232)
* add hook

* add me to CONTRIBUTORS

* adjust hook to comments

* Update CONTRIBUTORS
2021-06-15 10:01:29 +10:00
RumovZ
0033d49646 Fix filtered deck from browser
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/14
2021-06-13 08:59:23 +02:00
RumovZ
d8c3e71105 Add editor hints for cloze errors 2021-06-12 17:35:40 +02:00
RumovZ
9acc03773a Check for out-of-place/missing clozes when adding 2021-06-12 10:05:42 +02:00
Damien Elmes
d448bd9cb6 prevent cmd+c in webview with empty selection from crashing on macOS
https://forums.ankiweb.net/t/command-c-on-crashes-anki-2-1-41-on-mac/10684
2021-06-11 19:58:20 +10:00
Damien Elmes
75917f452b
Merge pull request #1224 from kelciour/mpv-playlist-fix
Keep the internal mpv playlist from growing on
2021-06-10 22:28:24 +10:00
Damien Elmes
61e86cc29d new change notetype implementation for the frontend
- changes can now be undone
- the same field can now be mapped to multiple target fields, allowing
fields to be cloned
- the old Qt dialog has been removed
- the old col.models.change() API calls the new code, to avoid
breaking existing consumers. It requires the field map to always
be passed in, but that appears to have been the common case.
- closes #1175
2021-06-10 22:19:24 +10:00
kelciour
c950745ab4 keep the internal mpv playlist from growing on
https://forums.ankiweb.net/t/audio-tracks-get-clipped-at-the-end/10289/5
2021-06-10 11:28:57 +03:00
Damien Elmes
2b8bbda55f when focusing current card, position at top
trying out the changes mentioned on
https://github.com/ankitects/anki/pull/1222#discussion_r648051997
2021-06-09 21:01:29 +10:00
Damien Elmes
c5e56a5fe8 ensure current card centered even if it was already visible
Otherwise if a user reviews a card while keeping Browse open, the
card may not be centered if it was already in view.
2021-06-08 16:22:56 +10:00
Damien Elmes
5bd2dc65ed add card info action to reviewer; move note actions together 2021-06-08 14:23:23 +10:00
Damien Elmes
afaaa763ec don't wait before scrolling to current card
https://github.com/ankitects/anki/pull/1222#discussion_r647017566
2021-06-08 12:54:05 +10:00
Damien Elmes
6878d4ca24 fix preferences screen indiscriminately triggering queue rebuild 2021-06-08 12:11:31 +10:00
Damien Elmes
1479957538 fix note changes triggering a queue rebuild 2021-06-08 12:09:35 +10:00
Damien Elmes
df600c094a
Merge pull request #1222 from RumovZ/browser-card
Change handling of browser's card parameter
2021-06-08 09:32:43 +10:00
Damien Elmes
0c69854b71
Merge pull request #1221 from kelciour/audio-pause-fix
Audio pause fix
2021-06-08 09:23:11 +10:00
RumovZ
8a9c9829e8 Change handling of browser's card parameter
If a search is provided execute it, else search for current deck.
Then try to select and scroll to the provided card.
2021-06-07 16:42:17 +02:00
kelciour
63dc301ef0 use 'cycle' command to toggle pause 2021-06-07 01:54:07 +03:00
kelciour
f1d1301fe6 workaround for audio tracks get clipped at the end 2021-06-07 01:45:59 +03:00
kelciour
c352314ed8 fix audio is paused unusual
closes #1164
2021-06-07 01:09:44 +03:00
Damien Elmes
e3ce9d05c7 add Rescheduled to Today section of sidebar
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/105
2021-06-05 12:55:07 +10:00
Damien Elmes
f5fbad2c20 fix CSV import ignoring selected deck
This is a stop-gap - once the importing code is refactored, we
should pass in the desired deck directly.

https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/102
2021-06-04 20:37:45 +10:00
Damien Elmes
8555a977cb
Merge pull request #1218 from cherryblossom000/help-links
fix documentation links
2021-06-04 15:44:16 +10:00
Damien Elmes
5d477d7e11 another workaround for timeboxing issue 2021-06-04 15:25:30 +10:00
Damien Elmes
cff8069ef9 remove 'flag ' prefix from flag names 2021-06-04 15:03:17 +10:00
cherryblossom
92fe68abfe
fix documentation links 2021-06-03 16:51:03 +10:00
Damien Elmes
6e724ea480 make sure install.sh is run from the correct folder
https://forums.ankiweb.net/t/upgrade-doesnt-work-free-disk-space-is-written-full/10500/2
2021-06-03 10:50:32 +10:00
Damien Elmes
be9bbf2157 catch all recording errors; mention permission
https://forums.ankiweb.net/t/i-have-an-error-when-i-try-to-record-of-audio/10483
2021-06-02 12:20:40 +10:00
Damien Elmes
578b1b0552
Merge pull request #1213 from RumovZ/new-flags
Add pink, turquoise and purple flags
2021-06-02 11:22:26 +10:00
Damien Elmes
0f5627bb7a limit custom study to 100 tags
The hard limit from sqlite may be larger, but things slow down as more
tags are selected.

https://forums.ankiweb.net/t/unable-to-create-custom-test/10467

There are a number of things that could be improved here:

- we should show a live count so users are aware of the limit
- we should be filling in the parent tags when they're not explicitly
listed on a card
- we should reconsider disabling the 'tags to include' by default

It may make sense to defer these changes until we can move this screen
into Svelte/handle the processing in the backend.
2021-06-02 11:15:39 +10:00
Damien Elmes
6e992752ca prevent error storm when browser table encounters panic 2021-06-02 11:15:39 +10:00
Damien Elmes
a53c130177 close Anki after a panic occurs
Once the mutex has been poisoned the app is unusable, and users were
struggling to close it. This also ensures we'll receive the original
error report, instead of the follow-up poison errors that don't tell us
what caused the issue.

https://forums.ankiweb.net/t/error-message-keeps-popping-up/10494
2021-06-02 11:15:39 +10:00
RumovZ
daa696e703 Tweak flag colors 2021-06-01 18:14:54 +02:00
RumovZ
5e7a47fdc7 Rename violet to pink 2021-06-01 18:14:43 +02:00
Damien Elmes
70d20dfbec
Merge pull request #1209 from RumovZ/drop-saved-search
Drag & drop for saved search
2021-06-01 17:50:55 +10:00
Damien Elmes
479e19844b fix incorrect platform specifier
It should have been isLin, but we don't even need to check it -
the env var alone should suffice.
2021-06-01 17:41:15 +10:00
Damien Elmes
b9f8cdb8bc try to fall back to xcb if wayland forced on packaged build
https://forums.ankiweb.net/t/anki-doesnt-start-under-wayland-linux/10409/5
2021-06-01 17:38:35 +10:00
Damien Elmes
595e23189b handle ctrl+numpad enter on Windows
https://forums.ankiweb.net/t/ctrl-enter-with-the-number-pad-doesnt-work/10323/5
2021-06-01 16:25:12 +10:00
Damien Elmes
e124f935a5 fix timebox causing crash
When a modal was created with another window as its parent, the other
window was being returned, when it was the current window that we
actually wanted. This caused nextCard() to be called again when it
presented the timebox modal, leading to a stack overflow.

https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/71
2021-06-01 15:35:18 +10:00
Damien Elmes
688f22b4c8 require reposition to start at 0; cap maximum
https://forums.ankiweb.net/t/unable-to-reposition-cards-to-negative-start-position/10370/2
2021-06-01 10:09:24 +10:00
RumovZ
c97c6c6e98 Add violet, turquoise and purple flags 2021-05-31 12:03:30 +02:00
Damien Elmes
29c4869aef remove deck protobuf from frontend
Like the previous change, avoid exposing the protobuf as a public API
for now. It requires more thought, and is probably better done with
either extra helper accessors like decks.name(), or via a native class.
2021-05-31 16:31:06 +10:00
RumovZ
c85ae24347 Make a new item the current item after refresh 2021-05-30 10:46:59 +02:00
RumovZ
985ce2466b Skip saving search if it already exists 2021-05-30 10:11:40 +02:00
RumovZ
37fec02f88 Enable drop to create saved search 2021-05-30 09:30:22 +02:00
Damien Elmes
a894c720de
Merge pull request #1206 from RumovZ/fix-sidebar
Fix some sidebar issues
2021-05-29 10:33:52 +10:00
Damien Elmes
93459cc48f
Merge pull request #1200 from RumovZ/template-checks
Template checks
2021-05-29 10:28:06 +10:00
RumovZ
24b4f15038 Fix renaming of unused tag
Unused tags can't be renamed, but since the CollectionOp returns success
in any case, the provisionally renamed sidebar item needs to be reset.
2021-05-28 19:18:21 +02:00
RumovZ
2597038fe5 Prevent sidebar toolbar from folding
If there is little space, Qt replaces some tools of the toolbar with an
expandable menu indicated by an arrow. But this arrow is invisible in
night mode.
2021-05-28 18:09:44 +02:00
RumovZ
af50db9fd3 Fix restoring current sidebar element for cards 2021-05-28 17:46:46 +02:00
Damien Elmes
7caaf0c735 remove sticky setting from fields dialog
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/60
2021-05-28 18:33:29 +10:00
Damien Elmes
a02890a84b make update all toggle clearer
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/59

+ remove background color; it did not look good in dark mode
2021-05-28 18:33:28 +10:00
Damien Elmes
aa7d2721c9 avoid bumping mtime when nothing has changed
+ update sync indicator after every op
+ skip mtime bump on undo/redo
2021-05-28 11:09:16 +10:00
RumovZ
935fbb6289 Use implicit failure handling and self as parent 2021-05-27 16:51:03 +02:00
Damien Elmes
6cc713cbe8 add v3 scheduler to prefs screen 2021-05-27 23:09:49 +10:00
Damien Elmes
4e95cac5c8 remove 'update later' button 2021-05-27 22:42:21 +10:00
Damien Elmes
83a1d99e22 fix remembered tags not being applied to next added note
https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/56
2021-05-27 13:18:34 +10:00
Damien Elmes
f26c7ed99e ask user to confirm which deck they want when opening options in reviewer
Also fixes https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/57
2021-05-27 13:15:28 +10:00
Damien Elmes
7c5e974ae5 hook up some missing translations in deck options screen 2021-05-26 14:41:18 +10:00
Damien Elmes
57ec4cc7b5 change get_queued_cards() to no longer return congrats info 2021-05-26 12:59:45 +10:00
Damien Elmes
0026506543 update ts deps
- prettier's formatting has changed, so files needed to be reformatted
- dart is spitting out deprecation warnings like:

254 │   2: $spacer / 2,
    │      ^^^^^^^^^^^
    ╵
    bazel-out/darwin-fastbuild/bin/ts/sass/bootstrap/_variables.scss 254:6  @import
    ts/sass/button_mixins.scss 2:9                                          @use
    ts/components/ColorPicker.svelte 2:5                                    root stylesheet

DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($grid-gutter-width, 2)
2021-05-26 09:37:40 +10:00
RumovZ
db9594818a Handle failure in CardLayout/accept() 2021-05-25 20:58:43 +02:00
Damien Elmes
5a8f534f00 always start in first sidebar mode
I didn't notice anyone objecting; let's see how this is received.

https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/35
2021-05-24 14:51:21 +10:00
Damien Elmes
adcdb422c5 config updates by the frontend now skip undo by default 2021-05-24 14:50:46 +10:00
Damien Elmes
47076b9ac5
Merge pull request #1188 from RumovZ/switch-color-2
Change switch color depending on state
2021-05-24 11:42:54 +10:00
Damien Elmes
54628c3ac7 make switch more legible in dark mode 2021-05-24 11:31:56 +10:00
Damien Elmes
a0eebb78ce
Merge pull request #1186 from RumovZ/ctx-actions
Update context action states after card op
2021-05-24 10:49:23 +10:00
RumovZ
ff76d50338 Remove browser.oneModelNotes() 2021-05-22 19:12:03 +02:00
RumovZ
0dca3ef548 Check notetype count in browser.onChangeModel() 2021-05-22 19:11:06 +02:00
RumovZ
cba5c2253a Change switch color depending on state
Make knob overlap path.
2021-05-22 10:01:15 +02:00
RumovZ
29589fcf0d Update context action states after card op 2021-05-22 08:35:47 +02:00
Damien Elmes
195c41cba3
Merge pull request #1185 from RumovZ/scrolling
Scroll pixels instead of columns horizontally
2021-05-22 10:59:09 +10:00
Damien Elmes
d7d226843e improve type answer legibility
https://forums.ankiweb.net/t/accessibility-suggestion-correct-answer-text-contrast-in-dark-mode/10105

There's probably more that could be done here, but that can probably
wait for #1068
2021-05-22 10:31:29 +10:00
Damien Elmes
958c53d886 fix find&replace searching in incorrect field 2021-05-22 10:12:14 +10:00
RumovZ
d46fe913a5 Scroll pixels instead of columns horizontally 2021-05-21 18:59:53 +02:00
Damien Elmes
3d4cf26758 expose undoable config changes to frontend; refresh sidebar
The browser header handling still needs updating
2021-05-21 17:50:41 +10:00
Damien Elmes
99b7da49a9 report changed cards when changing deck/flag
+ fix repeated flag shortcut not toggling
2021-05-21 16:03:05 +10:00
Damien Elmes
398cdc8992 add night mode styling to type-in-the-answer box
https://forums.ankiweb.net/t/night-mode-does-not-affect-input-tags/10116
2021-05-20 19:14:12 +10:00
RumovZ
5a6ba1b0b9 Move flags into separate module 2021-05-20 10:26:18 +02:00
Damien Elmes
422584b814 fix error when opening and closing editor rapidly 2021-05-20 15:32:28 +10:00
Damien Elmes
d5f4860f9b fix fields/cards font size & too-large toolbar on high DPI Windows
- enable default_css on editor again, so that the html element
is set to the system font size. If this is bringing in unwanted styling,
maybe we can come up with a different solution that just adjusts the
fonts
- make toolbar size relative to html font size, instead of hard-coding
it
2021-05-20 13:15:17 +10:00
Damien Elmes
055f2907ec
Merge pull request #1178 from RumovZ/flag-labels
Custom labels for flags
2021-05-20 11:59:55 +10:00
RumovZ
6fb2d30426 Remove redundant pylint exception 2021-05-19 19:44:49 +02:00
RumovZ
f960299345 Prefer looping over flags over exhaustive listing 2021-05-19 19:26:39 +02:00
RumovZ
b5fa7923e6 Use custom flag labels in reviewer 2021-05-19 19:18:49 +02:00
RumovZ
5fa68c885a Use dataclass instead of tuple for loaded flags 2021-05-19 19:17:43 +02:00
abdo
bbb2f7158f Strip Unicode isolation characters from title 2021-05-19 18:21:57 +03:00
Damien Elmes
df38788e07 move deck name into window title; v-center sticky bar 2021-05-19 19:34:15 +10:00
Damien Elmes
fdd162a7b9 simplify previous patch
The default 1 rem is fine, but we need to apply the default font size
to the html element instead of the body for the definition of rem to
update.

Fixes #1174
2021-05-19 19:06:20 +10:00
RumovZ
30736ddf75 Use custom flag labels for browser actions 2021-05-19 11:00:02 +02:00
RumovZ
9816227b5c Make sidebar flags renamable 2021-05-19 10:04:40 +02:00
Damien Elmes
581480191a show note about old options screen if any add-ons are installed 2021-05-19 16:20:25 +10:00
Damien Elmes
63f1a363af use literal for ease type 2021-05-19 16:05:12 +10:00
Damien Elmes
9f3f6bab7d enable redo support
Also:

- fix issues where the Undo action in the Browse screen was not
consistent with the main window. The existing hook signature has been
changed; from a snapshot of the add-on code from a few months ago, it
was not a hook that was being used by anyone.
- change the undo shortcut in the Browse window to match the main
window. It was different because undoing a change in the editing area
could accidentally trigger an undo of an operation, but the damage is
limited now that (most) operations can be redone. If it still proves to
be a problem, perhaps we should just always swallow ctrl+z when an
editing field is focused.
2021-05-19 15:18:39 +10:00
RumovZ
3b5e8e5041 Fix black workaround for format calls 2021-05-18 22:19:09 +02:00
Damien Elmes
fa47f6ec15
Merge pull request #1170 from RumovZ/fix-columns
Fix column issues
2021-05-18 09:24:15 +10:00
Damien Elmes
157f602624 fix detection of shift key at startup
Our regular helper doesn't appear to work during startup.
2021-05-18 09:21:02 +10:00
Damien Elmes
bd24005e08 PreviewDialog was missing from top level browser module 2021-05-18 09:10:28 +10:00
RumovZ
2290a1652d Set column sizes and indicator after state change 2021-05-17 20:13:45 +02:00
RumovZ
9ceee90942 Block events when restoring headers
Restoring headers after switching states was triggering
_on_column_toggled(), leading to unexpected results.
2021-05-17 20:07:52 +02:00
RumovZ
02f86ec352 Make failed sort column change a no-op
The previous behaviour when a non-sortable column was clicked was to
trigger the sorting routine, which was usually a no-op, but would
reorder rows if the configured sort column was hidden.
2021-05-17 18:33:59 +02:00
Damien Elmes
9edac805ad support card state mutator in test scheduler
Documentation to come
2021-05-17 16:59:02 +10:00
Damien Elmes
1a48622d77 experiment with learning count on deck list 2021-05-16 20:23:39 +10:00
Damien Elmes
390a8421aa fix test scheduler undo + implement look-ahead
Instead of using a separate undo queue, the code now defers checking for
newly-due learning cards until the answering stage, and logs the updated
cutoff time as an undoable change, so that any newly-due learning cards
won't appear instead of a new/review card that was just undone.

Queue redo now uses a similar approach to undo, instead of rebuilding the
queues.
2021-05-14 22:16:53 +10:00
Damien Elmes
c41d5ca4bf work around Windows issue on latest Black
Thanks Rumo!
d797900386
2021-05-13 20:15:51 +10:00
Damien Elmes
99081e422b re-enable leech notification for test scheduler 2021-05-13 15:51:02 +10:00
Damien Elmes
dbbcb3e38c expose new sorting options in test scheduler options; move things around 2021-05-13 15:23:16 +10:00
Damien Elmes
49a1580566 use new API for test scheduler
Avoids duplicate work, and is a step towards allowing the next
states to be modified by third-party code.

Also:

- fixed incorrect underlined count, due to reviews being labeled as
learning cards
- fixed reviewer not refreshing when undoing a test review, by splitting
up backend queue rebuilding from frontend reviewer refresh
- moved answering into a CollectionOp
2021-05-11 13:06:03 +10:00
Damien Elmes
3736e63a57 expose step counter and undone op changes in hook 2021-05-08 17:51:36 +10:00
Damien Elmes
4be5d08559 remove some unnecessary checkpoints 2021-05-08 17:04:05 +10:00
Damien Elmes
1918031399 update find_duplicates to use QueryOp/CollectionOp 2021-05-08 16:58:18 +10:00
Damien Elmes
f2db822c08 move query_op into operations/, and add the ability to show progress 2021-05-08 16:35:43 +10:00
Damien Elmes
b887032244 split browser dialogs into separate files 2021-05-08 15:08:45 +10:00
Damien Elmes
0b8733032d the find_and_replace alias is not required
Was only added recently, so nothing should depend on it yet.
2021-05-08 14:34:57 +10:00
Damien Elmes
78a3536bfc move "find duplicates" into separate file
As far as I'm aware, no add-ons were extending that screen, so I've
dropped the old context object and the export in browser/__init__.py
2021-05-08 14:33:43 +10:00
Damien Elmes
010c3da770
Merge pull request #1159 from hgiesel/newapproach
Prefer idiomatic Svelte features over dynamic components
2021-05-08 11:35:31 +10:00
Henrik Giesel
8b0c6ba5df Check for id when inserting dynamic elements
* I'm not sure it behaved, if there were multiple elements
  inserted by different add-ons into the same container
2021-05-07 16:50:17 +02:00
Henrik Giesel
6a804f6775 Use json.dumps instead of backticks in editor.py 2021-05-07 14:22:06 +02:00
Damien Elmes
7442eed41a update docstrings for latest black 2021-05-07 18:12:56 +10:00
Damien Elmes
3d8b7d943c fix find&replace 2021-05-07 14:02:40 +10:00
Henrik Giesel
de8abebcd1 Fix Preview Button after changing from f-string to normal string 2021-05-07 02:12:37 +02:00
Henrik Giesel
2112b419f9 Fix ButtonDropdown 2021-05-07 02:04:44 +02:00
Henrik Giesel
0f4d4eb5a9 Only initialize extension apis if necessary 2021-05-07 02:04:44 +02:00
Henrik Giesel
c9368ed98f Add lefttopbtns as AddonButtons 2021-05-07 02:04:44 +02:00
Henrik Giesel
e80f43e8fc Enable setting of PreviewButton and hiding of cloze button again 2021-05-07 02:04:42 +02:00
Henrik Giesel
6d6c798ca3 Simplify structure of EditorToolbar and ButtonGroup in editor HTML file 2021-05-07 02:03:55 +02:00
Damien Elmes
fc2d3ba07c remove AnkiDroid timezone confirmation
By the time this update reaches stable, AnkiDroid 2.15 should already
be out.
2021-05-06 19:05:15 +10:00
Damien Elmes
2663c891eb fix dmypy action 2021-05-05 15:54:41 +10:00
Damien Elmes
abab4826bb support undo for (renamed) unbury_deck() action 2021-04-30 20:03:20 +10:00
Damien Elmes
248373ef30 undoing of notetype templates 2021-04-30 17:30:48 +10:00
Damien Elmes
9a46ad6352 undoing of notetype fields
- fix stale cache issue
- update add cards screen in response to op changes
2021-04-30 17:15:59 +10:00
Damien Elmes
b9417fc583 notetype rename+options undo 2021-04-30 16:09:44 +10:00
Damien Elmes
394fe86f8f notetype removal undoable 2021-04-30 16:01:47 +10:00
Damien Elmes
ea758f0092 update GUI to allow notetype addition undo
- backend now updates current notetype as part of addition
- frontend no longer implicitly adds, so we can assign a new name and
add in a single operation
2021-04-30 15:58:08 +10:00
RumovZ
abd02d7891 Add separate no_arg_trigger decorator 2021-04-26 08:46:08 +02:00
Damien Elmes
f77983fc9f
Merge pull request #1154 from RumovZ/fix-skip-dec
Fix skip_if_selection_is_empty() for triggers
2021-04-26 09:21:42 +10:00
RumovZ
594fe303da Remove some unnecessary lambdas 2021-04-25 19:51:57 +02:00
RumovZ
9900f73cee Fix skip_if_selection_is_empty() for triggers
It seems to be enough if one decorator calls pyqtSlot(), but to avoid
problems in the future, let's have all decorators do that.
2021-04-25 19:50:56 +02:00
Henrik Giesel
268adf1d03 Move EditorToolbar API into EditorToolbar.svelte 2021-04-25 19:15:00 +02:00
Henrik Giesel
f5fba15435 Initialize editor toolbar via function, not web component 2021-04-25 18:32:01 +02:00
Damien Elmes
b7b329cf90
Merge pull request #1151 from RumovZ/no-sel-dec
Fix some problems with browser actions while selection is empty
2021-04-25 20:48:40 +10:00
Damien Elmes
eb3f3ddd45 enable the new deck options by default
- The old options are still available with a shift+click
- Translations still need updating
- See b7747b6a38 for some examples
of extending the screen in an add-on
2021-04-25 19:58:58 +10:00
Damien Elmes
a1ce048ed5 fix error when user cancels out of set due date/reposition 2021-04-25 19:33:25 +10:00
Damien Elmes
b7747b6a38 experimental support for extending add-ons screen with Svelte 2021-04-25 19:33:18 +10:00
Damien Elmes
b485b8cbb9 deckconfig->deckoptions 2021-04-25 19:02:30 +10:00
RumovZ
b1392980f5 Skip some browser methods if selection is empty
This was handled inconsistently before:
* Select Notes would throw a search error.
* Set Due Date would throw an exception.
* Dialogs with no effect would open.
* No-ops would be pushed to the undo queue.
2021-04-25 08:47:15 +02:00
RumovZ
458d891d28 Add dec to make methods no-op if no selection 2021-04-25 08:36:22 +02:00
Damien Elmes
e2a4d6041c basic support for add-ons in new deck config screen
- expose the data as a writable store
- currently only supports raw HTML; example to come
- fix changes not marking a deck config as modified
- the data is currently packed into the deckconfig object, but we
may move these to a separate store in the collection config in the
future, like is done with decks/notetypes
2021-04-24 11:08:01 +10:00
Henrik Giesel
452fdf05af Remove unused import 2021-04-24 01:32:02 +02:00
Henrik Giesel
1f05ebbcf7 Remove addcards toolbar again for now 2021-04-24 00:10:45 +02:00
Henrik Giesel
9f7a187d4a Add mostly working addcards topbar 2021-04-24 00:00:32 +02:00
Henrik Giesel
8ecd4f8c95 Add simple version of Chooser buttons 2021-04-23 21:25:44 +02:00
Henrik Giesel
48b7cb49f9 Make update algorithm in editor-toolbar/index.ts recursive 2021-04-23 20:50:09 +02:00
Henrik Giesel
6ae368ebac Reduce typing overhead in ts/editor-toolbar/index.ts and export buttonGroup 2021-04-23 19:05:43 +02:00
Henrik Giesel
bda99ee0f1 Add IterableToolbarItem interface for easier typing 2021-04-23 18:53:52 +02:00
Henrik Giesel
7563a3c929 Use rawButton in browser.py 2021-04-23 17:34:42 +02:00
Henrik Giesel
4379f1e84f Make dynamicComponents usable for addons, rather than the components directly
rawButton({ html: ... })

instead of

{ component: RawButton, html: ... }
2021-04-23 16:43:36 +02:00
Damien Elmes
02ebab7491
Merge pull request #1146 from hgiesel/shortcuts
Shortcut API for Editor
2021-04-23 09:44:01 +10:00
Damien Elmes
f6a59ebdfa split deck description into separate screen linked from overview 2021-04-22 21:03:16 +10:00
Henrik Giesel
d2ca94a29d Move other buttons to WithShortcut 2021-04-22 03:25:31 +02:00
Damien Elmes
30f5269304 hook new deck config screen up behind an env var 2021-04-22 10:59:16 +10:00
Henrik Giesel
85f89dc111 Add first shortcuts for bold, italic, underline, removeFormat 2021-04-22 02:37:04 +02:00
Henrik Giesel
b1de095162 Include editor-toolbar as a library in editor 2021-04-20 13:44:44 +02:00
Henrik Giesel
83d5d72777 Generalize inListItem to getAnchorElement 2021-04-20 13:44:43 +02:00
Damien Elmes
41d5cae7db fix Find Dupes activation 2021-04-20 21:13:21 +10:00
Damien Elmes
55277aa90a implement deck config saving on JS end 2021-04-20 19:50:05 +10:00
Damien Elmes
10b7ab2c6d include sourcemaps for pages/* in dev builds 2021-04-20 17:33:46 +10:00
RumovZ
3cecc7157b Add sidebar filter "first review today" 2021-04-18 13:27:10 +02:00
Damien Elmes
76eb119870 add schema change prompt to removal, tweak return struct 2021-04-18 17:33:12 +10:00
Damien Elmes
1648adc126
Merge pull request #1130 from glutanimate/add-deckchooser-to-addcards-legacy-api
Add AddCards.deckChooser property for legacy add-on support
2021-04-16 11:58:34 +10:00
Damien Elmes
6632b63a11 support overriding listening IP during dev 2021-04-16 10:23:13 +10:00
Glutanimate
a446e7320c Add AddCards.deckChooser property for legacy access 2021-04-15 18:18:25 +02:00
Henrik Giesel
5702b3c273 Add type to add_preview_shortcut 2021-04-15 15:50:29 +02:00
Henrik Giesel
82f6e19955 Add Latex formatting options to menu
*  Format shortcuts in monospace font and increase padding a little bit
2021-04-15 15:20:37 +02:00
Henrik Giesel
53ae03becc Add Preview shortcut for browser 2021-04-15 13:09:51 +02:00
Henrik Giesel
a7d24e7159 Add support for Preview button in Browser 2021-04-15 13:09:50 +02:00
Henrik Giesel
920b740c8f Add RawButton and hook old python hooks up to it 2021-04-15 13:09:50 +02:00
Henrik Giesel
eceb98f8e6 Show/Hide Cloze button depending on whether cloze type 2021-04-15 13:09:50 +02:00
Henrik Giesel
37ed3e8209 Fix some code quality issues 2021-04-15 13:09:49 +02:00
Henrik Giesel
7f42b38e7a Add labels and titles to all buttons 2021-04-15 13:09:49 +02:00
Henrik Giesel
a820059b8f Utilize enableButtons disableButtons from Svelte component 2021-04-15 13:09:49 +02:00
Henrik Giesel
a0a9619722 Include icons directly in ts lib 2021-04-15 13:09:49 +02:00
Henrik Giesel
7787a7827f First implementation 2021-04-15 13:09:48 +02:00
Henrik Giesel
de77e40e4d Add ts/editor-toolbar 2021-04-15 13:09:48 +02:00
RumovZ
f7bf90100d Fix ChangeModel combos being cleared after setup() 2021-04-14 23:01:40 +02:00
Damien Elmes
0b8ae7225a add a shortcut to speed up local ts dev
@hgiesel if you're not already doing something like this, you might
find this useful
2021-04-14 23:21:33 +10:00
Damien Elmes
7f738c11a2 deck config prototype work in progress
Still in the early stages, and not hooked up yet.
2021-04-14 22:33:10 +10:00
Damien Elmes
4a406192fa
Merge pull request #1127 from Arthur-Milchior/factorize_current_search
NF: factorize browser.current_search
2021-04-14 19:16:59 +10:00
Damien Elmes
e472375917 fix formatting in dmypy.py 2021-04-14 19:11:01 +10:00
Arthur Milchior
be44d4eeed NF: factorize browser.current_search
I was looking at search code and find out that's already slightly more clear/short even if NF
2021-04-14 10:55:41 +02:00
Damien Elmes
cca9195ea5 run prettier on some sass files 2021-04-14 18:22:33 +10:00
Damien Elmes
c49d6ce49f run black/isort on Python scripts 2021-04-14 18:22:02 +10:00
Damien Elmes
01049b1289 add an updated script to run mypy as a daemon
Sadly doesn't work on Windows
2021-04-14 18:10:38 +10:00
Damien Elmes
fc8a5759d5
Merge pull request #1124 from hgiesel/dropjquerypy2
Remove jQuery from remaining qt/aqt files
2021-04-14 12:43:11 +10:00
Damien Elmes
ca6edc1470
Merge pull request #1123 from hgiesel/reviewerbottomdropjquery
Remove jQuery reviewer-bottom.ts and overview.ts
2021-04-14 12:35:39 +10:00
Damien Elmes
ff944c88fb
Merge pull request #1122 from hgiesel/webviewcss2
Prefer SASS over including files
2021-04-14 11:55:19 +10:00
Damien Elmes
e530b96998 add missing type annotation 2021-04-14 11:28:40 +10:00
Damien Elmes
9ff3ad15a5
Merge pull request #1121 from RumovZ/move-sidebar
More for the browser folder
2021-04-14 11:25:15 +10:00
Damien Elmes
bf46176af9 add contributor 2021-04-14 11:03:17 +10:00
Henrik Giesel
280f78535b Replace jQuery in webview.py 2021-04-13 21:32:53 +02:00
Henrik Giesel
3e1b42bb62 Satisfy formatter 2021-04-13 20:29:59 +02:00
Henrik Giesel
67754494d2 Remvoe jQuery from deckbrowser.py
It's not quite clear why jQuery was necessary here?
2021-04-13 20:26:06 +02:00
Henrik Giesel
7dd12a523d Remove jquery from reviewer.py
- we no longer actually need to focus the default ease button
2021-04-13 20:11:18 +02:00
Henrik Giesel
bdf1e6324e Remove jQuery from toolbar.py 2021-04-13 19:59:00 +02:00
Henrik Giesel
64c7d405f5 Remove jquery from browser.py 2021-04-13 19:54:45 +02:00
Henrik Giesel
191e3cf69b Satisfy formatter 2021-04-13 19:47:03 +02:00
Henrik Giesel
a76f1d64ad Move compile_sass.bzl to /ts + Remove core.css from data/web (unused?) 2021-04-13 19:47:03 +02:00
Henrik Giesel
ffd159f9a0 Declare dependencies in data/web/css 2021-04-13 19:47:03 +02:00
Henrik Giesel
8f0f8f9af8 Use graphs-base and congrats-base 2021-04-13 19:47:03 +02:00
Henrik Giesel
fee6ee7319 Do not include webview.css for editor 2021-04-13 19:47:03 +02:00
Henrik Giesel
825509ba0c Move card_counts and split off fusion_vars 2021-04-13 19:47:03 +02:00
Henrik Giesel
df7c597a8b Add option not include default css in stdHtml 2021-04-13 19:47:03 +02:00
Henrik Giesel
86262030e3 Purge jQuery from reviewer-bottom 2021-04-13 19:41:04 +02:00
Henrik Giesel
ae3f8adbb3 Remove overview.ts 2021-04-13 19:38:57 +02:00
Damien Elmes
18f03d5cb1
Merge pull request #1119 from hgiesel/reviewerdropjquery
Remove last jQuery from reviewer.ts / Remove fadeTime
2021-04-13 23:12:13 +10:00
Henrik Giesel
be7630648d Add setInnerHTML as a Replacement for $.html 2021-04-13 13:32:50 +02:00
RumovZ
594a98eff1 Move previewer.py into browser folder 2021-04-13 11:38:35 +02:00
RumovZ
e43f11339f Declare all legacy pathnames in browser init 2021-04-13 11:30:32 +02:00
RumovZ
88086596b6 Move find_and_replace.py into browser/dialogs 2021-04-13 11:21:36 +02:00
RumovZ
7ee40e3dce Refactor sidebar.py into browser folder 2021-04-13 11:05:49 +02:00
Damien Elmes
e520e8df02 add missing copyright headers to *.ts 2021-04-13 18:57:08 +10:00