From 734f24646e5b8d04ad0c5fdfcde34cbd0032b7b9 Mon Sep 17 00:00:00 2001 From: Premysl Bednarek Date: Wed, 14 Dec 2022 08:36:12 +0100 Subject: [PATCH] Remove the usage of deprecated function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mv.pm.night_mode() is deprecated (see https://github.com/ankitects/anki/blob/1ed2cce648ee3168ca97e005b993a2953cdb7536/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. --- src/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/__init__.py b/src/__init__.py index 76f84e0..0f6082f 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -82,10 +82,7 @@ class EditorPreview(object): c = note.ephemeral_card() a = mw.prepare_card_text_for_display(c.answer()) a = gui_hooks.card_will_show(a, c, "clayoutAnswer") - if 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 = theme_manager.body_classes_for_card_ord(c.ord, theme_manager.night_mode) bodyclass += " editor-preview" return f"_showAnswer({json.dumps(a)},'{bodyclass}');"