Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugin to support Anki 24.06.3 and PyQt 6 #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions cloze_anything/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def onCloze(editor):
if cloze_nums:
next_cloze_num = max(cloze_nums)
# Unless we are reusing, then increment to the next greatest cloze number.
if not editor.mw.app.keyboardModifiers() & Qt.AltModifier:
if not editor.mw.app.keyboardModifiers() & Qt.KeyboardModifier.AltModifier:
next_cloze_num += 1
else:
next_cloze_num = 1
Expand All @@ -137,12 +137,8 @@ def onCloze(editor):

missing_cloze_num = cloze_nums - found_cloze_nums

# There doesn't seem to be an easy way to programmatically update the editor with some arbitrary content
# due to how this is set up in OldEditorAdapter.svelte.
# It seems the best way is to call setField with all the note data, which is basically like reloading the
# editor with all the note content. The downside is that the focus is reset to the beginning of the field.
def callback(arg):
editor.web.eval(get_set_fields_command(editor))
editor.saveNow(lambda: None)

editor.web.evalWithCallback(wrap_command, callback)

Expand Down