Hi
This is the official support thread for https://ankiweb.net/shared/info/1964372878 .
Hi
This is the official support thread for https://ankiweb.net/shared/info/1964372878 .
I donāt know if this is the correct way to start a topic.
My question is, suddenly the colorizer add-on is creating stroke order diagrams for kana. I only want it for kanji, which is how it used to be. Is there a way to turn off the kana aspect? Thanks.
There isnāt, but Iāll add a config option for that in the next release.
Thanks!
Iāve just uploaded a version with this change. In addition to the current behavior, you can configure it to never generate diagrams for anything but kanji or to always generate diagrams for all characters.
Works like a charm - thanks!
Installed the add-on and did multi restarts.
Stroke Kanji is not showing up in Diagram field.
Running on MacOS Catalina 10.15.6
Does this happen both when editing the card (it doesnāt update until you leave the field) and when using the menu items?
More information that might be helpful: what version of anki and what version of kanjicolorize are you running? Can you post your full config for kanji colorize and the name of the model and its source and destination fields?
the addon suddenly stops working.
Hello, Iāve been running into this error, I havenāt touched the addon files at all. I tried restarting anki and creating a new profile with just my kanjis deck but neither made the error go away. Help would be appreciated!
Debug info:
Anki 2.1.34 (8af8f565) Python 3.8.0 Qt 5.15.1 PyQt 5.15.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-10-08 22:53:25
Caught exception:
Traceback (most recent call last):
File āC:\Users\Gooifgeffpawkek\AppData\Roaming\Anki2\addons21\1964372878\kanji_colorizer.pyā, line 189, in generate_for_new
for note_id in mw.col.findNotes(search_str):
File āanki\collection.pyā, line 453, in find_notes
File āanki\rsbackend_gen.pyā, line 88, in search_notes
File āanki\rsbackend.pyā, line 267, in _run_command
anki.rsbackend.InvalidInput: Invalid search - please check for typing mistakes.
This can happen if there arenāt any models that match your config. Have you checked your source, destination, and model settings?
I just released a version with a better message in this case.
Besides the above error message, the newly released version also includes a user contribution with a setting to not overwrite the destination field if it already has something in it.
I canāt help without more specific information. What are you trying to do? What is happening instead? What changed between when it was working and when it wasnāt working.
Hello! I just installed this addon, and Iām having a problem with getting the stroke order diagram to show up in a card. It doesnāt show up in Browse>Card customization, or when I try to actually study the card. I followed (to my knowledge) all the directions on how to add the stroke order diagram (with how everything should be named an such) and it shows up and seems to work fine during the process of creating a new card, just not as I mentioned above. I have tried restarting Anki.
Iām on Windows 10 with Anki Version āØ2.1.37. Iām not sure which version of the add-on, but I guess the latest as of December 14th, 2020, as I downloaded it today? (Iām slightly tech illiterate, so Iām very sorry if thereās something obvious I missed.)
Hi. It sounds like maybe you just havenāt generated diagrams for your existing cards. Thatās at tools > kanji colorize > generate all new.
Hi - Iāve made some modifications to the code so that the config src and dest fields donāt have to be exactly spelled out (used the āinā) keyword. Also, allowed there to be multiple diagram fields so that each kanji in a compound can be written to a different field. Are you interested in seeing my modifications?
Thanks, yes those do sound potentially useful to other people.
Iāve attached the file I made the changes in, let me know if you have any
questions!
(Attachment kanji_colorizer.py is missing)
Iāve attached the file with my changes, apologies for the delay! I had tried to just attach it without modifying the file extension, but that was rejected by the mail server.
(Attachment kanji_colorizer-multidiag.txt is missing)
Because the forums wonāt allow txt or py attachments, Iām copying and pasting my changes in - hopefully with enough context that you can tell where they go
from kanjicolorizer.colorizer import (KanjiVG, KanjiColorizer,
InvalidCharacterError)
import string
import re
srcField = ā(word.Kanji.)ā
dstField = ā(.iagram.)ā
ā¦
model_name = model[ānameā].lower()
dstMatch = None
srcMatch = None
for name in mw.col.models.fieldNames(model):
if dstMatch == None:
dstMatch = re.match(dstField,name,re.IGNORECASE)
if srcMatch == None:
srcMatch = re.match(srcField,name,re.IGNORECASE)
if dstMatch != None and srcMatch != None:
break
return (ākanjiā in model_name and srcMatch and dstMatch)
ā¦
if currentFieldIndex != None: # Weāve left a field
match = re.match(srcField,note.model()[āfldsā][currentFieldIndex][ānameā],re.IGNORECASE)
if match == None:
return None
else: #Weāre regenerating so need to find the src field
for name in mw.col.models.fieldNames(note.model()):
match = re.match(srcField,name,re.IGNORECASE)
if match:
break
srcTxt = mw.col.media.strip(note[match.group(1)])
destinationNames =[]
for name in mw.col.models.fieldNames(note.model()):
dstMatch = re.match(dstField,name,re.IGNORECASE)
if dstMatch != None:
destinationNames.append(name)
destIndex = 0
dst = āā
for character in characters_to_colorize(unicode(srcTxt)):
try:
filename = KanjiVG(character).ascii_filename
except InvalidCharacterError:
continue
char_svg = kc.get_colored_svg(character).encode(āutf_8ā)
anki_fname = mw.col.media.writeData(unicode(filename, āutf_8ā), char_svg)
strokeFileName = āā.format(anki_fname).encode(āutf_8ā)
if len(destinationNames) > 1:
note[destinationNames[destIndex]] = strokeFileName
destIndex += 1
flag = True
else:
dst += strokeFileName
note[destinationNames[0]] = dst
flag =True
note.flush()
return flag
Hope this finally gets to you, apologies for the delay