point user to manual if they're trying to disable night mode in dark mode

This commit is contained in:
Damien Elmes 2020-02-29 20:44:49 +10:00
parent ba4fe71eba
commit 56b2cc58ed
2 changed files with 24 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import aqt
from anki.lang import _
from aqt import AnkiQt
from aqt.qt import *
from aqt.theme import theme_manager
from aqt.utils import TR, askUser, openHelp, showInfo, showWarning, tr
@ -234,6 +235,11 @@ Not currently enabled; click the sync button in the main window to enable."""
self.form.pasteInvert.setChecked(self.prof.get("pasteInvert", False))
self.form.showPlayButtons.setChecked(self.prof.get("showPlayButtons", True))
self.form.nightMode.setChecked(self.mw.pm.night_mode())
if theme_manager.macos_dark_mode():
self.form.nightMode.setChecked(True)
self.form.nightMode.setText(tr(TR.PREFERENCES_DARK_MODE_ACTIVE))
else:
self.form.nightMode.setChecked(self.mw.pm.night_mode())
self.form.interrupt_audio.setChecked(self.mw.pm.interrupt_audio())
def updateOptions(self):
@ -247,9 +253,17 @@ Not currently enabled; click the sync button in the main window to enable."""
restart_required = True
self.prof["showPlayButtons"] = self.form.showPlayButtons.isChecked()
if self.mw.pm.night_mode() != self.form.nightMode.isChecked():
self.mw.pm.set_night_mode(not self.mw.pm.night_mode())
restart_required = True
if theme_manager.macos_dark_mode():
if not self.form.nightMode.isChecked():
# user is trying to turn it off, but it's forced
showInfo(
tr(TR.PREFERENCES_DARK_MODE_DISABLE), textFormat="rich",
)
openHelp("profileprefs")
else:
if self.mw.pm.night_mode() != self.form.nightMode.isChecked():
self.mw.pm.set_night_mode(not self.mw.pm.night_mode())
restart_required = True
self.mw.pm.set_interrupt_audio(self.form.interrupt_audio.isChecked())

7
qt/ftl/preferences.ftl Normal file
View File

@ -0,0 +1,7 @@
# shown instead of the 'night mode' option when night mode is forced on because
# macOS is in dark mode
preferences-dark-mode-active = macOS is in dark mode
preferences-dark-mode-disable =
To show Anki in light mode while macOS is in dark mode, please
see the Night Mode section of the manual.