2 Commits

Author SHA1 Message Date
734f24646e Remove the usage of deprecated function.
mv.pm.night_mode() is deprecated (see
1ed2cce648/qt/aqt/profiles.py (L537)).
Furthermore, on anki Version ⁨2.1.54, Python 3.9.10 Qt 6.3.1 PyQt 6.3.1, this function returns false, even when the dark mode is set.
2022-12-14 08:36:12 +01:00
58cd3cec42 Build changes for PR #7 2022-10-10 18:59:30 +02:00
3 changed files with 5 additions and 5 deletions

3
.gitignore vendored
View File

@ -166,3 +166,6 @@ tags
# End of https://www.toptal.com/developers/gitignore/api/vim,python # End of https://www.toptal.com/developers/gitignore/api/vim,python
*.ankiaddon *.ankiaddon
.DS_Store .DS_Store
# Stores actual addon config if the src directory is symlinked into an anki installation during development
src/meta.json

View File

@ -6,6 +6,6 @@ if [ -d src/__pycache__ ]; then
fi fi
cd src cd src
zip -r ../editor-preview.ankiaddon * zip -r ../editor-preview.ankiaddon --exclude meta.json -- *
cd .. cd ..
unzip -l editor-preview.ankiaddon unzip -l editor-preview.ankiaddon

View File

@ -82,10 +82,7 @@ class EditorPreview(object):
c = note.ephemeral_card() c = note.ephemeral_card()
a = mw.prepare_card_text_for_display(c.answer()) a = mw.prepare_card_text_for_display(c.answer())
a = gui_hooks.card_will_show(a, c, "clayoutAnswer") a = gui_hooks.card_will_show(a, c, "clayoutAnswer")
if theme_manager.night_mode: bodyclass = theme_manager.body_classes_for_card_ord(c.ord, theme_manager.night_mode)
bodyclass = theme_manager.body_classes_for_card_ord(c.ord, mw.pm.night_mode())
else:
bodyclass = theme_manager.body_classes_for_card_ord(c.ord)
bodyclass += " editor-preview" bodyclass += " editor-preview"
return f"_showAnswer({json.dumps(a)},'{bodyclass}');" return f"_showAnswer({json.dumps(a)},'{bodyclass}');"