Commit graph

3827 commits

Author SHA1 Message Date
evandrocoan
30107ab09d Created the GitHub Actions step Upload to PyPi to run only on
tagged releases of anki:
https://anki.tenderapp.com/discussions/ankidesktop/40025-anki-in-python-package-index
2020-04-02 02:57:34 -03:00
Damien Elmes
001226050d fix is:due search 2020-04-02 09:33:05 +10:00
Damien Elmes
ddefffceda return interrupted err when media sync aborted 2020-04-01 21:40:14 +10:00
Damien Elmes
cbfc0207ec tolerate string values in deck["conf"] 2020-04-01 19:36:40 +10:00
Damien Elmes
f195296106 fix push-i18n-ftl 2020-04-01 18:20:31 +10:00
Damien Elmes
8f427dbbd7 FString -> TR 2020-04-01 18:16:43 +10:00
Damien Elmes
526569693c fix extract-po-string.py 2020-04-01 17:49:31 +10:00
Damien Elmes
15ba839003 translate default deck config name 2020-04-01 17:49:25 +10:00
Damien Elmes
9c09d08152 remove defaultConf 2020-04-01 17:36:46 +10:00
Damien Elmes
7e7ac42384 add fixme 2020-04-01 17:36:33 +10:00
Damien Elmes
0359a6ae38 tweak hook name 2020-04-01 17:13:08 +10:00
Damien Elmes
525fae808d Merge pull request #534 from Arthur-Milchior/tags_hook
hook tag_editor_received_a_key
2020-04-01 17:10:31 +10:00
Damien Elmes
7b201fe7e6 ignore .DS_Store in trash
https://anki.tenderapp.com/discussions/ankidesktop/40035-anki-2123-on-macos-ds_store-files-in-new-anki-trash
2020-04-01 13:37:57 +10:00
Damien Elmes
8d952570a8 left-align tags
https://anki.tenderapp.com/discussions/ankidesktop/40068-tags-column-in-browser-is-centered
2020-04-01 13:29:42 +10:00
Damien Elmes
78aad6b64b always position selection in center after search
https://anki.tenderapp.com/discussions/beta-testing/1888-retaining-position-when-searching
2020-04-01 11:01:20 +10:00
Damien Elmes
5bb4d798c1 add some timeouts
I'm waiting to hear back from the reqwests author on the best way to
handle this. For now, this change just adds short timeouts
to the quick requests, and will wait for up to an hour when sending/
receiving files to allow for the slow connection+large file case.
2020-04-01 10:03:54 +10:00
Damien Elmes
284ee0860b allow aborting a media sync while http req in flight
The progress handling code needs a rethink, as we now have two separate
ways to flag that the media sync should abort. In the future, it may
make sense to switch to polling the backend for progress, instead of
passing a callback in.
2020-04-01 09:49:25 +10:00
Arthur Milchior
102670a5a6 hook tag_editor_received_a_key
I expect it to be useful for add-ons such as
https://github.com/fonol/anki-search-inside-add-card which interact
with the tag line
2020-03-31 15:05:41 +02:00
Damien Elmes
6a352e32ff Merge pull request #533 from zjosua/taglimit-quotes
Use double quotes in taglimit queries
2020-03-30 21:44:33 +10:00
Damien Elmes
6482af7361 add a temporary cache to bring deck list performance back 2020-03-30 20:27:53 +10:00
Damien Elmes
cffe146397 split deck config into separate SQL table
- on collection load, the schema is upgraded to 12
- on collection close, the changes are reversed so older clients
can continue to open the collection
- in the future, we could potentially skip the reversal except
when exporting/doing a full sync
- the same approach should work for decks, note types and tags in the
future too
- the deck list code needs updating to cache the deck confs for the
life of the call
2020-03-30 20:01:16 +10:00
zjosua
487d02fff2 Use double quotes in taglimit queries 2020-03-30 10:12:47 +02:00
Damien Elmes
089a68eb43 move deck conf handling to backend 2020-03-30 14:39:46 +10:00
Damien Elmes
918ec2a5a0 explicitly save deck conf after mutating it 2020-03-30 12:27:52 +10:00
Damien Elmes
d41124343d initial work on undo support 2020-03-29 17:52:16 +10:00
Damien Elmes
3924dedbb7 remove usn cache
SqliteStorage no longer contains any mutable state
2020-03-29 12:50:38 +10:00
Damien Elmes
cbbbced59e cache timing_today in collection, update it when cutover reached 2020-03-29 12:26:24 +10:00
Damien Elmes
0451a4d4e0 drop separate RequestContext/StorageContext 2020-03-29 12:12:35 +10:00
Damien Elmes
c4a78ffd82 roll back the vec cache changes
prepare_cached() is sufficiently fast, and allowing the vec cache
to persist across calls is complicated due to lifetime restrictions
2020-03-29 09:26:09 +10:00
Damien Elmes
cb03c87f8b Revert "add benchmark for vec cache"
This reverts commit 0247d65ccd.
2020-03-29 09:16:11 +10:00
Damien Elmes
2fdca03043 Merge pull request #531 from Arthur-Milchior/browser_will_show_context_menu
hook browser_header_will_show_context_menu
2020-03-28 14:50:02 +10:00
Damien Elmes
76dec75947 Revert "Merge pull request #527 from Arthur-Milchior/explode_on_bridge_cmd"
This reverts commit 9e6a2ba1e6, reversing
changes made to fc846ac4e4.

Causes a traceback when opening the add screen, clicking on Type,
and choosing a note type.

  File "/Users/dae/Work/code/dtop/qt/aqt/webview.py", line 31, in cmd
    return json.dumps(self.onCmd(str))
  File "/Users/dae/Work/code/dtop/qt/aqt/webview.py", line 97, in _onCmd
    return self._onBridgeCmd(str)
  File "/Users/dae/Work/code/dtop/qt/aqt/webview.py", line 500, in _onBridgeCmd
    return self.onBridgeCmd(cmd)
  File "/Users/dae/Work/code/dtop/qt/aqt/editor.py", line 374, in onBridgeCmd
    self._links[cmd](self, *args)  # type: ignore
  File "/Users/dae/Work/code/dtop/qt/aqt/editor.py", line 404, in onBlur
    if gui_hooks.editor_did_unfocus_field(False, self.note, int(ord)):
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
2020-03-28 13:35:05 +10:00
Arthur Milchior
015d07ec56 hook browser_header_will_show_context_menu 2020-03-27 23:06:22 +01:00
Damien Elmes
db3538aae3 add an extra second so slow CI server doesn't fail 2020-03-27 15:52:35 +10:00
Damien Elmes
ccee3af22c Merge pull request #529 from Arthur-Milchior/load_note_once_on_note_type_change
Ensuring "setNote" is called only once during changing of note type
2020-03-27 15:28:49 +10:00
Damien Elmes
36314f3b6f Merge pull request #528 from evandroforks/create_actions_for_windows_macos
Create actions for Windows and Mac OS
2020-03-27 15:26:22 +10:00
Damien Elmes
9e6a2ba1e6 Merge pull request #527 from Arthur-Milchior/explode_on_bridge_cmd
Explode on bridge cmd
2020-03-27 15:22:14 +10:00
evandrocoan
9224290336 Re-enabled the rust cargo index and registry caches because
cargo was downloading them just for nothing.
https://github.com/ankitects/anki/pull 528
2020-03-27 02:21:48 -03:00
Damien Elmes
fc846ac4e4 use add_card() 2020-03-27 15:11:07 +10:00
Damien Elmes
1112fc8e8b add (unused) add_card, and move sql to separate files 2020-03-27 14:48:25 +10:00
evandrocoan
399eb536a1 Disabled the caches of cargo registry, index and python wheels 2020-03-27 00:21:09 -03:00
Damien Elmes
0247d65ccd add benchmark for vec cache
test storage::sqlite::bench::bench_hash_cache ... bench:         399 ns/iter (+/- 27)
test storage::sqlite::bench::bench_no_cache   ... bench:       4,854 ns/iter (+/- 499)
test storage::sqlite::bench::bench_vec_cache  ... bench:           0 ns/iter (+/- 0)
2020-03-27 09:59:48 +10:00
Damien Elmes
d1c44ec06d store cached statements in a vec instead of separate optionals 2020-03-27 09:51:19 +10:00
evandrocoan
b9c89fbdff Created a fast build matrix for quickly running the Unit Tests 2020-03-26 19:43:16 -03:00
evandrocoan
f1fe0209f6 Merge remote-tracking branch 'danielelmes/master' into create_actions_for_windows_macos 2020-03-26 19:31:01 -03:00
Damien Elmes
62be1b2688 update card in transaction 2020-03-27 07:58:25 +10:00
Arthur Milchior
77e6e2eb69 Ensuring "setNote" is called only once during changing of note type
Initially, I wanted to solve the bug reported on
https://github.com/Arthur-Milchior/anki-html-src-in-field/issues/1

After some research, I finally discovered that the trouble was that,
when we change the note type in add card, the method
`aqt.editor.Editor.loadNote` is called twice. In itself, it would not
be a problem, but given the way callback works, its call back is
called twice on the last version of the webview. Which means that
`gui_hooks.editor_did_load_note` is called twice, which breaks this
add-on.

The reason why loadNote is called twice is because `setNote` is called
twice in `aqt.modelchooser.onModelChange`. The first time through
`gui_hooks.current_note_type_did_change` which calls
`addcards.AddCards.onModelChange` which calls `loadNote`, the second
time through `self.mw.reset()` which calls
`gui_hooks.state_did_reset()` which calls `addcards.AddCards.onReset`
which calls `setAndFocusNote` which calls `setNote`.

I should note furthermore that currently,
`gui_hooks.current_note_type_did_change` is called only when the model
chooser change a model. And `addCards.onModelChange` is never called,
only added to the hook `gui_hooks.current_note_type_did_change`. So
removing the line of code removed in this commit will have no side
effect in Anki itself. It will only affect the fact that this method
is called twice.

I do not know of any add-on calling `onModelChange` or
`gui_hooks.current_note_type_did_change`, but it means little, so of
course, it may always mean an add-on will break because of this
change. No way of being sure.
2020-03-26 21:26:13 +01:00
Arthur Milchior
504b89f7af Ensure that focus, key and blur are treated as other commands
The reason to do that is that I can then call blur/key from other
method in add-on.

More precisely, I expect to create a method which captures the blur
command, ask anki to execute the standard version of the command, and
then execute more code once the note contains the new field value.

I should note that the code executed during blur/key/focus itself
didn't change. It's only it's location which changed.
2020-03-26 15:42:27 +01:00
Damien Elmes
0f0b90d427 fix progress dialog preventing schema mod
https://anki.tenderapp.com/discussions/beta-testing/1868-anki-2124-beta#comment_48183062

This is an ugly hack - in the future the calling code should be updated
to perform the check prior to starting the operation instead.
2020-03-26 21:07:53 +10:00
Damien Elmes
e28fdde984 handle mtime/usn bump in backend, and tweak integer sizes 2020-03-26 20:55:04 +10:00