From 73035819a964b2bf47d4883207d765aab5f15dd7 Mon Sep 17 00:00:00 2001 From: Abdo Date: Mon, 26 Sep 2022 04:06:21 +0300 Subject: [PATCH] Fix pm.night_mode() (#2091) * Fix pm.night_mode() * Add deprecation notice (dae) --- qt/aqt/profiles.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index fbf6b1228..1e1a4c284 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -15,6 +15,7 @@ from typing import TYPE_CHECKING, Any import anki.lang import aqt.forms import aqt.sound +from anki._legacy import deprecated from anki.collection import Collection from anki.db import DB from anki.lang import without_unicode_isolation @@ -22,7 +23,7 @@ from anki.sync import SyncAuth from anki.utils import int_time, is_mac, is_win, point_version from aqt import appHelpSite from aqt.qt import * -from aqt.theme import Theme +from aqt.theme import Theme, theme_manager from aqt.utils import disable_help_button, send_to_trash, showWarning, tr if TYPE_CHECKING: @@ -534,11 +535,9 @@ create table if not exists profiles def set_last_addon_update_check(self, secs: int) -> None: self.meta["last_addon_update_check"] = secs + @deprecated(info="use theme_manager.night_mode") def night_mode(self) -> bool: - return self.meta.get("night_mode", False) - - def set_night_mode(self, on: bool) -> None: - self.meta["night_mode"] = on + return theme_manager.night_mode def theme(self) -> Theme: return Theme(self.meta.get("theme", 0))