Update ankiconnect.py

This commit is contained in:
恍兮惚兮 2024-08-07 23:58:43 +08:00
parent 0f25577411
commit b2396f109f

View File

@ -91,22 +91,14 @@ class Card:
class Model:
@staticmethod
def create(modelName, inOrderFields: list, css, isCloze, cardTemplates):
try:
print(
invoke(
"createModel",
modelName=modelName,
inOrderFields=inOrderFields,
css=css,
isCloze=isCloze,
cardTemplates=cardTemplates,
)
)
except AnkiException as e:
if str(e) == "Model name already exists":
pass
else:
raise e
invoke(
"createModel",
modelName=modelName,
inOrderFields=inOrderFields,
css=css,
isCloze=isCloze,
cardTemplates=cardTemplates,
)
return Model(modelName)
def __init__(self, name):