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 # Icons
self.iconTheme = "material_rounded_normal" # Icons theme self.iconTheme = "material_rounded_normal" # Icons theme
self.iconColTree = "theme" # Project tree icon colours self.iconColTree = "theme" # Project tree icon colours
self.iconColDocs = False # Keep theme colours on documents
# Size Settings # Size Settings
self._mainWinSize = [1200, 650] # Last size of the main GUI window 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.guiSyntax = conf.rdStr(sec, "syntax", self.guiSyntax)
self.iconTheme = conf.rdStr(sec, "icons", self.iconTheme) self.iconTheme = conf.rdStr(sec, "icons", self.iconTheme)
self.iconColTree = conf.rdStr(sec, "iconcoltree", self.iconColTree) 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.guiLocale = conf.rdStr(sec, "localisation", self.guiLocale)
self.hideVScroll = conf.rdBool(sec, "hidevscroll", self.hideVScroll) self.hideVScroll = conf.rdBool(sec, "hidevscroll", self.hideVScroll)
self.hideHScroll = conf.rdBool(sec, "hidehscroll", self.hideHScroll) self.hideHScroll = conf.rdBool(sec, "hidehscroll", self.hideHScroll)
@@ -724,6 +726,7 @@ class Config:
"syntax": str(self.guiSyntax), "syntax": str(self.guiSyntax),
"icons": str(self.iconTheme), "icons": str(self.iconTheme),
"iconcoltree": str(self.iconColTree), "iconcoltree": str(self.iconColTree),
"iconcoldocs": str(self.iconColDocs),
"localisation": str(self.guiLocale), "localisation": str(self.guiLocale),
"hidevscroll": str(self.hideVScroll), "hidevscroll": str(self.hideVScroll),
"hidehscroll": str(self.hideHScroll), "hidehscroll": str(self.hideHScroll),
+11
View File
@@ -200,6 +200,14 @@ class GuiPreferences(NDialog):
self.tr("Override colours for project icons."), stretch=(3, 2) 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 # Application Font Family
self.guiFont = QLineEdit(self) self.guiFont = QLineEdit(self)
self.guiFont.setReadOnly(True) self.guiFont.setReadOnly(True)
@@ -928,10 +936,12 @@ class GuiPreferences(NDialog):
guiTheme = self.guiTheme.currentData() guiTheme = self.guiTheme.currentData()
iconTheme = self.iconTheme.currentData() iconTheme = self.iconTheme.currentData()
iconColTree = self.iconColTree.currentData() iconColTree = self.iconColTree.currentData()
iconColDocs = self.iconColDocs.isChecked()
updateTheme |= CONFIG.guiTheme != guiTheme updateTheme |= CONFIG.guiTheme != guiTheme
updateTheme |= CONFIG.iconTheme != iconTheme updateTheme |= CONFIG.iconTheme != iconTheme
updateTheme |= CONFIG.iconColTree != iconColTree updateTheme |= CONFIG.iconColTree != iconColTree
updateTheme |= CONFIG.iconColDocs != iconColDocs
needsRestart |= CONFIG.guiLocale != guiLocale needsRestart |= CONFIG.guiLocale != guiLocale
needsRestart |= CONFIG.guiFont != self._guiFont needsRestart |= CONFIG.guiFont != self._guiFont
@@ -939,6 +949,7 @@ class GuiPreferences(NDialog):
CONFIG.guiTheme = guiTheme CONFIG.guiTheme = guiTheme
CONFIG.iconTheme = iconTheme CONFIG.iconTheme = iconTheme
CONFIG.iconColTree = iconColTree CONFIG.iconColTree = iconColTree
CONFIG.iconColDocs = iconColDocs
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()
+6 -5
View File
@@ -607,11 +607,12 @@ class GuiIcons:
color = self._svgColours.get(override, b"#000000") color = self._svgColours.get(override, b"#000000")
self._svgColours["root"] = color self._svgColours["root"] = color
self._svgColours["folder"] = color self._svgColours["folder"] = color
self._svgColours["file"] = color if not CONFIG.iconColDocs:
self._svgColours["title"] = color self._svgColours["file"] = color
self._svgColours["chapter"] = color self._svgColours["title"] = color
self._svgColours["scene"] = color self._svgColours["chapter"] = color
self._svgColours["note"] = color self._svgColours["scene"] = color
self._svgColours["note"] = color
return True return True
+2 -1
View File
@@ -1,5 +1,5 @@
[Meta] [Meta]
timestamp = 2025-01-10 02:00:06 timestamp = 2025-01-11 00:46:32
[Main] [Main]
font = font =
@@ -7,6 +7,7 @@ theme = default
syntax = default_light syntax = default_light
icons = material_rounded_normal icons = material_rounded_normal
iconcoltree = theme iconcoltree = theme
iconcoldocs = False
localisation = en_GB localisation = en_GB
hidevscroll = False hidevscroll = False
hidehscroll = False hidehscroll = False