glutanimate / cloze-overlapper

Anki add-on for memorizing lists and enumerations
https://ankiweb.net/shared/info/969733775
Other
229 stars 39 forks source link

Don't flush note when in add mode #80

Open zjosua opened 2 years ago

zjosua commented 2 years ago

Description

Don't flush note when in add mode.

Caught exception:
Traceback (most recent call last):
  File "/home/zjosua/.cache/bazel/_bazel_zjosua/1c79c7ac51bf6692c8fc3f9a9a4ef48a/execroot/ankidesktop/bazel-out/k8-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/webview.py", line 546, in handler
    cb(val)
  File "/home/zjosua/.cache/bazel/_bazel_zjosua/1c79c7ac51bf6692c8fc3f9a9a4ef48a/execroot/ankidesktop/bazel-out/k8-fastbuild/bin/qt/runanki.runfiles/ankidesktop/qt/aqt/editor.py", line 528, in <lambda>
    self.web.evalWithCallback("saveNow(%d)" % keepFocus, lambda res: callback())
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/editor.py", line 154, in <lambda>
    editor.saveNow(lambda: callback(editor, *args, **kwargs))
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/editor.py", line 283, in onOlClozeButton
    return onFieldReady()
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/editor.py", line 270, in onFieldReady
    overlapper.add()
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/overlapper.py", line 117, in add
    self.updateNote(fields, full, setopts, custom)
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/overlapper.py", line 203, in updateNote
    note.flush()
  File "/home/zjosua/.cache/bazel/_bazel_zjosua/1c79c7ac51bf6692c8fc3f9a9a4ef48a/execroot/ankidesktop/bazel-out/k8-fastbuild/bin/qt/runanki.runfiles/ankidesktop/pylib/anki/notes.py", line 81, in flush
    raise Exception("can't flush a new note")
Exception: can't flush a new note

Checklist: