Use the simplified theme icon setter where possible
This commit is contained in:
@@ -2365,16 +2365,16 @@ class GuiDocToolBar(QWidget):
|
||||
palette.setColor(QPalette.ColorRole.Text, SHARED.theme.colText)
|
||||
self.setPalette(palette)
|
||||
|
||||
self.tbBoldMD.setIcon(SHARED.theme.getIcon("fmt_bold-md"))
|
||||
self.tbItalicMD.setIcon(SHARED.theme.getIcon("fmt_italic-md"))
|
||||
self.tbStrikeMD.setIcon(SHARED.theme.getIcon("fmt_strike-md"))
|
||||
self.tbBold.setIcon(SHARED.theme.getIcon("fmt_bold"))
|
||||
self.tbItalic.setIcon(SHARED.theme.getIcon("fmt_italic"))
|
||||
self.tbStrike.setIcon(SHARED.theme.getIcon("fmt_strike"))
|
||||
self.tbUnderline.setIcon(SHARED.theme.getIcon("fmt_underline"))
|
||||
self.tbMark.setIcon(SHARED.theme.getIcon("fmt_mark"))
|
||||
self.tbSuperscript.setIcon(SHARED.theme.getIcon("fmt_superscript"))
|
||||
self.tbSubscript.setIcon(SHARED.theme.getIcon("fmt_subscript"))
|
||||
self.tbBoldMD.setThemeIcon("fmt_bold-md")
|
||||
self.tbItalicMD.setThemeIcon("fmt_italic-md")
|
||||
self.tbStrikeMD.setThemeIcon("fmt_strike-md")
|
||||
self.tbBold.setThemeIcon("fmt_bold")
|
||||
self.tbItalic.setThemeIcon("fmt_italic")
|
||||
self.tbStrike.setThemeIcon("fmt_strike")
|
||||
self.tbUnderline.setThemeIcon("fmt_underline")
|
||||
self.tbMark.setThemeIcon("fmt_mark")
|
||||
self.tbSuperscript.setThemeIcon("fmt_superscript")
|
||||
self.tbSubscript.setThemeIcon("fmt_subscript")
|
||||
|
||||
return
|
||||
|
||||
@@ -2634,8 +2634,8 @@ class GuiDocEditSearch(QFrame):
|
||||
self.toggleProject.setIcon(SHARED.theme.getIcon("search_project"))
|
||||
self.toggleMatchCap.setIcon(SHARED.theme.getIcon("search_preserve"))
|
||||
self.cancelSearch.setIcon(SHARED.theme.getIcon("search_cancel"))
|
||||
self.searchButton.setIcon(SHARED.theme.getIcon("search"))
|
||||
self.replaceButton.setIcon(SHARED.theme.getIcon("search_replace"))
|
||||
self.searchButton.setThemeIcon("search")
|
||||
self.replaceButton.setThemeIcon("search_replace")
|
||||
|
||||
# Set stylesheets
|
||||
self.searchOpt.setStyleSheet("QToolBar {padding: 0;}")
|
||||
@@ -2913,11 +2913,11 @@ class GuiDocEditHeader(QWidget):
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
self.tbButton.setIcon(SHARED.theme.getIcon("menu"))
|
||||
self.outlineButton.setIcon(SHARED.theme.getIcon("list"))
|
||||
self.searchButton.setIcon(SHARED.theme.getIcon("search"))
|
||||
self.minmaxButton.setIcon(SHARED.theme.getIcon("maximise"))
|
||||
self.closeButton.setIcon(SHARED.theme.getIcon("close"))
|
||||
self.tbButton.setThemeIcon("menu")
|
||||
self.outlineButton.setThemeIcon("list")
|
||||
self.searchButton.setThemeIcon("search")
|
||||
self.minmaxButton.setThemeIcon("maximise")
|
||||
self.closeButton.setThemeIcon("close")
|
||||
|
||||
buttonStyle = SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON)
|
||||
self.tbButton.setStyleSheet(buttonStyle)
|
||||
@@ -2985,7 +2985,7 @@ class GuiDocEditHeader(QWidget):
|
||||
@pyqtSlot(bool)
|
||||
def _focusModeChanged(self, focusMode: bool) -> None:
|
||||
"""Update minimise/maximise icon of the Focus Mode button."""
|
||||
self.minmaxButton.setIcon(SHARED.theme.getIcon("minimise" if focusMode else "maximise"))
|
||||
self.minmaxButton.setThemeIcon("minimise" if focusMode else "maximise")
|
||||
return
|
||||
|
||||
##
|
||||
|
||||
@@ -745,11 +745,11 @@ class GuiDocViewHeader(QWidget):
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
self.outlineButton.setIcon(SHARED.theme.getIcon("list"))
|
||||
self.backButton.setIcon(SHARED.theme.getIcon("backward"))
|
||||
self.forwardButton.setIcon(SHARED.theme.getIcon("forward"))
|
||||
self.refreshButton.setIcon(SHARED.theme.getIcon("refresh"))
|
||||
self.closeButton.setIcon(SHARED.theme.getIcon("close"))
|
||||
self.outlineButton.setThemeIcon("list")
|
||||
self.backButton.setThemeIcon("backward")
|
||||
self.forwardButton.setThemeIcon("forward")
|
||||
self.refreshButton.setThemeIcon("refresh")
|
||||
self.closeButton.setThemeIcon("close")
|
||||
|
||||
buttonStyle = SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON)
|
||||
self.outlineButton.setStyleSheet(buttonStyle)
|
||||
@@ -921,7 +921,7 @@ class GuiDocViewFooter(QWidget):
|
||||
fPx = int(0.9*SHARED.theme.fontPixelSize)
|
||||
bulletIcon = SHARED.theme.getToggleIcon("bullet", (fPx, fPx))
|
||||
|
||||
self.showHide.setIcon(SHARED.theme.getIcon("panel"))
|
||||
self.showHide.setThemeIcon("panel")
|
||||
self.showComments.setIcon(bulletIcon)
|
||||
self.showSynopsis.setIcon(bulletIcon)
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ from novelwriter.common import checkInt
|
||||
from novelwriter.constants import nwHeaders, nwLabels, nwLists, trConst
|
||||
from novelwriter.core.index import IndexHeading, IndexItem
|
||||
from novelwriter.enum import nwDocMode, nwItemClass
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -65,8 +66,7 @@ class GuiDocViewerPanel(QWidget):
|
||||
self.aInactive.setCheckable(True)
|
||||
self.aInactive.toggled.connect(self._toggleHideInactive)
|
||||
|
||||
self.optsButton = QToolButton(self)
|
||||
self.optsButton.setIconSize(iSz)
|
||||
self.optsButton = NIconToolButton(self, iSz)
|
||||
self.optsButton.setMenu(self.optsMenu)
|
||||
self.optsButton.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
|
||||
@@ -100,7 +100,7 @@ class GuiDocViewerPanel(QWidget):
|
||||
|
||||
def updateTheme(self, updateTabs: bool = True) -> None:
|
||||
"""Update theme elements."""
|
||||
self.optsButton.setIcon(SHARED.theme.getIcon("menu"))
|
||||
self.optsButton.setThemeIcon("menu")
|
||||
self.optsButton.setStyleSheet(SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON))
|
||||
self.mainTabs.setStyleSheet(SHARED.theme.getStyleSheet(STYLES_FLAT_TABS))
|
||||
self.updateHandle(self._lastHandle)
|
||||
|
||||
@@ -270,9 +270,9 @@ class GuiNovelToolBar(QWidget):
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
# Icons
|
||||
self.tbNovel.setIcon(SHARED.theme.getIcon("cls_novel"))
|
||||
self.tbRefresh.setIcon(SHARED.theme.getIcon("refresh"))
|
||||
self.tbMore.setIcon(SHARED.theme.getIcon("menu"))
|
||||
self.tbNovel.setThemeIcon("cls_novel")
|
||||
self.tbRefresh.setThemeIcon("refresh")
|
||||
self.tbMore.setThemeIcon("menu")
|
||||
|
||||
qPalette = self.palette()
|
||||
qPalette.setBrush(QPalette.ColorRole.Window, qPalette.base())
|
||||
|
||||
@@ -385,16 +385,17 @@ class GuiProjectToolBar(QWidget):
|
||||
self.tbAdd.setStyleSheet(buttonStyle)
|
||||
self.tbMore.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbQuick.setIcon(SHARED.theme.getIcon("bookmark"))
|
||||
self.tbMoveU.setIcon(SHARED.theme.getIcon("up"))
|
||||
self.tbMoveD.setIcon(SHARED.theme.getIcon("down"))
|
||||
self.tbQuick.setThemeIcon("bookmark")
|
||||
self.tbMoveU.setThemeIcon("up")
|
||||
self.tbMoveD.setThemeIcon("down")
|
||||
self.tbAdd.setThemeIcon("add")
|
||||
self.tbMore.setThemeIcon("menu")
|
||||
|
||||
self.aAddEmpty.setIcon(SHARED.theme.getIcon("proj_document"))
|
||||
self.aAddChap.setIcon(SHARED.theme.getIcon("proj_chapter"))
|
||||
self.aAddScene.setIcon(SHARED.theme.getIcon("proj_scene"))
|
||||
self.aAddNote.setIcon(SHARED.theme.getIcon("proj_note"))
|
||||
self.aAddFolder.setIcon(SHARED.theme.getIcon("proj_folder"))
|
||||
self.tbAdd.setIcon(SHARED.theme.getIcon("add"))
|
||||
self.tbMore.setIcon(SHARED.theme.getIcon("menu"))
|
||||
|
||||
self.buildQuickLinksMenu()
|
||||
self._buildRootMenu()
|
||||
|
||||
@@ -130,30 +130,24 @@ class GuiSideBar(QWidget):
|
||||
|
||||
buttonStyle = SHARED.theme.getStyleSheet(STYLES_BIG_TOOLBUTTON)
|
||||
|
||||
self.tbProject.setIcon(SHARED.theme.getIcon("view_editor"))
|
||||
self.tbProject.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbNovel.setIcon(SHARED.theme.getIcon("view_novel"))
|
||||
self.tbNovel.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbSearch.setIcon(SHARED.theme.getIcon("view_search"))
|
||||
self.tbSearch.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbOutline.setIcon(SHARED.theme.getIcon("view_outline"))
|
||||
self.tbOutline.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbBuild.setIcon(SHARED.theme.getIcon("view_build"))
|
||||
self.tbBuild.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbDetails.setIcon(SHARED.theme.getIcon("proj_details"))
|
||||
self.tbDetails.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbStats.setIcon(SHARED.theme.getIcon("proj_stats"))
|
||||
self.tbStats.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbSettings.setIcon(SHARED.theme.getIcon("settings"))
|
||||
self.tbSettings.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbProject.setThemeIcon("view_editor")
|
||||
self.tbNovel.setThemeIcon("view_novel")
|
||||
self.tbSearch.setThemeIcon("view_search")
|
||||
self.tbOutline.setThemeIcon("view_outline")
|
||||
self.tbBuild.setThemeIcon("view_build")
|
||||
self.tbDetails.setThemeIcon("proj_details")
|
||||
self.tbStats.setThemeIcon("proj_stats")
|
||||
self.tbSettings.setThemeIcon("settings")
|
||||
|
||||
return
|
||||
|
||||
# END Class GuiSideBar
|
||||
|
||||
Reference in New Issue
Block a user