Commit Graph

589 Commits

Author SHA1 Message Date
Alexei Yatskov
9f76e5fff2
Merge pull request #348 from Aquafina-water-bottle/issue_82_documentation
README changes: Issue 82 documentation
2022-09-11 10:59:18 -07:00
Austin Siew
6e4bbfa0d6 Added getReviewsOfCard 2022-09-05 00:29:03 -06:00
Austin Siew
d9c01327a4 fixed warning message 2022-08-22 00:06:50 -06:00
Austin Siew
127a34c2d0 added warning 2022-08-22 00:05:19 -06:00
Austin Siew
3b10dbc27f typos 2022-08-22 00:00:15 -06:00
Alexei Yatskov
fbd6ccad3e
Merge pull request #346 from Aquafina-water-bottle/model_field_names
Added model field name actions
2022-08-18 17:44:11 -07:00
Austin Siew
db2e7f2e95 added documentation 2022-08-17 12:50:22 -06:00
Austin Siew
83cc55769b fixed function styling issue in test case 2022-08-16 20:11:44 -06:00
Austin Siew
8ec078393a removed the bulk action in favor of the already existing 'multi' action 2022-08-16 19:35:32 -06:00
Austin Siew
cb52e14497 Added sample requests to field name actions 2022-08-16 19:30:36 -06:00
Austin Siew
ebdca1db6b Added model field name api points and skeleton documentation to README 2022-08-16 19:23:09 -06:00
Alexei Yatskov
55327b6ccf
Merge pull request #343 from StevenTCramer/patch-1
Add PowerShell example to Readme.
2022-07-25 18:04:18 -07:00
Steven T. Cramer
4010293efa
Add PowerShell example to Readme.
Now that PowerShell is cross platform it is my go to shell.  Thought I would add an example to the readme.
2022-07-25 11:49:55 +07:00
07ddcead5e Remove metadata from README 2022-07-14 13:17:33 -07:00
Alexei Yatskov
d174099b60
Merge pull request #332 from debanjandhar12/patch-1
Fix storeMediaFile logic
2022-07-03 11:42:26 -07:00
Alexei Yatskov
113dc50e3a
Merge pull request #334 from oakkitten/fix-tox-tests
Fix tests by “pinning” Anki dependencies via a time machine
2022-06-11 20:56:04 -07:00
oakkitten
cfcb1616ce Tests: add environments for Anki 2.1.51 to 53 2022-06-08 19:29:45 +01:00
oakkitten
b01dd47dec Tests: Run CI tests in parallel 2022-06-08 19:29:45 +01:00
oakkitten
863cef5e64 Tests: use time machine to “pin” Anki dependencies
Packages anki and aqt do not pin their requirements,
which breaks anki <= 2.1.49 because of protobuf major version bump.

While it's possible to use requirements.txt as constraints,
it might not be the best idea:
  * requirements.txt can’t be used as constraints
    without some careful sed’ding to remove hashes and extras;
  * its location changes between versions;
  * you can’t get this file for a pre-release version of Anki
    since these don't get git tags;
  * it’s rarely updated anyway and hence won’t reliably
    produce the environment that actual Anki uses.

So use a pypi-timemachine, which prevents pip from using packages
that were uploaded after a specified date.
While the code is a tad complex, it feels slightly less hacky,
and is likely to be producing more accurate environments.
2022-06-08 19:29:45 +01:00
debanjandhar12
504ac68b40
Fix storeMediaFile logic
Currently, when `skip` is true and `deleteExisting` is true the `storeMediaFile` will simply delete the media file. 
However, the intended behavior should be to not touch the media file when both conditions are true.
2022-06-06 13:47:22 +05:30
Alexei Yatskov
5774ef7346
Merge pull request #323 from oakkitten/edit-dialog-bring-to-foreground
Bring Edit dialog to foreground more reliably
2022-05-29 12:59:02 -07:00
Alexei Yatskov
99d6256ade
Merge pull request #324 from toasted-nutbread/api-reflect
apiReflect
2022-05-29 12:58:38 -07:00
Alexei Yatskov
1d5b87b3f4
Merge pull request #322 from ZhengPeiRu21/fixDeckStatsTest
Fix getDeckStats test
2022-05-29 12:57:18 -07:00
Alexei Yatskov
23c25dd7ae
Merge pull request #319 from oakkitten/fix-bad-json-error
Produce a better error in case of malformed JSON
2022-05-29 12:56:51 -07:00
郑佩茹
1d7bf6969a Correct line endings 2022-05-23 11:37:18 -06:00
郑佩茹
5e701e30aa Only add total_in_deck to deckStats in supported Anki versions 2022-05-23 11:27:40 -06:00
toasted-nutbread
e842dc78e0 Add test 2022-05-20 17:19:29 -04:00
toasted-nutbread
0d0962319a Add documentation 2022-05-20 17:08:35 -04:00
toasted-nutbread
8d9163048a Add apiReflect 2022-05-20 17:08:29 -04:00
oakkitten
3d7e00a86c Bring Edit dialog to foreground more reliably 2022-05-19 16:49:08 +01:00
郑佩茹
b55ac78f84 Fix getDeckStats test 2022-05-16 13:36:02 -06:00
Alexei Yatskov
1d8e41e317
Merge pull request #318 from ZhengPeiRu21/getDailyReviews
Add getDeckStats action
2022-05-14 21:32:03 -07:00
oakkitten
9c3310a8b6 Don't crash if JSON is valid but of wrong schema 2022-05-11 20:32:09 +01:00
oakkitten
bffbb051f2 Produce a better error in case of malformed JSON
$ curl localhost:8777 -X POST -i -d '{"action": "version", "version": 6},' && echo ␄
HTTP/1.1 200 OK
Content-Type: text/json
Access-Control-Allow-Origin: http://localhost
Access-Control-Allow-Headers: *
Content-Length: 67

{"result": null, "error": "Extra data: line 1 column 36 (char 35)"}␄

$ curl localhost:8777 -X POST -i -d '{"action": "version", "version": 6},' -H "Origin: foo" && echo ␄
HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin: http://localhost
Access-Control-Allow-Headers: *

␄
2022-05-11 20:32:08 +01:00
郑佩茹
137554f522 Add getDeckStats action 2022-05-03 15:59:33 -06:00
Alex Yatskov
fe8b221a93
Merge pull request #313 from oakkitten/anki50
Fix tests and some of the code to work with Anki 2.1.50
2022-04-26 20:57:20 -07:00
oakkitten
8a84db971a Patch Anki 2.1.50 on Windows to have valid stdout
Something in Anki is setting stdout to Null.
This is a problem because Anki itself is writing to it,
particularly when printing warnings about
the deprecated methods that we are using.

This patches Anki using the same method that
the upcoming Anki 2.1.51 is using.
2022-04-26 15:22:07 +01:00
oakkitten
ca90ef95fc Tests: set HOME via the command env
Environmental variables set in `setenv` also affect pip invocations.
`HOME` determines where pip is placing its cache.
Setting HOME to anything virtual env-specific means that
every virtual environment is created with its own cache.
This wastes time, data and disk space.
2022-04-26 15:22:07 +01:00
oakkitten
700c6ae218 Explicitly require Anki >= 2.1.45
Consolidate Anki version checks across files
2022-04-26 15:22:06 +01:00
oakkitten
056e722187 Edit dialog: fix editor buttons on Anki 2.1.50
Also add a few tests for the buttons to make sure
that they get actually added and enabled/disabled.
2022-04-26 15:22:06 +01:00
oakkitten
901d92b067 Tests: make tests pass for Anki 2.1.50 (Qt6)
* Import things from `aqt.qt` not `PyQt5`/`PyQt6`
* When testing with Qt6, disable Anki's Qt5 compatibility mode
* Depend on `pytest-anki` that is also Qt version agnostic
2022-04-26 15:22:06 +01:00
oakkitten
e025a44ea3 Tests: make tests pass for Anki 2.1.50 (Qt5)
* require Python 3.10
* prevent Anki from doing backups, again
* restore cwd that deck exporter changes for some wild reason
2022-04-26 15:22:06 +01:00
Abdo
a433f600a4 Allow passing deleteExisting in addNote (#309) 2022-04-25 20:13:06 -07:00
introt
81fccbfac6 requestPermission: improve UX & docs (#312)
* requestPermission: change Ignore button to checkbox

* Update requestPermission documentation

- describe the possible results
- document ignoreOriginList
2022-04-25 20:10:36 -07:00
8e9879f80f Merge remote-tracking branch 'oakkitten/edit-dialog' 2022-04-25 19:48:26 -07:00
oakkitten
6643dca83e Tests: patch waitress to reduce test flakiness
Waitress is a WSGI server that Anki starts to serve css etc to
its web views. It seems to have a race condition issue;
the main loop thread is trying to `select.select` the sockets
which a worker thread is closing because of a dead connection.

This makes waitress skip actually closing the sockets.
2022-04-14 01:55:41 +01:00
oakkitten
c688895c0e Edit dialog: make browser button show all history
Before, pressing the Browse button would only show browser
with the cards or notes corresponding to the currently edited note.

Now, it shows all cards or notes from the dialog history,
in reverse order (last seen on top),
with the currently edited note or its cards selected.
2022-04-14 01:55:41 +01:00
oakkitten
849ab43be7 Tests: simplify profile removal
It turns out that `pytest-anki` does what we are trying to do already.

Note that `empty_anki_session_started` creates a temporary user too.
We are “overwriting“ it in `profile_created_and_loaded`
by calling `temporary_user`. It seems that doing this is safe.
2022-04-11 02:28:25 +01:00
oakkitten
c53aa86a0d Ignore option closeAfterAdding of guiAddCards
The functionality was broken, creating a dialog that was not,
in fact, closing after adding a card.

See the deleted comment in `test_graphical.py`
2022-04-11 02:28:25 +01:00
oakkitten
8d507908c7 Add GitHub workflows tests 2022-04-11 02:28:25 +01:00