Fix icon theme reload
This commit is contained in:
@@ -252,7 +252,7 @@ class GuiTheme:
|
|||||||
return QColor(*result)
|
return QColor(*result)
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def loadTheme(self) -> bool:
|
def loadTheme(self, force: bool = False) -> bool:
|
||||||
"""Load the currently specified GUI theme."""
|
"""Load the currently specified GUI theme."""
|
||||||
match CONFIG.themeMode:
|
match CONFIG.themeMode:
|
||||||
case nwTheme.LIGHT:
|
case nwTheme.LIGHT:
|
||||||
@@ -272,7 +272,7 @@ class GuiTheme:
|
|||||||
theme = DEF_GUI_LIGHT
|
theme = DEF_GUI_LIGHT
|
||||||
CONFIG.lightTheme = DEF_GUI_LIGHT
|
CONFIG.lightTheme = DEF_GUI_LIGHT
|
||||||
|
|
||||||
if theme == self._currentTheme:
|
if theme == self._currentTheme and not force:
|
||||||
logger.info("Theme '%s' is already loaded", theme)
|
logger.info("Theme '%s' is already loaded", theme)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -910,9 +910,9 @@ class GuiMain(QMainWindow):
|
|||||||
self.docViewer.initViewer()
|
self.docViewer.initViewer()
|
||||||
return
|
return
|
||||||
|
|
||||||
def refreshThemeColors(self, syntax: bool) -> None:
|
def refreshThemeColors(self, syntax: bool = False, force: bool = False) -> None:
|
||||||
"""Refresh the GUI theme."""
|
"""Refresh the GUI theme."""
|
||||||
SHARED.theme.loadTheme()
|
SHARED.theme.loadTheme(force=force)
|
||||||
self.setPalette(QApplication.palette())
|
self.setPalette(QApplication.palette())
|
||||||
self.docEditor.updateTheme()
|
self.docEditor.updateTheme()
|
||||||
self.docViewer.updateTheme()
|
self.docViewer.updateTheme()
|
||||||
@@ -1090,7 +1090,7 @@ class GuiMain(QMainWindow):
|
|||||||
self.novelView.refreshCurrentTree()
|
self.novelView.refreshCurrentTree()
|
||||||
|
|
||||||
if theme:
|
if theme:
|
||||||
self.refreshThemeColors(syntax=syntax)
|
self.refreshThemeColors(syntax=syntax, force=True)
|
||||||
|
|
||||||
self.docEditor.initEditor()
|
self.docEditor.initEditor()
|
||||||
self.docViewer.initViewer()
|
self.docViewer.initViewer()
|
||||||
|
|||||||
Reference in New Issue
Block a user