Add character count setting to Preferences
This commit is contained in:
@@ -225,6 +225,14 @@ class GuiPreferences(NDialog):
|
|||||||
self.tr("Turn off to use the Qt font dialog, which may have more options.")
|
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
|
# Document Style
|
||||||
# ==============
|
# ==============
|
||||||
|
|
||||||
@@ -957,21 +965,24 @@ class GuiPreferences(NDialog):
|
|||||||
refreshTree = False
|
refreshTree = False
|
||||||
|
|
||||||
# Appearance
|
# Appearance
|
||||||
guiLocale = self.guiLocale.currentData()
|
guiLocale = self.guiLocale.currentData()
|
||||||
guiTheme = self.guiTheme.currentData()
|
guiTheme = self.guiTheme.currentData()
|
||||||
iconTheme = self.iconTheme.currentData()
|
iconTheme = self.iconTheme.currentData()
|
||||||
|
useCharCount = self.useCharCount.isChecked()
|
||||||
|
|
||||||
updateTheme |= CONFIG.guiTheme != guiTheme
|
updateTheme |= CONFIG.guiTheme != guiTheme
|
||||||
updateTheme |= CONFIG.iconTheme != iconTheme
|
updateTheme |= CONFIG.iconTheme != iconTheme
|
||||||
needsRestart |= CONFIG.guiLocale != guiLocale
|
needsRestart |= CONFIG.guiLocale != guiLocale
|
||||||
needsRestart |= CONFIG.guiFont != self._guiFont
|
needsRestart |= CONFIG.guiFont != self._guiFont
|
||||||
|
refreshTree |= CONFIG.useCharCount != useCharCount
|
||||||
|
|
||||||
CONFIG.guiLocale = guiLocale
|
CONFIG.guiLocale = guiLocale
|
||||||
CONFIG.guiTheme = guiTheme
|
CONFIG.guiTheme = guiTheme
|
||||||
CONFIG.iconTheme = iconTheme
|
CONFIG.iconTheme = iconTheme
|
||||||
CONFIG.hideVScroll = self.hideVScroll.isChecked()
|
CONFIG.hideVScroll = self.hideVScroll.isChecked()
|
||||||
CONFIG.hideHScroll = self.hideHScroll.isChecked()
|
CONFIG.hideHScroll = self.hideHScroll.isChecked()
|
||||||
CONFIG.nativeFont = self.nativeFont.isChecked()
|
CONFIG.nativeFont = self.nativeFont.isChecked()
|
||||||
|
CONFIG.useCharCount = useCharCount
|
||||||
CONFIG.setGuiFont(self._guiFont)
|
CONFIG.setGuiFont(self._guiFont)
|
||||||
|
|
||||||
# Document Style
|
# Document Style
|
||||||
|
|||||||
@@ -163,14 +163,17 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
|||||||
mp.setattr(QFontDialog, "getFont", lambda *a, **k: (QFont(), True))
|
mp.setattr(QFontDialog, "getFont", lambda *a, **k: (QFont(), True))
|
||||||
prefs.nativeFont.setChecked(True) # Use OS font dialog
|
prefs.nativeFont.setChecked(True) # Use OS font dialog
|
||||||
prefs.guiFontButton.click()
|
prefs.guiFontButton.click()
|
||||||
|
|
||||||
prefs.hideVScroll.setChecked(True)
|
prefs.hideVScroll.setChecked(True)
|
||||||
prefs.hideHScroll.setChecked(True)
|
prefs.hideHScroll.setChecked(True)
|
||||||
|
prefs.useCharCount.setChecked(True)
|
||||||
|
|
||||||
assert CONFIG.guiLocale != "en_US"
|
assert CONFIG.guiLocale != "en_US"
|
||||||
assert CONFIG.guiTheme != "default_dark"
|
assert CONFIG.guiTheme != "default_dark"
|
||||||
assert CONFIG.guiFont.family() != ""
|
assert CONFIG.guiFont.family() != ""
|
||||||
assert CONFIG.hideVScroll is False
|
assert CONFIG.hideVScroll is False
|
||||||
assert CONFIG.hideHScroll is False
|
assert CONFIG.hideHScroll is False
|
||||||
|
assert CONFIG.useCharCount is False
|
||||||
|
|
||||||
# Document Style
|
# Document Style
|
||||||
prefs.guiSyntax.setCurrentIndex(prefs.guiSyntax.findData("default_dark"))
|
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))
|
mp.setattr(QFontDialog, "getFont", lambda *a, **k: (QFont(), True))
|
||||||
prefs.nativeFont.setChecked(False) # Use Qt font dialog
|
prefs.nativeFont.setChecked(False) # Use Qt font dialog
|
||||||
prefs.textFontButton.click()
|
prefs.textFontButton.click()
|
||||||
|
|
||||||
prefs.showFullPath.setChecked(False)
|
prefs.showFullPath.setChecked(False)
|
||||||
prefs.incNotesWCount.setChecked(False)
|
prefs.incNotesWCount.setChecked(False)
|
||||||
|
|
||||||
@@ -344,6 +348,7 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
|||||||
assert CONFIG.guiFont == QFont()
|
assert CONFIG.guiFont == QFont()
|
||||||
assert CONFIG.hideVScroll is True
|
assert CONFIG.hideVScroll is True
|
||||||
assert CONFIG.hideHScroll is True
|
assert CONFIG.hideHScroll is True
|
||||||
|
assert CONFIG.useCharCount is True
|
||||||
|
|
||||||
# Document Style
|
# Document Style
|
||||||
assert CONFIG.guiSyntax == "default_dark"
|
assert CONFIG.guiSyntax == "default_dark"
|
||||||
|
|||||||
Reference in New Issue
Block a user