diff --git a/novelwriter/dialogs/preferences.py b/novelwriter/dialogs/preferences.py index aa4f9cd1..e4bb4bbd 100644 --- a/novelwriter/dialogs/preferences.py +++ b/novelwriter/dialogs/preferences.py @@ -225,6 +225,14 @@ class GuiPreferences(NDialog): self.tr("Turn off to use the Qt font dialog, which may have more options.") ) + # Use Character Count + self.useCharCount = NSwitch(self) + self.useCharCount.setChecked(CONFIG.useCharCount) + self.mainForm.addRow( + self.tr("Prefer character count over word count"), self.useCharCount, + self.tr("Display character count instead where available.") + ) + # Document Style # ============== @@ -957,21 +965,24 @@ class GuiPreferences(NDialog): refreshTree = False # Appearance - guiLocale = self.guiLocale.currentData() - guiTheme = self.guiTheme.currentData() - iconTheme = self.iconTheme.currentData() + guiLocale = self.guiLocale.currentData() + guiTheme = self.guiTheme.currentData() + iconTheme = self.iconTheme.currentData() + useCharCount = self.useCharCount.isChecked() updateTheme |= CONFIG.guiTheme != guiTheme updateTheme |= CONFIG.iconTheme != iconTheme needsRestart |= CONFIG.guiLocale != guiLocale needsRestart |= CONFIG.guiFont != self._guiFont + refreshTree |= CONFIG.useCharCount != useCharCount - CONFIG.guiLocale = guiLocale - CONFIG.guiTheme = guiTheme - CONFIG.iconTheme = iconTheme - CONFIG.hideVScroll = self.hideVScroll.isChecked() - CONFIG.hideHScroll = self.hideHScroll.isChecked() - CONFIG.nativeFont = self.nativeFont.isChecked() + CONFIG.guiLocale = guiLocale + CONFIG.guiTheme = guiTheme + CONFIG.iconTheme = iconTheme + CONFIG.hideVScroll = self.hideVScroll.isChecked() + CONFIG.hideHScroll = self.hideHScroll.isChecked() + CONFIG.nativeFont = self.nativeFont.isChecked() + CONFIG.useCharCount = useCharCount CONFIG.setGuiFont(self._guiFont) # Document Style diff --git a/tests/test_dialogs/test_dlg_preferences.py b/tests/test_dialogs/test_dlg_preferences.py index c7a1b7e4..8e0edfa9 100644 --- a/tests/test_dialogs/test_dlg_preferences.py +++ b/tests/test_dialogs/test_dlg_preferences.py @@ -163,14 +163,17 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths): mp.setattr(QFontDialog, "getFont", lambda *a, **k: (QFont(), True)) prefs.nativeFont.setChecked(True) # Use OS font dialog prefs.guiFontButton.click() + prefs.hideVScroll.setChecked(True) prefs.hideHScroll.setChecked(True) + prefs.useCharCount.setChecked(True) assert CONFIG.guiLocale != "en_US" assert CONFIG.guiTheme != "default_dark" assert CONFIG.guiFont.family() != "" assert CONFIG.hideVScroll is False assert CONFIG.hideHScroll is False + assert CONFIG.useCharCount is False # Document Style prefs.guiSyntax.setCurrentIndex(prefs.guiSyntax.findData("default_dark")) @@ -178,6 +181,7 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths): mp.setattr(QFontDialog, "getFont", lambda *a, **k: (QFont(), True)) prefs.nativeFont.setChecked(False) # Use Qt font dialog prefs.textFontButton.click() + prefs.showFullPath.setChecked(False) prefs.incNotesWCount.setChecked(False) @@ -344,6 +348,7 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths): assert CONFIG.guiFont == QFont() assert CONFIG.hideVScroll is True assert CONFIG.hideHScroll is True + assert CONFIG.useCharCount is True # Document Style assert CONFIG.guiSyntax == "default_dark"