Open kkaylan opened 5 years ago
I have the same problem in 2.1.8 with only the add-ons AddNoteID and FrozenFields installed.
Both functions are indispensable for me. I didn't quickly find a proper solution. Meanwhile as a workaround I changed the source code of the file main.py from this add-on: In line 159 I replaced ()
with []
(list instead of an unchangeable tuple) and added three lines below it. This is not a long time fix because it's fixed in the wrong add-on, an update will overwrite this, etc. But it works for me now.
data.append([fld, self.mw.col.media.escapeImages(val)])
for e in data:
if e[0] == 'Note ID': # name of your NoteID field
e[1] = str(self.note.id)
Works perfectly for me, thank you for the fix.
Is there any way to address this in Add note id? I'm not familiar with either python or coding Anki add-ons but I imagine these are the relevant lines from the init.py file of that add-on:
def onLoadNote(self, *args, **kwargs):
for f in self.note.keys():
if f == config["NoteIdFieldName"] and not self.note[f]:
self.note[f] = str(self.note.id - int(15e11))
Thanks for the report and the workarounds, guys. As @ijgnd pointed out, this is difficult to address properly, unfortunately, as Frozen Fields currently requires loadNote to be overwritten. A possible solution would either entail polishing up and merging https://github.com/glutanimate/frozen-fields/pull/5, or possibly submitting a PR to Anki to add some hooks that would make FF's job easier. https://github.com/dae/anki/pull/258 might also provide a viable avenue to a fix.
In any case, I'll see what I can do as soon as I get the chance.
a new add-on was just released on ankiweb anonymously: Ze Add note id
The description is:
An identical copy of "Add note id", except ... It works with Frozen Fields, because "Z" alphabetically comes after "F", as opposed to "A". The things is, "Add Note Id" wraps a function, which "Frozen Fields" overwrites. First wrapping, then overwriting: No. First overwriting, then wrapping: PROFIT!"
This circumvents the problem of this issue. Maybe you could put this into the description of the add-on.
Prerequisite checklist
What is the problem/feature you would like to see fixed/implemented?
If Frozen Fields is installed in Anki 2.1, the Note ID field from the Add note id add-on (see this AnkiWeb entry) fails to populate automatically when making new cards.
How can we reproduce the problem?
I removed add-ons one at a time to determine that removing the Frozen Fields add-on restored automatic population of the Note ID field when making new cards. Freezing and unfreezing the Note ID field does not change whether the field auto-populates.
Expected behavior: I expect the Note ID field to auto-populate even with the Frozen Fields add-on installed.
Actual behavior: The Note ID field fails to auto-populate with the Frozen Fields add-on installed.
Reproducible?: Yes. I have removed all other add-ons and included only the Frozen Fields and Add note id addons and noted that the problem was reproduced.
Version information
Anki
Version 2.1.8 (71e0c880) Qt 5.12.0 PyQt 5.11.3
System