Remove syntax theme parsing and add light and dark theme user settings
This commit is contained in:
+28
-24
@@ -45,6 +45,7 @@ from novelwriter.common import (
|
||||
formatTimeStamp, processDialogSymbols, simplified
|
||||
)
|
||||
from novelwriter.constants import nwFiles, nwHtmlUnicode, nwQuotes, nwUnicode
|
||||
from novelwriter.enum import nwTheme
|
||||
from novelwriter.error import formatException, logException
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -55,8 +56,8 @@ if TYPE_CHECKING:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DEF_GUI = "default"
|
||||
DEF_SYNTAX = "default_light"
|
||||
DEF_GUI_DARK = "default_dark"
|
||||
DEF_GUI_LIGHT = "default_light"
|
||||
DEF_ICONS = "material_rounded_normal"
|
||||
DEF_TREECOL = "theme"
|
||||
|
||||
@@ -69,22 +70,22 @@ class Config:
|
||||
"_manuals", "_nwLangPath", "_qLocale", "_qtLangPath", "_qtTrans", "_recentPaths",
|
||||
"_recentProjects", "_splash", "allowOpenDial", "altDialogClose", "altDialogOpen",
|
||||
"appHandle", "appName", "askBeforeBackup", "askBeforeExit", "autoSaveDoc", "autoSaveProj",
|
||||
"autoScroll", "autoScrollPos", "autoSelect", "backupOnClose", "cursorWidth", "dialogLine",
|
||||
"dialogStyle", "doJustify", "doReplace", "doReplaceDQuote", "doReplaceDash",
|
||||
"autoScroll", "autoScrollPos", "autoSelect", "backupOnClose", "cursorWidth", "darkTheme",
|
||||
"dialogLine", "dialogStyle", "doJustify", "doReplace", "doReplaceDQuote", "doReplaceDash",
|
||||
"doReplaceDots", "doReplaceSQuote", "emphLabels", "fmtApostrophe", "fmtDQuoteClose",
|
||||
"fmtDQuoteOpen", "fmtPadAfter", "fmtPadBefore", "fmtPadThin", "fmtSQuoteClose",
|
||||
"fmtSQuoteOpen", "focusWidth", "guiFont", "guiLocale", "guiSyntax", "guiTheme",
|
||||
"hasEnchant", "hideFocusFooter", "hideHScroll", "hideVScroll", "highlightEmph", "hostName",
|
||||
"iconColDocs", "iconColTree", "iconTheme", "incNotesWCount", "isDebug", "kernelVer",
|
||||
"lastNotes", "mainPanePos", "mainWinSize", "memInfo", "narratorBreak", "narratorDialog",
|
||||
"nativeFont", "osDarwin", "osLinux", "osType", "osUnknown", "osWindows", "outlinePanePos",
|
||||
"fmtSQuoteOpen", "focusWidth", "guiFont", "guiLocale", "hasEnchant", "hideFocusFooter",
|
||||
"hideHScroll", "hideVScroll", "highlightEmph", "hostName", "iconColDocs", "iconColTree",
|
||||
"iconTheme", "incNotesWCount", "isDebug", "kernelVer", "lastNotes", "lightTheme",
|
||||
"mainPanePos", "mainWinSize", "memInfo", "narratorBreak", "narratorDialog", "nativeFont",
|
||||
"osDarwin", "osLinux", "osType", "osUnknown", "osWindows", "outlinePanePos",
|
||||
"prefsWinSize", "scrollPastEnd", "searchCase", "searchLoop", "searchMatchCap",
|
||||
"searchNextFile", "searchProjCase", "searchProjRegEx", "searchProjWord", "searchRegEx",
|
||||
"searchWord", "showEditToolBar", "showFullPath", "showLineEndings", "showMultiSpaces",
|
||||
"showSessionTime", "showTabsNSpaces", "showViewerPanel", "spellLanguage", "stopWhenIdle",
|
||||
"tabWidth", "textFont", "textMargin", "textWidth", "useCharCount", "userIdleTime",
|
||||
"verPyQtString", "verPyQtValue", "verPyString", "verQtString", "verQtValue",
|
||||
"viewComments", "viewPanePos", "viewSynopsis", "welcomeWinSize",
|
||||
"tabWidth", "textFont", "textMargin", "textWidth", "themeMode", "useCharCount",
|
||||
"userIdleTime", "verPyQtString", "verPyQtValue", "verPyString", "verQtString",
|
||||
"verQtValue", "viewComments", "viewPanePos", "viewSynopsis", "welcomeWinSize",
|
||||
)
|
||||
|
||||
LANG_NW = 1
|
||||
@@ -153,14 +154,15 @@ class Config:
|
||||
|
||||
# General GUI Settings
|
||||
self.guiLocale = self._qLocale.name()
|
||||
self.guiTheme = DEF_GUI # GUI theme
|
||||
self.guiSyntax = DEF_SYNTAX # Syntax theme
|
||||
self.guiFont = QFont() # Main GUI font
|
||||
self.hideVScroll = False # Hide vertical scroll bars on main widgets
|
||||
self.hideHScroll = False # Hide horizontal scroll bars on main widgets
|
||||
self.lastNotes = "0x0" # The latest release notes that have been shown
|
||||
self.nativeFont = True # Use native font dialog
|
||||
self.useCharCount = False # Use character count as primary count
|
||||
self.lightTheme = DEF_GUI_LIGHT # Light GUI theme
|
||||
self.darkTheme = DEF_GUI_DARK # Dark GUI theme
|
||||
self.themeMode = nwTheme.AUTO # Colour theme mode
|
||||
self.guiFont = QFont() # Main GUI font
|
||||
self.hideVScroll = False # Hide vertical scroll bars on main widgets
|
||||
self.hideHScroll = False # Hide horizontal scroll bars on main widgets
|
||||
self.lastNotes = "0x0" # The latest release notes that have been shown
|
||||
self.nativeFont = True # Use native font dialog
|
||||
self.useCharCount = False # Use character count as primary count
|
||||
|
||||
# Icons
|
||||
self.iconTheme = DEF_ICONS # Icons theme
|
||||
@@ -626,8 +628,9 @@ class Config:
|
||||
# Main
|
||||
sec = "Main"
|
||||
self.setGuiFont(conf.rdStr(sec, "font", ""))
|
||||
self.guiTheme = conf.rdStr(sec, "theme", self.guiTheme)
|
||||
self.guiSyntax = conf.rdStr(sec, "syntax", self.guiSyntax)
|
||||
self.lightTheme = conf.rdStr(sec, "lighttheme", self.lightTheme)
|
||||
self.darkTheme = conf.rdStr(sec, "darktheme", self.darkTheme)
|
||||
self.themeMode = conf.rdEnum(sec, "thememode", self.themeMode)
|
||||
self.iconTheme = conf.rdStr(sec, "icons", self.iconTheme)
|
||||
self.iconColTree = conf.rdStr(sec, "iconcoltree", self.iconColTree)
|
||||
self.iconColDocs = conf.rdBool(sec, "iconcoldocs", self.iconColDocs)
|
||||
@@ -751,8 +754,9 @@ class Config:
|
||||
|
||||
conf["Main"] = {
|
||||
"font": self.guiFont.toString(),
|
||||
"theme": str(self.guiTheme),
|
||||
"syntax": str(self.guiSyntax),
|
||||
"lighttheme": str(self.lightTheme),
|
||||
"darktheme": str(self.darkTheme),
|
||||
"thememode": self.themeMode.name,
|
||||
"icons": str(self.iconTheme),
|
||||
"iconcoltree": str(self.iconColTree),
|
||||
"iconcoldocs": str(self.iconColDocs),
|
||||
|
||||
Reference in New Issue
Block a user