Add a setting to keep theme colours on documents when using override

This commit is contained in:
Veronica Berglyd Olsen
2025-01-11 00:48:09 +01:00
parent c3c24d5533
commit 5bf113de23
4 changed files with 22 additions and 6 deletions
+3
View File
@@ -124,6 +124,7 @@ class Config:
# Icons
self.iconTheme = "material_rounded_normal" # Icons theme
self.iconColTree = "theme" # Project tree icon colours
self.iconColDocs = False # Keep theme colours on documents
# Size Settings
self._mainWinSize = [1200, 650] # Last size of the main GUI window
@@ -611,6 +612,7 @@ class Config:
self.guiSyntax = conf.rdStr(sec, "syntax", self.guiSyntax)
self.iconTheme = conf.rdStr(sec, "icons", self.iconTheme)
self.iconColTree = conf.rdStr(sec, "iconcoltree", self.iconColTree)
self.iconColDocs = conf.rdBool(sec, "iconcoldocs", self.iconColDocs)
self.guiLocale = conf.rdStr(sec, "localisation", self.guiLocale)
self.hideVScroll = conf.rdBool(sec, "hidevscroll", self.hideVScroll)
self.hideHScroll = conf.rdBool(sec, "hidehscroll", self.hideHScroll)
@@ -724,6 +726,7 @@ class Config:
"syntax": str(self.guiSyntax),
"icons": str(self.iconTheme),
"iconcoltree": str(self.iconColTree),
"iconcoldocs": str(self.iconColDocs),
"localisation": str(self.guiLocale),
"hidevscroll": str(self.hideVScroll),
"hidehscroll": str(self.hideHScroll),
+11
View File
@@ -200,6 +200,14 @@ class GuiPreferences(NDialog):
self.tr("Override colours for project icons."), stretch=(3, 2)
)
# Keep Theme Colours on Documents
self.iconColDocs = NSwitch(self)
self.iconColDocs.setChecked(CONFIG.iconColDocs)
self.mainForm.addRow(
self.tr("Keep theme colours on documents"), self.iconColDocs,
self.tr("Only override icon colours for folders.")
)
# Application Font Family
self.guiFont = QLineEdit(self)
self.guiFont.setReadOnly(True)
@@ -928,10 +936,12 @@ class GuiPreferences(NDialog):
guiTheme = self.guiTheme.currentData()
iconTheme = self.iconTheme.currentData()
iconColTree = self.iconColTree.currentData()
iconColDocs = self.iconColDocs.isChecked()
updateTheme |= CONFIG.guiTheme != guiTheme
updateTheme |= CONFIG.iconTheme != iconTheme
updateTheme |= CONFIG.iconColTree != iconColTree
updateTheme |= CONFIG.iconColDocs != iconColDocs
needsRestart |= CONFIG.guiLocale != guiLocale
needsRestart |= CONFIG.guiFont != self._guiFont
@@ -939,6 +949,7 @@ class GuiPreferences(NDialog):
CONFIG.guiTheme = guiTheme
CONFIG.iconTheme = iconTheme
CONFIG.iconColTree = iconColTree
CONFIG.iconColDocs = iconColDocs
CONFIG.hideVScroll = self.hideVScroll.isChecked()
CONFIG.hideHScroll = self.hideHScroll.isChecked()
CONFIG.nativeFont = self.nativeFont.isChecked()
+6 -5
View File
@@ -607,11 +607,12 @@ class GuiIcons:
color = self._svgColours.get(override, b"#000000")
self._svgColours["root"] = color
self._svgColours["folder"] = color
self._svgColours["file"] = color
self._svgColours["title"] = color
self._svgColours["chapter"] = color
self._svgColours["scene"] = color
self._svgColours["note"] = color
if not CONFIG.iconColDocs:
self._svgColours["file"] = color
self._svgColours["title"] = color
self._svgColours["chapter"] = color
self._svgColours["scene"] = color
self._svgColours["note"] = color
return True
+2 -1
View File
@@ -1,5 +1,5 @@
[Meta]
timestamp = 2025-01-10 02:00:06
timestamp = 2025-01-11 00:46:32
[Main]
font =
@@ -7,6 +7,7 @@ theme = default
syntax = default_light
icons = material_rounded_normal
iconcoltree = theme
iconcoldocs = False
localisation = en_GB
hidevscroll = False
hidehscroll = False