Commit Graph

137 Commits

Author SHA1 Message Date
Antistic
0012245c57 add new action: answerCards 2023-06-14 19:38:50 +01:00
YuLong Yao
53dba8003b
api: add guiUndo action 2023-05-18 19:56:48 +08:00
Austin Siew
accbc53e5d added modelTemplateRename, modelTemplateReposition, modelTemplateAdd, modelTemplateRemove 2023-04-13 19:30:49 -06:00
Austin Siew
ed508babbf merged with master 2023-03-31 00:54:32 -06:00
Ren Tatsumoto
58283bdeb5 add a new action: getMediaDirPath 2023-03-21 19:47:31 +03:00
Austin Siew
a275971002 fixed formatting issue 2023-01-09 21:23:43 -07:00
Austin Siew
2ad03ddbc0 added anki 2.1.54 and 2.1.55 tests & fixed NotFoundError not working on 2.1.55 2022-12-30 20:26:58 -07:00
introt
2f50c747fb Add getNoteTags, updateNoteTags and updateNote
getNoteTags returns [str ...] of tags for a given note (note: int)

updateNoteTags removes the existing tags and sets new tags

updateNote combines the old updateNoteFields and the new updateNoteTags

Closes #369
2022-12-30 13:13:31 +02:00
Austin Siew
69baea296a added tests & documentation, removed dead code 2022-12-28 18:37:05 -07:00
Austin Siew
2d54eccb64 added modelFieldSetDescription, changed double quote strings to single quote strings 2022-12-24 04:18:24 -07:00
Austin Siew
59f75a2946 added modelFieldFonts, modelFieldSetFont, modelFieldSetFontSize 2022-12-24 04:10:56 -07:00
introt
ff4fb13428 Fix KeyError in modelFieldDescriptions
on older Anki versions, where field descriptions aren't available
2022-11-27 12:19:58 +02:00
introt
336dc8bb31 Added modelFieldDescriptions
Similar to modelFieldNames, returns a list of
note field decriptions (the text seen in the gui
editor when the field is empty)
2022-11-26 14:56:34 +02:00
Alexei Yatskov
82ca4b847d
Merge pull request #350 from Aquafina-water-bottle/get_reviews_of_card
Added getReviewsOfCards
2022-09-20 17:53:03 -07:00
Austin Siew
a8905a4c22 getReviewsOfCards: changed inner lists into dictionaries, removed cid within the inner list 2022-09-20 17:46:26 -06:00
Austin Siew
c0c922d27c changed getReviewsOfCard -> getReviewsOfCards, changed result to be formatted in a dictionary rather than a list 2022-09-13 17:12:20 -06:00
Scott Noyes
6f87f03519 Fix issue #352 2022-09-12 09:07:59 -05:00
Austin Siew
6e4bbfa0d6 Added getReviewsOfCard 2022-09-05 00:29:03 -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
ebdca1db6b Added model field name api points and skeleton documentation to README 2022-08-16 19:23:09 -06: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
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
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
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
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
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
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
8aa5fdd1de Add api method guiEditNote 2022-04-11 02:28:25 +01:00
oakkitten
ddad426563 Do not wrap api methods with a lambda
Makes Pycharm happy
2022-04-11 02:26:44 +01:00
oakkitten
cfc6b0d012 Move configuration defaults dict to module level
So that it is importable by tests
2022-04-11 02:26:44 +01:00
oakkitten
f7d5cbbd04 Edit dialog: refactor
* make previewer use a more generic Adapter to flip through cards;
* return Previewer from `show_preview()` for testing,
* as well as Edit dialog from `open_dialog_and_show_note_with_id`;
* disable/enable `Edit` editor buttons more reliably;
* a few minor changes
2022-04-11 02:26:35 +01:00
oakkitten
748310def4 Make plugin importable
Don't start the web server if imported not from inside Anki

Make sure Anki Connect instance is not garbage collected.
This kills the timer that's responsible for the web server.
2022-04-07 09:48:37 +01:00
oakkitten
d6061affad Remove api method updateCompleteDeck
This method was broken and there are no issues regarding it on GitHub.
2022-04-07 09:48:37 +01:00
oakkitten
eac658716a Fix api method findAndReplaceInModels
I think this was a typo?
2022-04-07 09:48:37 +01:00
oakkitten
baed642489 Fix api method deleteDecks
The method was failing due to Anki API changes.

Also, make it mandatory to call the method with `cardsToo=True`,
since deleting decks on Anki >= 2.1.28 without cards is
no longer supported, and the deprecated `decks.rem()` method
on Anki >= 2.1.45 ignores keyword arguments.
2022-04-07 09:48:37 +01:00
oakkitten
0fdc93abc6 Add Edit dialog
Like Edit Current, but:
  * has a Preview button to preview all cards for this note
  * has a Browse button to open the browser with these
  * has Previous/Back buttons to navigate the history of the dialog
  * has no Close button bar
2022-04-07 09:48:37 +01:00