Rename main theme object

This commit is contained in:
Veronica Berglyd Olsen
2022-06-11 16:29:49 +02:00
parent db01d85f2e
commit 985179bbb9
26 changed files with 346 additions and 346 deletions
+27 -27
View File
@@ -49,9 +49,9 @@ class GuiAbout(QDialog):
logger.debug("Initialising GuiAbout ...") logger.debug("Initialising GuiAbout ...")
self.setObjectName("GuiAbout") self.setObjectName("GuiAbout")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.innerBox = QHBoxLayout() self.innerBox = QHBoxLayout()
@@ -63,7 +63,7 @@ class GuiAbout(QDialog):
nPx = self.mainConf.pxInt(96) nPx = self.mainConf.pxInt(96)
self.nwIcon = QLabel() self.nwIcon = QLabel()
self.nwIcon.setPixmap(self.mainGui.theTheme.getPixmap("novelwriter", (nPx, nPx))) self.nwIcon.setPixmap(self.mainGui.mainTheme.getPixmap("novelwriter", (nPx, nPx)))
self.lblName = QLabel("<b>novelWriter</b>") self.lblName = QLabel("<b>novelWriter</b>")
self.lblVers = QLabel(f"v{novelwriter.__version__}") self.lblVers = QLabel(f"v{novelwriter.__version__}")
self.lblDate = QLabel(datetime.strptime(novelwriter.__date__, "%Y-%m-%d").strftime("%x")) self.lblDate = QLabel(datetime.strptime(novelwriter.__date__, "%Y-%m-%d").strftime("%x"))
@@ -191,37 +191,37 @@ class GuiAbout(QDialog):
]) ])
) )
theTheme = self.mainGui.theTheme mainTheme = self.mainGui.mainTheme
theIcons = self.mainGui.theTheme.theIcons iconCache = self.mainGui.mainTheme.iconCache
if theTheme.themeName and theTheme.themeAuthor != "N/A": if mainTheme.themeName and mainTheme.themeAuthor != "N/A":
licURL = f"<a href='{theTheme.themeLicenseUrl}'>{theTheme.themeLicense}</a>" licURL = f"<a href='{mainTheme.themeLicenseUrl}'>{mainTheme.themeLicense}</a>"
aboutMsg += "<h4>{0}</h4><p>{1}</p>".format( aboutMsg += "<h4>{0}</h4><p>{1}</p>".format(
self.tr("Theme: {0}").format(theTheme.themeName), self.tr("Theme: {0}").format(mainTheme.themeName),
self._wrapTable([ self._wrapTable([
(self.tr("Author"), theTheme.themeAuthor), (self.tr("Author"), mainTheme.themeAuthor),
(self.tr("Credit"), theTheme.themeCredit), (self.tr("Credit"), mainTheme.themeCredit),
(self.tr("Licence"), licURL), (self.tr("Licence"), licURL),
]) ])
) )
if theIcons.themeName: if iconCache.themeName:
licURL = f"<a href='{theIcons.themeLicenseUrl}'>{theIcons.themeLicense}</a>" licURL = f"<a href='{iconCache.themeLicenseUrl}'>{iconCache.themeLicense}</a>"
aboutMsg += "<h4>{0}</h4><p>{1}</p>".format( aboutMsg += "<h4>{0}</h4><p>{1}</p>".format(
self.tr("Icons: {0}").format(theIcons.themeName), self.tr("Icons: {0}").format(iconCache.themeName),
self._wrapTable([ self._wrapTable([
(self.tr("Author"), theIcons.themeAuthor), (self.tr("Author"), iconCache.themeAuthor),
(self.tr("Credit"), theIcons.themeCredit), (self.tr("Credit"), iconCache.themeCredit),
(self.tr("Licence"), licURL), (self.tr("Licence"), licURL),
]) ])
) )
if theTheme.syntaxName: if mainTheme.syntaxName:
licURL = f"<a href='{theTheme.syntaxLicenseUrl}'>{theTheme.syntaxLicense}</a>" licURL = f"<a href='{mainTheme.syntaxLicenseUrl}'>{mainTheme.syntaxLicense}</a>"
aboutMsg += "<h4>{0}</h4><p>{1}</p>".format( aboutMsg += "<h4>{0}</h4><p>{1}</p>".format(
self.tr("Syntax: {0}").format(theTheme.syntaxName), self.tr("Syntax: {0}").format(mainTheme.syntaxName),
self._wrapTable([ self._wrapTable([
(self.tr("Author"), theTheme.syntaxAuthor), (self.tr("Author"), mainTheme.syntaxAuthor),
(self.tr("Credit"), theTheme.syntaxCredit), (self.tr("Credit"), mainTheme.syntaxCredit),
(self.tr("Licence"), licURL), (self.tr("Licence"), licURL),
]) ])
) )
@@ -279,12 +279,12 @@ class GuiAbout(QDialog):
" padding-right: 0.8em;" " padding-right: 0.8em;"
"}}\n" "}}\n"
).format( ).format(
hColR=self.mainGui.theTheme.colHead[0], hColR=self.mainGui.mainTheme.colHead[0],
hColG=self.mainGui.theTheme.colHead[1], hColG=self.mainGui.mainTheme.colHead[1],
hColB=self.mainGui.theTheme.colHead[2], hColB=self.mainGui.mainTheme.colHead[2],
kColR=self.theTheme.colKey[0], kColR=self.mainTheme.colKey[0],
kColG=self.theTheme.colKey[1], kColG=self.mainTheme.colKey[1],
kColB=self.theTheme.colKey[2], kColB=self.mainTheme.colKey[2],
) )
self.pageAbout.document().setDefaultStyleSheet(styleSheet) self.pageAbout.document().setDefaultStyleSheet(styleSheet)
self.pageNotes.document().setDefaultStyleSheet(styleSheet) self.pageNotes.document().setDefaultStyleSheet(styleSheet)
+1 -1
View File
@@ -57,7 +57,7 @@ class GuiDocMerge(QDialog):
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Documents to Merge"))) self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Documents to Merge")))
self.helpLabel = QHelpLabel( self.helpLabel = QHelpLabel(
self.tr("Drag and drop items to change the order."), self.mainGui.theTheme.helpText self.tr("Drag and drop items to change the order."), self.mainGui.mainTheme.helpText
) )
self.listBox = QListWidget() self.listBox = QListWidget()
+1 -1
View File
@@ -60,7 +60,7 @@ class GuiDocSplit(QDialog):
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Document Headers"))) self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Document Headers")))
self.helpLabel = QHelpLabel( self.helpLabel = QHelpLabel(
self.tr("Select the maximum level to split into files."), self.tr("Select the maximum level to split into files."),
self.mainGui.theTheme.helpText self.mainGui.mainTheme.helpText
) )
self.listBox = QListWidget() self.listBox = QListWidget()
+35 -35
View File
@@ -141,13 +141,13 @@ class GuiPreferencesGeneral(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
# Look and Feel # Look and Feel
@@ -174,7 +174,7 @@ class GuiPreferencesGeneral(QWidget):
# Select Theme # Select Theme
self.guiTheme = QComboBox() self.guiTheme = QComboBox()
self.guiTheme.setMinimumWidth(minWidth) self.guiTheme.setMinimumWidth(minWidth)
self.theThemes = self.theTheme.listThemes() self.theThemes = self.mainTheme.listThemes()
for themeDir, themeName in self.theThemes: for themeDir, themeName in self.theThemes:
self.guiTheme.addItem(themeName, themeDir) self.guiTheme.addItem(themeName, themeDir)
themeIdx = self.guiTheme.findData(self.mainConf.guiTheme) themeIdx = self.guiTheme.findData(self.mainConf.guiTheme)
@@ -190,8 +190,8 @@ class GuiPreferencesGeneral(QWidget):
# Select Icon Theme # Select Icon Theme
self.guiIcons = QComboBox() self.guiIcons = QComboBox()
self.guiIcons.setMinimumWidth(minWidth) self.guiIcons.setMinimumWidth(minWidth)
self.theIcons = self.theTheme.theIcons.listThemes() self.iconCache = self.mainTheme.iconCache.listThemes()
for iconDir, iconName in self.theIcons: for iconDir, iconName in self.iconCache:
self.guiIcons.addItem(iconName, iconDir) self.guiIcons.addItem(iconName, iconDir)
iconIdx = self.guiIcons.findData(self.mainConf.guiIcons) iconIdx = self.guiIcons.findData(self.mainConf.guiIcons)
if iconIdx != -1: if iconIdx != -1:
@@ -206,7 +206,7 @@ class GuiPreferencesGeneral(QWidget):
# Editor Theme # Editor Theme
self.guiSyntax = QComboBox() self.guiSyntax = QComboBox()
self.guiSyntax.setMinimumWidth(self.mainConf.pxInt(200)) self.guiSyntax.setMinimumWidth(self.mainConf.pxInt(200))
self.theSyntaxes = self.theTheme.listSyntax() self.theSyntaxes = self.mainTheme.listSyntax()
for syntaxFile, syntaxName in self.theSyntaxes: for syntaxFile, syntaxName in self.theSyntaxes:
self.guiSyntax.addItem(syntaxName, syntaxFile) self.guiSyntax.addItem(syntaxName, syntaxFile)
syntaxIdx = self.guiSyntax.findData(self.mainConf.guiSyntax) syntaxIdx = self.guiSyntax.findData(self.mainConf.guiSyntax)
@@ -225,7 +225,7 @@ class GuiPreferencesGeneral(QWidget):
self.guiFont.setFixedWidth(self.mainConf.pxInt(162)) self.guiFont.setFixedWidth(self.mainConf.pxInt(162))
self.guiFont.setText(self.mainConf.guiFont) self.guiFont.setText(self.mainConf.guiFont)
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.setMaximumWidth(int(2.5*self.mainTheme.getTextWidth("...")))
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Font family"), self.tr("Font family"),
@@ -347,13 +347,13 @@ class GuiPreferencesProjects(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
# Automatic Save # Automatic Save
@@ -508,13 +508,13 @@ class GuiPreferencesDocuments(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
# Text Style # Text Style
@@ -527,7 +527,7 @@ class GuiPreferencesDocuments(QWidget):
self.textFont.setFixedWidth(self.mainConf.pxInt(162)) self.textFont.setFixedWidth(self.mainConf.pxInt(162))
self.textFont.setText(self.mainConf.textFont) self.textFont.setText(self.mainConf.textFont)
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.setMaximumWidth(int(2.5*self.mainTheme.getTextWidth("...")))
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Font family"), self.tr("Font family"),
@@ -669,13 +669,13 @@ class GuiPreferencesEditor(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
mW = self.mainConf.pxInt(250) mW = self.mainConf.pxInt(250)
@@ -843,13 +843,13 @@ class GuiPreferencesSyntax(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
# Quotes & Dialogue # Quotes & Dialogue
@@ -946,13 +946,13 @@ class GuiPreferencesAutomation(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
# Automatic Features # Automatic Features
@@ -1103,13 +1103,13 @@ class GuiPreferencesQuotes(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) QWidget.__init__(self, mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
# Quotation Style # Quotation Style
@@ -1117,7 +1117,7 @@ class GuiPreferencesQuotes(QWidget):
self.mainForm.addGroupLabel(self.tr("Quotation Style")) self.mainForm.addGroupLabel(self.tr("Quotation Style"))
qWidth = self.mainConf.pxInt(40) qWidth = self.mainConf.pxInt(40)
bWidth = int(2.5*self.theTheme.getTextWidth("...")) bWidth = int(2.5*self.mainTheme.getTextWidth("..."))
self.quoteSym = {} self.quoteSym = {}
# Single Quote Style # Single Quote Style
+6 -6
View File
@@ -145,10 +145,10 @@ class GuiProjectDetailsMain(QWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theProject = theProject self.theProject = theProject
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
fPx = self.theTheme.fontPixelSize fPx = self.mainTheme.fontPixelSize
fPt = self.theTheme.fontPointSize fPt = self.mainTheme.fontPointSize
vPx = self.mainConf.pxInt(4) vPx = self.mainConf.pxInt(4)
hPx = self.mainConf.pxInt(12) hPx = self.mainConf.pxInt(12)
@@ -277,12 +277,12 @@ class GuiProjectDetailsContents(QWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theProject = theProject self.theProject = theProject
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# Internal # Internal
self._theToC = [] self._theToC = []
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
hPx = self.mainConf.pxInt(12) hPx = self.mainConf.pxInt(12)
vPx = self.mainConf.pxInt(4) vPx = self.mainConf.pxInt(4)
pOptions = self.theProject.options pOptions = self.theProject.options
@@ -469,7 +469,7 @@ class GuiProjectDetailsContents(QWidget):
if tTitle.strip() == "": if tTitle.strip() == "":
tTitle = self.tr("Untitled") tTitle = self.tr("Untitled")
newItem.setIcon(self.C_TITLE, self.theTheme.getIcon("doc_h%d" % tLevel)) newItem.setIcon(self.C_TITLE, self.mainTheme.getIcon("doc_h%d" % tLevel))
newItem.setText(self.C_TITLE, tTitle) newItem.setText(self.C_TITLE, tTitle)
newItem.setText(self.C_WORDS, f"{wCount:n}") newItem.setText(self.C_WORDS, f"{wCount:n}")
newItem.setText(self.C_PAGES, f"{pCount:n}") newItem.setText(self.C_PAGES, f"{pCount:n}")
+6 -6
View File
@@ -61,13 +61,13 @@ class GuiProjectLoad(QDialog):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.openState = self.NONE_STATE self.openState = self.NONE_STATE
self.openPath = None self.openPath = None
sPx = self.mainConf.pxInt(16) sPx = self.mainConf.pxInt(16)
nPx = self.mainConf.pxInt(96) nPx = self.mainConf.pxInt(96)
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.innerBox = QHBoxLayout() self.innerBox = QHBoxLayout()
@@ -80,7 +80,7 @@ class GuiProjectLoad(QDialog):
self.setModal(True) self.setModal(True)
self.nwIcon = QLabel() self.nwIcon = QLabel()
self.nwIcon.setPixmap(self.mainGui.theTheme.getPixmap("novelwriter", (nPx, nPx))) self.nwIcon.setPixmap(self.mainGui.mainTheme.getPixmap("novelwriter", (nPx, nPx)))
self.innerBox.addWidget(self.nwIcon, 0, Qt.AlignTop) self.innerBox.addWidget(self.nwIcon, 0, Qt.AlignTop)
self.projectForm = QGridLayout() self.projectForm = QGridLayout()
@@ -110,7 +110,7 @@ class GuiProjectLoad(QDialog):
self.selPath.setReadOnly(True) self.selPath.setReadOnly(True)
self.browseButton = QPushButton("...") self.browseButton = QPushButton("...")
self.browseButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.browseButton.setMaximumWidth(int(2.5*self.mainTheme.getTextWidth("...")))
self.browseButton.clicked.connect(self._doBrowse) self.browseButton.clicked.connect(self._doBrowse)
self.projectForm.addWidget(self.lblRecent, 0, 0, 1, 3) self.projectForm.addWidget(self.lblRecent, 0, 0, 1, 3)
@@ -280,7 +280,7 @@ class GuiProjectLoad(QDialog):
sortList = sorted(dataList, key=lambda x: x[1], reverse=True) sortList = sorted(dataList, key=lambda x: x[1], reverse=True)
for theTitle, theTime, theWords, projPath in sortList: for theTitle, theTime, theWords, projPath in sortList:
newItem = QTreeWidgetItem([""]*4) newItem = QTreeWidgetItem([""]*4)
newItem.setIcon(self.C_NAME, self.mainGui.theTheme.getIcon("proj_nwx")) newItem.setIcon(self.C_NAME, self.mainGui.mainTheme.getIcon("proj_nwx"))
newItem.setText(self.C_NAME, theTitle) newItem.setText(self.C_NAME, theTitle)
newItem.setData(self.C_NAME, Qt.UserRole, projPath) newItem.setData(self.C_NAME, Qt.UserRole, projPath)
newItem.setText(self.C_COUNT, formatInt(theWords)) newItem.setText(self.C_COUNT, formatInt(theWords))
@@ -288,7 +288,7 @@ class GuiProjectLoad(QDialog):
newItem.setTextAlignment(self.C_NAME, Qt.AlignLeft | Qt.AlignVCenter) newItem.setTextAlignment(self.C_NAME, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight | Qt.AlignVCenter) newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight | Qt.AlignVCenter)
newItem.setTextAlignment(self.C_TIME, Qt.AlignRight | Qt.AlignVCenter) newItem.setTextAlignment(self.C_TIME, Qt.AlignRight | Qt.AlignVCenter)
newItem.setFont(self.C_TIME, self.theTheme.guiFontFixed) newItem.setFont(self.C_TIME, self.mainTheme.guiFontFixed)
self.listBox.addTopLevelItem(newItem) self.listBox.addTopLevelItem(newItem)
if self.listBox.topLevelItemCount() > 0: if self.listBox.topLevelItemCount() > 0:
+11 -11
View File
@@ -175,13 +175,13 @@ class GuiProjectEditMain(QWidget):
# The Form # The Form
self.mainForm = QConfigLayout() self.mainForm = QConfigLayout()
self.mainForm.setHelpTextStyle(self.mainGui.theTheme.helpText) self.mainForm.setHelpTextStyle(self.mainGui.mainTheme.helpText)
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
self.mainForm.addGroupLabel(self.tr("Project Settings")) self.mainForm.addGroupLabel(self.tr("Project Settings"))
xW = self.mainConf.pxInt(250) xW = self.mainConf.pxInt(250)
xH = round(4.8*self.mainGui.theTheme.fontPixelSize) xH = round(4.8*self.mainGui.mainTheme.fontPixelSize)
self.editName = QLineEdit() self.editName = QLineEdit()
self.editName.setMaxLength(200) self.editName.setMaxLength(200)
@@ -262,7 +262,7 @@ class GuiProjectEditStatus(QWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theProject = theProject self.theProject = theProject
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
if isStatus: if isStatus:
self.theStatus = self.theProject.statusItems self.theStatus = self.theProject.statusItems
@@ -281,7 +281,7 @@ class GuiProjectEditStatus(QWidget):
self.colChanged = False self.colChanged = False
self.selColour = QColor(100, 100, 100) self.selColour = QColor(100, 100, 100)
self.iPx = self.theTheme.baseIconSize self.iPx = self.mainTheme.baseIconSize
# The List # The List
# ======== # ========
@@ -300,16 +300,16 @@ class GuiProjectEditStatus(QWidget):
# List Controls # List Controls
# ============= # =============
self.addButton = QPushButton(self.theTheme.getIcon("add"), "") self.addButton = QPushButton(self.mainTheme.getIcon("add"), "")
self.addButton.clicked.connect(self._newItem) self.addButton.clicked.connect(self._newItem)
self.delButton = QPushButton(self.theTheme.getIcon("remove"), "") self.delButton = QPushButton(self.mainTheme.getIcon("remove"), "")
self.delButton.clicked.connect(self._delItem) self.delButton.clicked.connect(self._delItem)
self.upButton = QPushButton(self.theTheme.getIcon("up"), "") self.upButton = QPushButton(self.mainTheme.getIcon("up"), "")
self.upButton.clicked.connect(lambda: self._moveItem(-1)) self.upButton.clicked.connect(lambda: self._moveItem(-1))
self.dnButton = QPushButton(self.theTheme.getIcon("down"), "") self.dnButton = QPushButton(self.mainTheme.getIcon("down"), "")
self.dnButton.clicked.connect(lambda: self._moveItem(1)) self.dnButton.clicked.connect(lambda: self._moveItem(1))
# Edit Form # Edit Form
@@ -532,7 +532,7 @@ class GuiProjectEditReplace(QWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = theProject self.theProject = theProject
self.arChanged = False self.arChanged = False
@@ -563,10 +563,10 @@ class GuiProjectEditReplace(QWidget):
# List Controls # List Controls
# ============= # =============
self.addButton = QPushButton(self.theTheme.getIcon("add"), "") self.addButton = QPushButton(self.mainTheme.getIcon("add"), "")
self.addButton.clicked.connect(self._addEntry) self.addButton.clicked.connect(self._addEntry)
self.delButton = QPushButton(self.theTheme.getIcon("remove"), "") self.delButton = QPushButton(self.mainTheme.getIcon("remove"), "")
self.delButton.clicked.connect(self._delEntry) self.delButton.clicked.connect(self._delEntry)
# Edit Form # Edit Form
+1 -1
View File
@@ -61,7 +61,7 @@ class GuiUpdates(QDialog):
# Left Box # Left Box
self.nwIcon = QLabel() self.nwIcon = QLabel()
self.nwIcon.setPixmap(self.mainGui.theTheme.getPixmap("novelwriter", (nPx, nPx))) self.nwIcon.setPixmap(self.mainGui.mainTheme.getPixmap("novelwriter", (nPx, nPx)))
self.leftBox = QVBoxLayout() self.leftBox = QVBoxLayout()
self.leftBox.addWidget(self.nwIcon) self.leftBox.addWidget(self.nwIcon)
+3 -3
View File
@@ -50,7 +50,7 @@ class GuiWordList(QDialog):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self.setWindowTitle(self.tr("Project Word List")) self.setWindowTitle(self.tr("Project Word List"))
@@ -78,10 +78,10 @@ class GuiWordList(QDialog):
self.newEntry = QLineEdit() self.newEntry = QLineEdit()
self.addButton = QPushButton(self.theTheme.getIcon("add"), "") self.addButton = QPushButton(self.mainTheme.getIcon("add"), "")
self.addButton.clicked.connect(self._doAdd) self.addButton.clicked.connect(self._doAdd)
self.delButton = QPushButton(self.theTheme.getIcon("remove"), "") self.delButton = QPushButton(self.mainTheme.getIcon("remove"), "")
self.delButton.clicked.connect(self._doDelete) self.delButton.clicked.connect(self._doDelete)
self.editBox = QHBoxLayout() self.editBox = QHBoxLayout()
+45 -45
View File
@@ -80,7 +80,7 @@ class GuiDocEditor(QTextEdit):
# Class Variables # Class Variables
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self._nwDocument = None self._nwDocument = None
@@ -239,10 +239,10 @@ class GuiDocEditor(QTextEdit):
if self.mainConf.textFont is None: if self.mainConf.textFont is None:
# If none is defined, set a default font # If none is defined, set a default font
theFont = QFont() theFont = QFont()
if self.mainConf.osWindows and "Arial" in self.theTheme.guiFontDB.families(): if self.mainConf.osWindows and "Arial" in self.mainTheme.guiFontDB.families():
theFont.setFamily("Arial") theFont.setFamily("Arial")
theFont.setPointSize(12) theFont.setPointSize(12)
elif self.mainConf.osDarwin and "Courier" in self.theTheme.guiFontDB.families(): elif self.mainConf.osDarwin and "Courier" in self.mainTheme.guiFontDB.families():
theFont.setFamily("Courier") theFont.setFamily("Courier")
theFont.setPointSize(12) theFont.setPointSize(12)
else: else:
@@ -257,14 +257,14 @@ class GuiDocEditor(QTextEdit):
# Set the widget colours to match syntax theme # Set the widget colours to match syntax theme
mainPalette = self.palette() mainPalette = self.palette()
mainPalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) mainPalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
mainPalette.setColor(QPalette.Base, QColor(*self.theTheme.colBack)) mainPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
mainPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) mainPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.setPalette(mainPalette) self.setPalette(mainPalette)
docPalette = self.viewport().palette() docPalette = self.viewport().palette()
docPalette.setColor(QPalette.Base, QColor(*self.theTheme.colBack)) docPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
docPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) docPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.viewport().setPalette(docPalette) self.viewport().setPalette(docPalette)
self.docHeader.matchColours() self.docHeader.matchColours()
@@ -2189,7 +2189,7 @@ class GuiDocEditSearch(QFrame):
self.docEditor = docEditor self.docEditor = docEditor
self.mainGui = docEditor.mainGui self.mainGui = docEditor.mainGui
self.theProject = docEditor.theProject self.theProject = docEditor.theProject
self.theTheme = docEditor.theTheme self.mainTheme = docEditor.mainTheme
self.repVisible = False self.repVisible = False
self.isCaseSense = self.mainConf.searchCase self.isCaseSense = self.mainConf.searchCase
@@ -2200,9 +2200,9 @@ class GuiDocEditSearch(QFrame):
self.doMatchCap = self.mainConf.searchMatchCap self.doMatchCap = self.mainConf.searchMatchCap
mPx = self.mainConf.pxInt(6) mPx = self.mainConf.pxInt(6)
tPx = int(0.8*self.theTheme.fontPixelSize) tPx = int(0.8*self.mainTheme.fontPixelSize)
self.boxFont = self.theTheme.guiFont self.boxFont = self.mainTheme.guiFont
self.boxFont.setPointSizeF(0.9*self.theTheme.fontPointSize) self.boxFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
self.setContentsMargins(0, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0)
self.setAutoFillBackground(True) self.setAutoFillBackground(True)
@@ -2236,38 +2236,38 @@ class GuiDocEditSearch(QFrame):
self.resultLabel = QLabel("?/?") self.resultLabel = QLabel("?/?")
self.resultLabel.setFont(self.boxFont) self.resultLabel.setFont(self.boxFont)
self.resultLabel.setMinimumWidth(self.theTheme.getTextWidth("?/?", self.boxFont)) self.resultLabel.setMinimumWidth(self.mainTheme.getTextWidth("?/?", self.boxFont))
self.toggleCase = QAction(self.tr("Case Sensitive"), self) self.toggleCase = QAction(self.tr("Case Sensitive"), self)
self.toggleCase.setIcon(self.theTheme.getIcon("search_case")) self.toggleCase.setIcon(self.mainTheme.getIcon("search_case"))
self.toggleCase.setCheckable(True) self.toggleCase.setCheckable(True)
self.toggleCase.setChecked(self.isCaseSense) self.toggleCase.setChecked(self.isCaseSense)
self.toggleCase.toggled.connect(self._doToggleCase) self.toggleCase.toggled.connect(self._doToggleCase)
self.searchOpt.addAction(self.toggleCase) self.searchOpt.addAction(self.toggleCase)
self.toggleWord = QAction(self.tr("Whole Words Only"), self) self.toggleWord = QAction(self.tr("Whole Words Only"), self)
self.toggleWord.setIcon(self.theTheme.getIcon("search_word")) self.toggleWord.setIcon(self.mainTheme.getIcon("search_word"))
self.toggleWord.setCheckable(True) self.toggleWord.setCheckable(True)
self.toggleWord.setChecked(self.isWholeWord) self.toggleWord.setChecked(self.isWholeWord)
self.toggleWord.toggled.connect(self._doToggleWord) self.toggleWord.toggled.connect(self._doToggleWord)
self.searchOpt.addAction(self.toggleWord) self.searchOpt.addAction(self.toggleWord)
self.toggleRegEx = QAction(self.tr("RegEx Mode"), self) self.toggleRegEx = QAction(self.tr("RegEx Mode"), self)
self.toggleRegEx.setIcon(self.theTheme.getIcon("search_regex")) self.toggleRegEx.setIcon(self.mainTheme.getIcon("search_regex"))
self.toggleRegEx.setCheckable(True) self.toggleRegEx.setCheckable(True)
self.toggleRegEx.setChecked(self.isRegEx) self.toggleRegEx.setChecked(self.isRegEx)
self.toggleRegEx.toggled.connect(self._doToggleRegEx) self.toggleRegEx.toggled.connect(self._doToggleRegEx)
self.searchOpt.addAction(self.toggleRegEx) self.searchOpt.addAction(self.toggleRegEx)
self.toggleLoop = QAction(self.tr("Loop Search"), self) self.toggleLoop = QAction(self.tr("Loop Search"), self)
self.toggleLoop.setIcon(self.theTheme.getIcon("search_loop")) self.toggleLoop.setIcon(self.mainTheme.getIcon("search_loop"))
self.toggleLoop.setCheckable(True) self.toggleLoop.setCheckable(True)
self.toggleLoop.setChecked(self.doLoop) self.toggleLoop.setChecked(self.doLoop)
self.toggleLoop.toggled.connect(self._doToggleLoop) self.toggleLoop.toggled.connect(self._doToggleLoop)
self.searchOpt.addAction(self.toggleLoop) self.searchOpt.addAction(self.toggleLoop)
self.toggleProject = QAction(self.tr("Search Next File"), self) self.toggleProject = QAction(self.tr("Search Next File"), self)
self.toggleProject.setIcon(self.theTheme.getIcon("search_project")) self.toggleProject.setIcon(self.mainTheme.getIcon("search_project"))
self.toggleProject.setCheckable(True) self.toggleProject.setCheckable(True)
self.toggleProject.setChecked(self.doNextFile) self.toggleProject.setChecked(self.doNextFile)
self.toggleProject.toggled.connect(self._doToggleProject) self.toggleProject.toggled.connect(self._doToggleProject)
@@ -2276,7 +2276,7 @@ class GuiDocEditSearch(QFrame):
self.searchOpt.addSeparator() self.searchOpt.addSeparator()
self.toggleMatchCap = QAction(self.tr("Preserve Case"), self) self.toggleMatchCap = QAction(self.tr("Preserve Case"), self)
self.toggleMatchCap.setIcon(self.theTheme.getIcon("search_preserve")) self.toggleMatchCap.setIcon(self.mainTheme.getIcon("search_preserve"))
self.toggleMatchCap.setCheckable(True) self.toggleMatchCap.setCheckable(True)
self.toggleMatchCap.setChecked(self.doMatchCap) self.toggleMatchCap.setChecked(self.doMatchCap)
self.toggleMatchCap.toggled.connect(self._doToggleMatchCap) self.toggleMatchCap.toggled.connect(self._doToggleMatchCap)
@@ -2285,7 +2285,7 @@ class GuiDocEditSearch(QFrame):
self.searchOpt.addSeparator() self.searchOpt.addSeparator()
self.cancelSearch = QAction(self.tr("Close Search"), self) self.cancelSearch = QAction(self.tr("Close Search"), self)
self.cancelSearch.setIcon(self.theTheme.getIcon("search_cancel")) self.cancelSearch.setIcon(self.mainTheme.getIcon("search_cancel"))
self.cancelSearch.triggered.connect(self._doClose) self.cancelSearch.triggered.connect(self._doClose)
self.searchOpt.addAction(self.cancelSearch) self.searchOpt.addAction(self.cancelSearch)
@@ -2300,12 +2300,12 @@ class GuiDocEditSearch(QFrame):
self.showReplace.setStyleSheet("QToolButton {border: none; background: transparent;}") self.showReplace.setStyleSheet("QToolButton {border: none; background: transparent;}")
self.showReplace.toggled.connect(self._doToggleReplace) self.showReplace.toggled.connect(self._doToggleReplace)
self.searchButton = QPushButton(self.theTheme.getIcon("search"), "") self.searchButton = QPushButton(self.mainTheme.getIcon("search"), "")
self.searchButton.setFixedSize(QSize(bPx, bPx)) self.searchButton.setFixedSize(QSize(bPx, bPx))
self.searchButton.setToolTip(self.tr("Find in current document")) self.searchButton.setToolTip(self.tr("Find in current document"))
self.searchButton.clicked.connect(self._doSearch) self.searchButton.clicked.connect(self._doSearch)
self.replaceButton = QPushButton(self.theTheme.getIcon("search_replace"), "") self.replaceButton = QPushButton(self.mainTheme.getIcon("search_replace"), "")
self.replaceButton.setFixedSize(QSize(bPx, bPx)) self.replaceButton.setFixedSize(QSize(bPx, bPx))
self.replaceButton.setToolTip(self.tr("Find and replace in current document")) self.replaceButton.setToolTip(self.tr("Find and replace in current document"))
self.replaceButton.clicked.connect(self._doReplace) self.replaceButton.clicked.connect(self._doReplace)
@@ -2424,7 +2424,7 @@ class GuiDocEditSearch(QFrame):
""" """
currRes = "?" if currRes is None else currRes currRes = "?" if currRes is None else currRes
resCount = "?" if resCount is None else "1000+" if resCount > 1000 else resCount resCount = "?" if resCount is None else "1000+" if resCount > 1000 else resCount
minWidth = self.theTheme.getTextWidth(f"{resCount}//{resCount}", self.boxFont) minWidth = self.mainTheme.getTextWidth(f"{resCount}//{resCount}", self.boxFont)
self.resultLabel.setText(f"{currRes}/{resCount}") self.resultLabel.setText(f"{currRes}/{resCount}")
self.resultLabel.setMinimumWidth(minWidth) self.resultLabel.setMinimumWidth(minWidth)
self.adjustSize() self.adjustSize()
@@ -2577,11 +2577,11 @@ class GuiDocEditHeader(QWidget):
self.docEditor = docEditor self.docEditor = docEditor
self.mainGui = docEditor.mainGui self.mainGui = docEditor.mainGui
self.theProject = docEditor.theProject self.theProject = docEditor.theProject
self.theTheme = docEditor.theTheme self.mainTheme = docEditor.mainTheme
self._docHandle = None self._docHandle = None
fPx = int(0.9*self.theTheme.fontPixelSize) fPx = int(0.9*self.mainTheme.fontPixelSize)
hSp = self.mainConf.pxInt(6) hSp = self.mainConf.pxInt(6)
# Main Widget Settings # Main Widget Settings
@@ -2598,17 +2598,17 @@ class GuiDocEditHeader(QWidget):
self.theTitle.setFixedHeight(fPx) self.theTitle.setFixedHeight(fPx)
lblFont = self.theTitle.font() lblFont = self.theTitle.font()
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
self.theTitle.setFont(lblFont) self.theTitle.setFont(lblFont)
buttonStyle = ( buttonStyle = (
"QToolButton {{border: none; background: transparent;}} " "QToolButton {{border: none; background: transparent;}} "
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}" "QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
).format(*self.theTheme.colText) ).format(*self.mainTheme.colText)
# Buttons # Buttons
self.editButton = QToolButton(self) self.editButton = QToolButton(self)
self.editButton.setIcon(self.theTheme.getIcon("edit")) self.editButton.setIcon(self.mainTheme.getIcon("edit"))
self.editButton.setContentsMargins(0, 0, 0, 0) self.editButton.setContentsMargins(0, 0, 0, 0)
self.editButton.setIconSize(QSize(fPx, fPx)) self.editButton.setIconSize(QSize(fPx, fPx))
self.editButton.setFixedSize(fPx, fPx) self.editButton.setFixedSize(fPx, fPx)
@@ -2619,7 +2619,7 @@ class GuiDocEditHeader(QWidget):
self.editButton.clicked.connect(self._editDocument) self.editButton.clicked.connect(self._editDocument)
self.searchButton = QToolButton(self) self.searchButton = QToolButton(self)
self.searchButton.setIcon(self.theTheme.getIcon("search")) self.searchButton.setIcon(self.mainTheme.getIcon("search"))
self.searchButton.setContentsMargins(0, 0, 0, 0) self.searchButton.setContentsMargins(0, 0, 0, 0)
self.searchButton.setIconSize(QSize(fPx, fPx)) self.searchButton.setIconSize(QSize(fPx, fPx))
self.searchButton.setFixedSize(fPx, fPx) self.searchButton.setFixedSize(fPx, fPx)
@@ -2630,7 +2630,7 @@ class GuiDocEditHeader(QWidget):
self.searchButton.clicked.connect(self._searchDocument) self.searchButton.clicked.connect(self._searchDocument)
self.minmaxButton = QToolButton(self) self.minmaxButton = QToolButton(self)
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise")) self.minmaxButton.setIcon(self.mainTheme.getIcon("maximise"))
self.minmaxButton.setContentsMargins(0, 0, 0, 0) self.minmaxButton.setContentsMargins(0, 0, 0, 0)
self.minmaxButton.setIconSize(QSize(fPx, fPx)) self.minmaxButton.setIconSize(QSize(fPx, fPx))
self.minmaxButton.setFixedSize(fPx, fPx) self.minmaxButton.setFixedSize(fPx, fPx)
@@ -2641,7 +2641,7 @@ class GuiDocEditHeader(QWidget):
self.minmaxButton.clicked.connect(self._minmaxDocument) self.minmaxButton.clicked.connect(self._minmaxDocument)
self.closeButton = QToolButton(self) self.closeButton = QToolButton(self)
self.closeButton.setIcon(self.theTheme.getIcon("close")) self.closeButton.setIcon(self.mainTheme.getIcon("close"))
self.closeButton.setContentsMargins(0, 0, 0, 0) self.closeButton.setContentsMargins(0, 0, 0, 0)
self.closeButton.setIconSize(QSize(fPx, fPx)) self.closeButton.setIconSize(QSize(fPx, fPx))
self.closeButton.setFixedSize(fPx, fPx) self.closeButton.setFixedSize(fPx, fPx)
@@ -2684,9 +2684,9 @@ class GuiDocEditHeader(QWidget):
theme rather than the main GUI. theme rather than the main GUI.
""" """
thePalette = QPalette() thePalette = QPalette()
thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) thePalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
thePalette.setColor(QPalette.WindowText, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.WindowText, QColor(*self.mainTheme.colText))
thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.setPalette(thePalette) self.setPalette(thePalette)
self.theTitle.setPalette(thePalette) self.theTitle.setPalette(thePalette)
@@ -2734,9 +2734,9 @@ class GuiDocEditHeader(QWidget):
toggleFocusMode function and should not be activated directly. toggleFocusMode function and should not be activated directly.
""" """
if self.mainGui.isFocusMode: if self.mainGui.isFocusMode:
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise")) self.minmaxButton.setIcon(self.mainTheme.getIcon("minimise"))
else: else:
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise")) self.minmaxButton.setIcon(self.mainTheme.getIcon("maximise"))
return return
## ##
@@ -2801,20 +2801,20 @@ class GuiDocEditFooter(QWidget):
self.docEditor = docEditor self.docEditor = docEditor
self.mainGui = docEditor.mainGui self.mainGui = docEditor.mainGui
self.theProject = docEditor.theProject self.theProject = docEditor.theProject
self.theTheme = docEditor.theTheme self.mainTheme = docEditor.mainTheme
self._theItem = None self._theItem = None
self._docHandle = None self._docHandle = None
self._docSelection = False self._docSelection = False
self.sPx = int(round(0.9*self.theTheme.baseIconSize)) self.sPx = int(round(0.9*self.mainTheme.baseIconSize))
fPx = int(0.9*self.theTheme.fontPixelSize) fPx = int(0.9*self.mainTheme.fontPixelSize)
bSp = self.mainConf.pxInt(4) bSp = self.mainConf.pxInt(4)
hSp = self.mainConf.pxInt(6) hSp = self.mainConf.pxInt(6)
lblFont = self.font() lblFont = self.font()
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
# Main Widget Settings # Main Widget Settings
self.setContentsMargins(0, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0)
@@ -2837,7 +2837,7 @@ class GuiDocEditFooter(QWidget):
# Lines # Lines
self.linesIcon = QLabel("") self.linesIcon = QLabel("")
self.linesIcon.setPixmap(self.theTheme.getPixmap("status_lines", (self.sPx, self.sPx))) self.linesIcon.setPixmap(self.mainTheme.getPixmap("status_lines", (self.sPx, self.sPx)))
self.linesIcon.setContentsMargins(0, 0, 0, 0) self.linesIcon.setContentsMargins(0, 0, 0, 0)
self.linesIcon.setFixedHeight(self.sPx) self.linesIcon.setFixedHeight(self.sPx)
self.linesIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop) self.linesIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
@@ -2853,7 +2853,7 @@ class GuiDocEditFooter(QWidget):
# Words # Words
self.wordsIcon = QLabel("") self.wordsIcon = QLabel("")
self.wordsIcon.setPixmap(self.theTheme.getPixmap("status_stats", (self.sPx, self.sPx))) self.wordsIcon.setPixmap(self.mainTheme.getPixmap("status_stats", (self.sPx, self.sPx)))
self.wordsIcon.setContentsMargins(0, 0, 0, 0) self.wordsIcon.setContentsMargins(0, 0, 0, 0)
self.wordsIcon.setFixedHeight(self.sPx) self.wordsIcon.setFixedHeight(self.sPx)
self.wordsIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop) self.wordsIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
@@ -2905,9 +2905,9 @@ class GuiDocEditFooter(QWidget):
theme rather than the main GUI. theme rather than the main GUI.
""" """
thePalette = QPalette() thePalette = QPalette()
thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) thePalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
thePalette.setColor(QPalette.WindowText, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.WindowText, QColor(*self.mainTheme.colText))
thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.setPalette(thePalette) self.setPalette(thePalette)
self.statusText.setPalette(thePalette) self.statusText.setPalette(thePalette)
+15 -15
View File
@@ -54,7 +54,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.theDoc = theDoc self.theDoc = theDoc
self.spEnchant = spEnchant self.spEnchant = spEnchant
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self.theHandle = None self.theHandle = None
self.spellCheck = False self.spellCheck = False
@@ -87,24 +87,24 @@ class GuiDocHighlighter(QSyntaxHighlighter):
""" """
logger.debug("Setting up highlighting rules") logger.debug("Setting up highlighting rules")
self.colHead = QColor(*self.theTheme.colHead) self.colHead = QColor(*self.mainTheme.colHead)
self.colHeadH = QColor(*self.theTheme.colHeadH) self.colHeadH = QColor(*self.mainTheme.colHeadH)
self.colDialN = QColor(*self.theTheme.colDialN) self.colDialN = QColor(*self.mainTheme.colDialN)
self.colDialD = QColor(*self.theTheme.colDialD) self.colDialD = QColor(*self.mainTheme.colDialD)
self.colDialS = QColor(*self.theTheme.colDialS) self.colDialS = QColor(*self.mainTheme.colDialS)
self.colHidden = QColor(*self.theTheme.colHidden) self.colHidden = QColor(*self.mainTheme.colHidden)
self.colKey = QColor(*self.theTheme.colKey) self.colKey = QColor(*self.mainTheme.colKey)
self.colVal = QColor(*self.theTheme.colVal) self.colVal = QColor(*self.mainTheme.colVal)
self.colSpell = QColor(*self.theTheme.colSpell) self.colSpell = QColor(*self.mainTheme.colSpell)
self.colError = QColor(*self.theTheme.colError) self.colError = QColor(*self.mainTheme.colError)
self.colRepTag = QColor(*self.theTheme.colRepTag) self.colRepTag = QColor(*self.mainTheme.colRepTag)
self.colMod = QColor(*self.theTheme.colMod) self.colMod = QColor(*self.mainTheme.colMod)
self.colBreak = QColor(*self.theTheme.colEmph) self.colBreak = QColor(*self.mainTheme.colEmph)
self.colBreak.setAlpha(64) self.colBreak.setAlpha(64)
self.colEmph = None self.colEmph = None
if self.mainConf.highlightEmph: if self.mainConf.highlightEmph:
self.colEmph = QColor(*self.theTheme.colEmph) self.colEmph = QColor(*self.mainTheme.colEmph)
self.hStyles = { self.hStyles = {
"header1": self._makeFormat(self.colHead, "bold", 1.8), "header1": self._makeFormat(self.colHead, "bold", 1.8),
+52 -52
View File
@@ -61,7 +61,7 @@ class GuiDocViewer(QTextBrowser):
# Class Variables # Class Variables
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
# Internal Variables # Internal Variables
@@ -118,14 +118,14 @@ class GuiDocViewer(QTextBrowser):
# Set the widget colours to match syntax theme # Set the widget colours to match syntax theme
mainPalette = self.palette() mainPalette = self.palette()
mainPalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) mainPalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
mainPalette.setColor(QPalette.Base, QColor(*self.theTheme.colBack)) mainPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
mainPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) mainPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.setPalette(mainPalette) self.setPalette(mainPalette)
docPalette = self.viewport().palette() docPalette = self.viewport().palette()
docPalette.setColor(QPalette.Base, QColor(*self.theTheme.colBack)) docPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
docPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) docPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.viewport().setPalette(docPalette) self.viewport().setPalette(docPalette)
self.docHeader.matchColours() self.docHeader.matchColours()
@@ -539,27 +539,27 @@ class GuiDocViewer(QTextBrowser):
" text-align: center;" " text-align: center;"
"}}\n" "}}\n"
).format( ).format(
tColR=self.theTheme.colText[0], tColR=self.mainTheme.colText[0],
tColG=self.theTheme.colText[1], tColG=self.mainTheme.colText[1],
tColB=self.theTheme.colText[2], tColB=self.mainTheme.colText[2],
hColR=self.theTheme.colHead[0], hColR=self.mainTheme.colHead[0],
hColG=self.theTheme.colHead[1], hColG=self.mainTheme.colHead[1],
hColB=self.theTheme.colHead[2], hColB=self.mainTheme.colHead[2],
aColR=self.theTheme.colVal[0], aColR=self.mainTheme.colVal[0],
aColG=self.theTheme.colVal[1], aColG=self.mainTheme.colVal[1],
aColB=self.theTheme.colVal[2], aColB=self.mainTheme.colVal[2],
eColR=self.theTheme.colEmph[0], eColR=self.mainTheme.colEmph[0],
eColG=self.theTheme.colEmph[1], eColG=self.mainTheme.colEmph[1],
eColB=self.theTheme.colEmph[2], eColB=self.mainTheme.colEmph[2],
kColR=self.theTheme.colKey[0], kColR=self.mainTheme.colKey[0],
kColG=self.theTheme.colKey[1], kColG=self.mainTheme.colKey[1],
kColB=self.theTheme.colKey[2], kColB=self.mainTheme.colKey[2],
cColR=self.theTheme.colHidden[0], cColR=self.mainTheme.colHidden[0],
cColG=self.theTheme.colHidden[1], cColG=self.mainTheme.colHidden[1],
cColB=self.theTheme.colHidden[2], cColB=self.mainTheme.colHidden[2],
mColR=self.theTheme.colMod[0], mColR=self.mainTheme.colMod[0],
mColG=self.theTheme.colMod[1], mColG=self.mainTheme.colMod[1],
mColB=self.theTheme.colMod[2], mColB=self.mainTheme.colMod[2],
) )
self.document().setDefaultStyleSheet(styleSheet) self.document().setDefaultStyleSheet(styleSheet)
@@ -716,12 +716,12 @@ class GuiDocViewHeader(QWidget):
self.docViewer = docViewer self.docViewer = docViewer
self.mainGui = docViewer.mainGui self.mainGui = docViewer.mainGui
self.theProject = docViewer.theProject self.theProject = docViewer.theProject
self.theTheme = docViewer.theTheme self.mainTheme = docViewer.mainTheme
# Internal Variables # Internal Variables
self._docHandle = None self._docHandle = None
fPx = int(0.9*self.theTheme.fontPixelSize) fPx = int(0.9*self.mainTheme.fontPixelSize)
hSp = self.mainConf.pxInt(6) hSp = self.mainConf.pxInt(6)
# Main Widget Settings # Main Widget Settings
@@ -738,17 +738,17 @@ class GuiDocViewHeader(QWidget):
self.theTitle.setFixedHeight(fPx) self.theTitle.setFixedHeight(fPx)
lblFont = self.theTitle.font() lblFont = self.theTitle.font()
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
self.theTitle.setFont(lblFont) self.theTitle.setFont(lblFont)
buttonStyle = ( buttonStyle = (
"QToolButton {{border: none; background: transparent;}} " "QToolButton {{border: none; background: transparent;}} "
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}" "QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
).format(*self.theTheme.colText) ).format(*self.mainTheme.colText)
# Buttons # Buttons
self.backButton = QToolButton(self) self.backButton = QToolButton(self)
self.backButton.setIcon(self.theTheme.getIcon("backward")) self.backButton.setIcon(self.mainTheme.getIcon("backward"))
self.backButton.setContentsMargins(0, 0, 0, 0) self.backButton.setContentsMargins(0, 0, 0, 0)
self.backButton.setIconSize(QSize(fPx, fPx)) self.backButton.setIconSize(QSize(fPx, fPx))
self.backButton.setFixedSize(fPx, fPx) self.backButton.setFixedSize(fPx, fPx)
@@ -759,7 +759,7 @@ class GuiDocViewHeader(QWidget):
self.backButton.clicked.connect(self.docViewer.navBackward) self.backButton.clicked.connect(self.docViewer.navBackward)
self.forwardButton = QToolButton(self) self.forwardButton = QToolButton(self)
self.forwardButton.setIcon(self.theTheme.getIcon("forward")) self.forwardButton.setIcon(self.mainTheme.getIcon("forward"))
self.forwardButton.setContentsMargins(0, 0, 0, 0) self.forwardButton.setContentsMargins(0, 0, 0, 0)
self.forwardButton.setIconSize(QSize(fPx, fPx)) self.forwardButton.setIconSize(QSize(fPx, fPx))
self.forwardButton.setFixedSize(fPx, fPx) self.forwardButton.setFixedSize(fPx, fPx)
@@ -770,7 +770,7 @@ class GuiDocViewHeader(QWidget):
self.forwardButton.clicked.connect(self.docViewer.navForward) self.forwardButton.clicked.connect(self.docViewer.navForward)
self.refreshButton = QToolButton(self) self.refreshButton = QToolButton(self)
self.refreshButton.setIcon(self.theTheme.getIcon("refresh")) self.refreshButton.setIcon(self.mainTheme.getIcon("refresh"))
self.refreshButton.setContentsMargins(0, 0, 0, 0) self.refreshButton.setContentsMargins(0, 0, 0, 0)
self.refreshButton.setIconSize(QSize(fPx, fPx)) self.refreshButton.setIconSize(QSize(fPx, fPx))
self.refreshButton.setFixedSize(fPx, fPx) self.refreshButton.setFixedSize(fPx, fPx)
@@ -781,7 +781,7 @@ class GuiDocViewHeader(QWidget):
self.refreshButton.clicked.connect(self._refreshDocument) self.refreshButton.clicked.connect(self._refreshDocument)
self.closeButton = QToolButton(self) self.closeButton = QToolButton(self)
self.closeButton.setIcon(self.theTheme.getIcon("close")) self.closeButton.setIcon(self.mainTheme.getIcon("close"))
self.closeButton.setContentsMargins(0, 0, 0, 0) self.closeButton.setContentsMargins(0, 0, 0, 0)
self.closeButton.setIconSize(QSize(fPx, fPx)) self.closeButton.setIconSize(QSize(fPx, fPx))
self.closeButton.setFixedSize(fPx, fPx) self.closeButton.setFixedSize(fPx, fPx)
@@ -824,9 +824,9 @@ class GuiDocViewHeader(QWidget):
theme rather than the main GUI. theme rather than the main GUI.
""" """
thePalette = QPalette() thePalette = QPalette()
thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) thePalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
thePalette.setColor(QPalette.WindowText, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.WindowText, QColor(*self.mainTheme.colText))
thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.setPalette(thePalette) self.setPalette(thePalette)
self.theTitle.setPalette(thePalette) self.theTitle.setPalette(thePalette)
@@ -922,25 +922,25 @@ class GuiDocViewFooter(QWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.docViewer = docViewer self.docViewer = docViewer
self.mainGui = docViewer.mainGui self.mainGui = docViewer.mainGui
self.theTheme = docViewer.theTheme self.mainTheme = docViewer.mainTheme
self.viewMeta = docViewer.mainGui.viewMeta self.viewMeta = docViewer.mainGui.viewMeta
# Internal Variables # Internal Variables
self._docHandle = None self._docHandle = None
fPx = int(0.9*self.theTheme.fontPixelSize) fPx = int(0.9*self.mainTheme.fontPixelSize)
bSp = self.mainConf.pxInt(2) bSp = self.mainConf.pxInt(2)
hSp = self.mainConf.pxInt(8) hSp = self.mainConf.pxInt(8)
# Icons # Icons
stickyOn = self.theTheme.getPixmap("sticky-on", (fPx, fPx)) stickyOn = self.mainTheme.getPixmap("sticky-on", (fPx, fPx))
stickyOff = self.theTheme.getPixmap("sticky-off", (fPx, fPx)) stickyOff = self.mainTheme.getPixmap("sticky-off", (fPx, fPx))
stickyIcon = QIcon() stickyIcon = QIcon()
stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On) stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On)
stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off) stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off)
bulletOn = self.theTheme.getPixmap("bullet-on", (fPx, fPx)) bulletOn = self.mainTheme.getPixmap("bullet-on", (fPx, fPx))
bulletOff = self.theTheme.getPixmap("bullet-off", (fPx, fPx)) bulletOff = self.mainTheme.getPixmap("bullet-off", (fPx, fPx))
bulletIcon = QIcon() bulletIcon = QIcon()
bulletIcon.addPixmap(bulletOn, QIcon.Normal, QIcon.On) bulletIcon.addPixmap(bulletOn, QIcon.Normal, QIcon.On)
bulletIcon.addPixmap(bulletOff, QIcon.Normal, QIcon.Off) bulletIcon.addPixmap(bulletOff, QIcon.Normal, QIcon.Off)
@@ -952,13 +952,13 @@ class GuiDocViewFooter(QWidget):
buttonStyle = ( buttonStyle = (
"QToolButton {{border: none; background: transparent;}} " "QToolButton {{border: none; background: transparent;}} "
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}" "QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
).format(*self.theTheme.colText) ).format(*self.mainTheme.colText)
# Show/Hide Details # Show/Hide Details
self.showHide = QToolButton(self) self.showHide = QToolButton(self)
self.showHide.setToolButtonStyle(Qt.ToolButtonIconOnly) self.showHide.setToolButtonStyle(Qt.ToolButtonIconOnly)
self.showHide.setStyleSheet(buttonStyle) self.showHide.setStyleSheet(buttonStyle)
self.showHide.setIcon(self.theTheme.getIcon("reference")) self.showHide.setIcon(self.mainTheme.getIcon("reference"))
self.showHide.setIconSize(QSize(fPx, fPx)) self.showHide.setIconSize(QSize(fPx, fPx))
self.showHide.setFixedSize(QSize(fPx, fPx)) self.showHide.setFixedSize(QSize(fPx, fPx))
self.showHide.clicked.connect(self._doShowHide) self.showHide.clicked.connect(self._doShowHide)
@@ -1039,7 +1039,7 @@ class GuiDocViewFooter(QWidget):
self.lblSynopsis.setAlignment(Qt.AlignLeft | Qt.AlignTop) self.lblSynopsis.setAlignment(Qt.AlignLeft | Qt.AlignTop)
lblFont = self.font() lblFont = self.font()
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
self.lblRefs.setFont(lblFont) self.lblRefs.setFont(lblFont)
self.lblSticky.setFont(lblFont) self.lblSticky.setFont(lblFont)
self.lblComments.setFont(lblFont) self.lblComments.setFont(lblFont)
@@ -1084,9 +1084,9 @@ class GuiDocViewFooter(QWidget):
theme rather than the main GUI. theme rather than the main GUI.
""" """
thePalette = QPalette() thePalette = QPalette()
thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) thePalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
thePalette.setColor(QPalette.WindowText, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.WindowText, QColor(*self.mainTheme.colText))
thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) thePalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
self.setPalette(thePalette) self.setPalette(thePalette)
self.lblRefs.setPalette(thePalette) self.lblRefs.setPalette(thePalette)
@@ -1147,7 +1147,7 @@ class GuiDocViewDetails(QScrollArea):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.refList = QLabel("") self.refList = QLabel("")
self.refList.setWordWrap(True) self.refList.setWordWrap(True)
@@ -1156,7 +1156,7 @@ class GuiDocViewDetails(QScrollArea):
self.refList.linkActivated.connect(self._linkClicked) self.refList.linkActivated.connect(self._linkClicked)
self.linkStyle = "style='color: rgb({0},{1},{2})'".format( self.linkStyle = "style='color: rgb({0},{1},{2})'".format(
*self.theTheme.colLink *self.mainTheme.colLink
) )
# Assemble # Assemble
+10 -10
View File
@@ -45,7 +45,7 @@ class GuiItemDetails(QWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# Internal Variables # Internal Variables
self._itemHandle = None self._itemHandle = None
@@ -54,11 +54,11 @@ class GuiItemDetails(QWidget):
hSp = self.mainConf.pxInt(6) hSp = self.mainConf.pxInt(6)
vSp = self.mainConf.pxInt(1) vSp = self.mainConf.pxInt(1)
mPx = self.mainConf.pxInt(6) mPx = self.mainConf.pxInt(6)
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
fPt = self.theTheme.fontPointSize fPt = self.mainTheme.fontPointSize
self._expCheck = self.theTheme.getPixmap("check", (iPx, iPx)) self._expCheck = self.mainTheme.getPixmap("check", (iPx, iPx))
self._expCross = self.theTheme.getPixmap("cross", (iPx, iPx)) self._expCross = self.mainTheme.getPixmap("cross", (iPx, iPx))
fntLabel = QFont() fntLabel = QFont()
fntLabel.setBold(True) fntLabel.setBold(True)
@@ -181,8 +181,8 @@ class GuiItemDetails(QWidget):
self.setLayout(self.mainBox) self.setLayout(self.mainBox)
# Make sure the columns for flags and counts don't resize too often # Make sure the columns for flags and counts don't resize too often
flagWidth = self.theTheme.getTextWidth("Mm", fntValue) flagWidth = self.mainTheme.getTextWidth("Mm", fntValue)
countWidth = self.theTheme.getTextWidth("99,999", fntValue) countWidth = self.mainTheme.getTextWidth("99,999", fntValue)
self.mainBox.setColumnMinimumWidth(1, flagWidth) self.mainBox.setColumnMinimumWidth(1, flagWidth)
self.mainBox.setColumnMinimumWidth(4, countWidth) self.mainBox.setColumnMinimumWidth(4, countWidth)
@@ -238,7 +238,7 @@ class GuiItemDetails(QWidget):
return return
self._itemHandle = tHandle self._itemHandle = tHandle
iPx = int(round(0.8*self.theTheme.baseIconSize)) iPx = int(round(0.8*self.mainTheme.baseIconSize))
# Label # Label
# ===== # =====
@@ -267,7 +267,7 @@ class GuiItemDetails(QWidget):
# Class # Class
# ===== # =====
classIcon = self.theTheme.getIcon(nwLabels.CLASS_ICON[nwItem.itemClass]) classIcon = self.mainTheme.getIcon(nwLabels.CLASS_ICON[nwItem.itemClass])
self.classIcon.setPixmap(classIcon.pixmap(iPx, iPx)) self.classIcon.setPixmap(classIcon.pixmap(iPx, iPx))
self.classData.setText(trConst(nwLabels.CLASS_NAME[nwItem.itemClass])) self.classData.setText(trConst(nwLabels.CLASS_NAME[nwItem.itemClass]))
@@ -275,7 +275,7 @@ class GuiItemDetails(QWidget):
# ====== # ======
hLevel = self.theProject.index.getHandleHeaderLevel(tHandle) hLevel = self.theProject.index.getHandleHeaderLevel(tHandle)
usageIcon = self.theTheme.getItemIcon( usageIcon = self.mainTheme.getItemIcon(
nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel
) )
self.usageIcon.setPixmap(usageIcon.pixmap(iPx, iPx)) self.usageIcon.setPixmap(usageIcon.pixmap(iPx, iPx))
+3 -3
View File
@@ -52,7 +52,7 @@ class GuiNovelTree(QTreeWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
# Internal Variables # Internal Variables
@@ -60,7 +60,7 @@ class GuiNovelTree(QTreeWidget):
self._lastBuild = 0 self._lastBuild = 0
# Build GUI # Build GUI
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
self.setFrameStyle(QFrame.NoFrame) self.setFrameStyle(QFrame.NoFrame)
self.setIconSize(QSize(iPx, iPx)) self.setIconSize(QSize(iPx, iPx))
self.setIndentation(iPx) self.setIndentation(iPx)
@@ -309,7 +309,7 @@ class GuiNovelTree(QTreeWidget):
newItem.setText(self.C_TITLE, novIdx.title) newItem.setText(self.C_TITLE, novIdx.title)
newItem.setData(self.C_TITLE, Qt.UserRole, theData) newItem.setData(self.C_TITLE, Qt.UserRole, theData)
newItem.setIcon(self.C_TITLE, self.theTheme.getIcon(hIcon)) newItem.setIcon(self.C_TITLE, self.mainTheme.getIcon(hIcon))
newItem.setText(self.C_WORDS, f"{wC:n}") newItem.setText(self.C_WORDS, f"{wC:n}")
newItem.setTextAlignment(self.C_WORDS, Qt.AlignRight) newItem.setTextAlignment(self.C_WORDS, Qt.AlignRight)
+12 -12
View File
@@ -179,7 +179,7 @@ class GuiOutlineToolBar(QToolBar):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = theOutline.mainGui self.mainGui = theOutline.mainGui
self.theProject = theOutline.mainGui.theProject self.theProject = theOutline.mainGui.theProject
self.theTheme = theOutline.mainGui.theTheme self.mainTheme = theOutline.mainGui.mainTheme
iPx = self.mainConf.pxInt(22) iPx = self.mainConf.pxInt(22)
mPx = self.mainConf.pxInt(12) mPx = self.mainConf.pxInt(12)
@@ -202,7 +202,7 @@ class GuiOutlineToolBar(QToolBar):
# Actions # Actions
self.aRefresh = QAction(self.tr("Refresh"), self) self.aRefresh = QAction(self.tr("Refresh"), self)
self.aRefresh.setIcon(self.theTheme.getIcon("refresh")) self.aRefresh.setIcon(self.mainTheme.getIcon("refresh"))
self.aRefresh.triggered.connect(self._refreshRequested) self.aRefresh.triggered.connect(self._refreshRequested)
# Column Menu # Column Menu
@@ -212,7 +212,7 @@ class GuiOutlineToolBar(QToolBar):
) )
self.tbColumns = QToolButton(self) self.tbColumns = QToolButton(self)
self.tbColumns.setIcon(self.theTheme.getIcon("menu")) self.tbColumns.setIcon(self.mainTheme.getIcon("menu"))
self.tbColumns.setMenu(self.mColumns) self.tbColumns.setMenu(self.mColumns)
self.tbColumns.setPopupMode(QToolButton.InstantPopup) self.tbColumns.setPopupMode(QToolButton.InstantPopup)
@@ -236,7 +236,7 @@ class GuiOutlineToolBar(QToolBar):
"""Fill the novel combo box with a list of all novel folders. """Fill the novel combo box with a list of all novel folders.
""" """
self.novelValue.clear() self.novelValue.clear()
tIcon = self.theTheme.getIcon(nwLabels.CLASS_ICON[nwItemClass.NOVEL]) tIcon = self.mainTheme.getIcon(nwLabels.CLASS_ICON[nwItemClass.NOVEL])
for tHandle, nwItem in self.theProject.tree.iterRoots(nwItemClass.NOVEL): for tHandle, nwItem in self.theProject.tree.iterRoots(nwItemClass.NOVEL):
self.novelValue.addItem(tIcon, nwItem.itemName, tHandle) self.novelValue.addItem(tIcon, nwItem.itemName, tHandle)
self.novelValue.insertSeparator(self.novelValue.count()) self.novelValue.insertSeparator(self.novelValue.count())
@@ -324,7 +324,7 @@ class GuiOutlineTree(QTreeWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = theOutline.mainGui self.mainGui = theOutline.mainGui
self.theProject = theOutline.mainGui.theProject self.theProject = theOutline.mainGui.theProject
self.theTheme = theOutline.mainGui.theTheme self.mainTheme = theOutline.mainGui.mainTheme
self.setFrameStyle(QFrame.NoFrame) self.setFrameStyle(QFrame.NoFrame)
self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setSelectionBehavior(QAbstractItemView.SelectRows)
@@ -334,7 +334,7 @@ class GuiOutlineTree(QTreeWidget):
self.itemDoubleClicked.connect(self._treeDoubleClick) self.itemDoubleClicked.connect(self._treeDoubleClick)
self.itemSelectionChanged.connect(self._itemSelected) self.itemSelectionChanged.connect(self._itemSelected)
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
self.setIconSize(QSize(iPx, iPx)) self.setIconSize(QSize(iPx, iPx))
self.setIndentation(iPx) self.setIndentation(iPx)
@@ -682,7 +682,7 @@ class GuiOutlineTree(QTreeWidget):
hIcon = "doc_%s" % novIdx.level.lower() hIcon = "doc_%s" % novIdx.level.lower()
hLevel = self.theProject.index.getHandleHeaderLevel(tHandle) hLevel = self.theProject.index.getHandleHeaderLevel(tHandle)
dIcon = self.theTheme.getItemIcon(nwItemType.FILE, None, nwItemLayout.DOCUMENT, hLevel) dIcon = self.mainTheme.getItemIcon(nwItemType.FILE, None, nwItemLayout.DOCUMENT, hLevel)
cC = int(novIdx.charCount) cC = int(novIdx.charCount)
wC = int(novIdx.wordCount) wC = int(novIdx.wordCount)
@@ -690,7 +690,7 @@ class GuiOutlineTree(QTreeWidget):
newItem.setText(self._colIdx[nwOutline.TITLE], novIdx.title) newItem.setText(self._colIdx[nwOutline.TITLE], novIdx.title)
newItem.setData(self._colIdx[nwOutline.TITLE], Qt.UserRole, tHandle) newItem.setData(self._colIdx[nwOutline.TITLE], Qt.UserRole, tHandle)
newItem.setIcon(self._colIdx[nwOutline.TITLE], self.theTheme.getIcon(hIcon)) newItem.setIcon(self._colIdx[nwOutline.TITLE], self.mainTheme.getIcon(hIcon))
newItem.setText(self._colIdx[nwOutline.LEVEL], novIdx.level) newItem.setText(self._colIdx[nwOutline.LEVEL], novIdx.level)
newItem.setText(self._colIdx[nwOutline.LABEL], nwItem.itemName) newItem.setText(self._colIdx[nwOutline.LABEL], nwItem.itemName)
newItem.setIcon(self._colIdx[nwOutline.LABEL], dIcon) newItem.setIcon(self._colIdx[nwOutline.LABEL], dIcon)
@@ -784,12 +784,12 @@ class GuiOutlineDetails(QScrollArea):
self.theOutline = theOutline self.theOutline = theOutline
self.mainGui = theOutline.mainGui self.mainGui = theOutline.mainGui
self.theProject = theOutline.mainGui.theProject self.theProject = theOutline.mainGui.theProject
self.theTheme = theOutline.mainGui.theTheme self.mainTheme = theOutline.mainGui.mainTheme
# Sizes # Sizes
minTitle = 30*self.theTheme.textNWidth minTitle = 30*self.mainTheme.textNWidth
maxTitle = 40*self.theTheme.textNWidth maxTitle = 40*self.mainTheme.textNWidth
wCount = self.theTheme.getTextWidth("999,999") wCount = self.mainTheme.getTextWidth("999,999")
hSpace = int(self.mainConf.pxInt(10)) hSpace = int(self.mainConf.pxInt(10))
vSpace = int(self.mainConf.pxInt(4)) vSpace = int(self.mainConf.pxInt(4))
+17 -17
View File
@@ -169,9 +169,9 @@ class GuiProjectToolBar(QWidget):
self.projTree = projView.projTree self.projTree = projView.projTree
self.mainGui = projView.mainGui self.mainGui = projView.mainGui
self.theProject = projView.mainGui.theProject self.theProject = projView.mainGui.theProject
self.theTheme = projView.mainGui.theTheme self.mainTheme = projView.mainGui.mainTheme
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
mPx = self.mainConf.pxInt(4) mPx = self.mainConf.pxInt(4)
self.setContentsMargins(0, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0)
@@ -195,14 +195,14 @@ class GuiProjectToolBar(QWidget):
# Move Buttons # Move Buttons
self.tbMoveU = QToolButton(self) self.tbMoveU = QToolButton(self)
self.tbMoveU.setToolTip("%s [Ctrl+Up]" % self.tr("Move Up")) self.tbMoveU.setToolTip("%s [Ctrl+Up]" % self.tr("Move Up"))
self.tbMoveU.setIcon(self.theTheme.getIcon("up")) self.tbMoveU.setIcon(self.mainTheme.getIcon("up"))
self.tbMoveU.setIconSize(QSize(iPx, iPx)) self.tbMoveU.setIconSize(QSize(iPx, iPx))
self.tbMoveU.setStyleSheet(buttonStyle) self.tbMoveU.setStyleSheet(buttonStyle)
self.tbMoveU.clicked.connect(lambda: self.projTree.moveTreeItem(-1)) self.tbMoveU.clicked.connect(lambda: self.projTree.moveTreeItem(-1))
self.tbMoveD = QToolButton(self) self.tbMoveD = QToolButton(self)
self.tbMoveD.setToolTip("%s [Ctrl+Down]" % self.tr("Move Down")) self.tbMoveD.setToolTip("%s [Ctrl+Down]" % self.tr("Move Down"))
self.tbMoveD.setIcon(self.theTheme.getIcon("down")) self.tbMoveD.setIcon(self.mainTheme.getIcon("down"))
self.tbMoveD.setIconSize(QSize(iPx, iPx)) self.tbMoveD.setIconSize(QSize(iPx, iPx))
self.tbMoveD.setStyleSheet(buttonStyle) self.tbMoveD.setStyleSheet(buttonStyle)
self.tbMoveD.clicked.connect(lambda: self.projTree.moveTreeItem(1)) self.tbMoveD.clicked.connect(lambda: self.projTree.moveTreeItem(1))
@@ -211,31 +211,31 @@ class GuiProjectToolBar(QWidget):
self.mAdd = QMenu() self.mAdd = QMenu()
self.aAddEmpty = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["document"])) self.aAddEmpty = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["document"]))
self.aAddEmpty.setIcon(self.theTheme.getIcon("proj_document")) self.aAddEmpty.setIcon(self.mainTheme.getIcon("proj_document"))
self.aAddEmpty.triggered.connect( self.aAddEmpty.triggered.connect(
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=0, isNote=False) lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=0, isNote=False)
) )
self.aAddChap = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["doc_h2"])) self.aAddChap = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["doc_h2"]))
self.aAddChap.setIcon(self.theTheme.getIcon("proj_chapter")) self.aAddChap.setIcon(self.mainTheme.getIcon("proj_chapter"))
self.aAddChap.triggered.connect( self.aAddChap.triggered.connect(
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=2, isNote=False) lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=2, isNote=False)
) )
self.aAddScene = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["doc_h3"])) self.aAddScene = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["doc_h3"]))
self.aAddScene.setIcon(self.theTheme.getIcon("proj_scene")) self.aAddScene.setIcon(self.mainTheme.getIcon("proj_scene"))
self.aAddScene.triggered.connect( self.aAddScene.triggered.connect(
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=3, isNote=False) lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=3, isNote=False)
) )
self.aAddNote = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["note"])) self.aAddNote = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["note"]))
self.aAddNote.setIcon(self.theTheme.getIcon("proj_note")) self.aAddNote.setIcon(self.mainTheme.getIcon("proj_note"))
self.aAddNote.triggered.connect( self.aAddNote.triggered.connect(
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=1, isNote=True) lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=1, isNote=True)
) )
self.aAddFolder = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["folder"])) self.aAddFolder = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["folder"]))
self.aAddFolder.setIcon(self.theTheme.getIcon("proj_folder")) self.aAddFolder.setIcon(self.mainTheme.getIcon("proj_folder"))
self.aAddFolder.triggered.connect( self.aAddFolder.triggered.connect(
lambda: self.projTree.newTreeItem(nwItemType.FOLDER) lambda: self.projTree.newTreeItem(nwItemType.FOLDER)
) )
@@ -255,7 +255,7 @@ class GuiProjectToolBar(QWidget):
self.tbAdd = QToolButton(self) self.tbAdd = QToolButton(self)
self.tbAdd.setToolTip("%s [Ctrl+N]" % self.tr("Add Item")) self.tbAdd.setToolTip("%s [Ctrl+N]" % self.tr("Add Item"))
self.tbAdd.setShortcut("Ctrl+N") self.tbAdd.setShortcut("Ctrl+N")
self.tbAdd.setIcon(self.theTheme.getIcon("add")) self.tbAdd.setIcon(self.mainTheme.getIcon("add"))
self.tbAdd.setIconSize(QSize(iPx, iPx)) self.tbAdd.setIconSize(QSize(iPx, iPx))
self.tbAdd.setStyleSheet(buttonStyle) self.tbAdd.setStyleSheet(buttonStyle)
self.tbAdd.setMenu(self.mAdd) self.tbAdd.setMenu(self.mAdd)
@@ -272,7 +272,7 @@ class GuiProjectToolBar(QWidget):
self.tbMore = QToolButton(self) self.tbMore = QToolButton(self)
self.tbMore.setToolTip(self.tr("More Options")) self.tbMore.setToolTip(self.tr("More Options"))
self.tbMore.setIcon(self.theTheme.getIcon("menu")) self.tbMore.setIcon(self.mainTheme.getIcon("menu"))
self.tbMore.setIconSize(QSize(iPx, iPx)) self.tbMore.setIconSize(QSize(iPx, iPx))
self.tbMore.setStyleSheet(buttonStyle) self.tbMore.setStyleSheet(buttonStyle)
self.tbMore.setMenu(self.mMore) self.tbMore.setMenu(self.mMore)
@@ -302,7 +302,7 @@ class GuiProjectToolBar(QWidget):
"""Add a menu entry for a root folder of a given class. """Add a menu entry for a root folder of a given class.
""" """
aNew = self.mAddRoot.addAction(trConst(nwLabels.CLASS_NAME[itemClass])) aNew = self.mAddRoot.addAction(trConst(nwLabels.CLASS_NAME[itemClass]))
aNew.setIcon(self.theTheme.getIcon(nwLabels.CLASS_ICON[itemClass])) aNew.setIcon(self.mainTheme.getIcon(nwLabels.CLASS_ICON[itemClass]))
aNew.triggered.connect(lambda: self.projTree.newTreeItem(nwItemType.ROOT, itemClass)) aNew.triggered.connect(lambda: self.projTree.newTreeItem(nwItemType.ROOT, itemClass))
self.mAddRoot.addAction(aNew) self.mAddRoot.addAction(aNew)
@@ -324,7 +324,7 @@ class GuiProjectTree(QTreeWidget):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.projView = projView self.projView = projView
self.mainGui = projView.mainGui self.mainGui = projView.mainGui
self.theTheme = projView.mainGui.theTheme self.mainTheme = projView.mainGui.mainTheme
self.theProject = projView.mainGui.theProject self.theProject = projView.mainGui.theProject
# Internal Variables # Internal Variables
@@ -341,7 +341,7 @@ class GuiProjectTree(QTreeWidget):
self.customContextMenuRequested.connect(self._openContextMenu) self.customContextMenuRequested.connect(self._openContextMenu)
# Tree Settings # Tree Settings
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
cMg = self.mainConf.pxInt(6) cMg = self.mainConf.pxInt(6)
self.setIconSize(QSize(iPx, iPx)) self.setIconSize(QSize(iPx, iPx))
self.setFrameStyle(QFrame.NoFrame) self.setFrameStyle(QFrame.NoFrame)
@@ -779,13 +779,13 @@ class GuiProjectTree(QTreeWidget):
expIcon = QIcon() expIcon = QIcon()
if nwItem.itemType == nwItemType.FILE: if nwItem.itemType == nwItemType.FILE:
if nwItem.isExported: if nwItem.isExported:
expIcon = self.theTheme.getIcon("check") expIcon = self.mainTheme.getIcon("check")
else: else:
expIcon = self.theTheme.getIcon("cross") expIcon = self.mainTheme.getIcon("cross")
itemStatus, statusIcon = nwItem.getImportStatus() itemStatus, statusIcon = nwItem.getImportStatus()
hLevel = self.theProject.index.getHandleHeaderLevel(tHandle) hLevel = self.theProject.index.getHandleHeaderLevel(tHandle)
itemIcon = self.theTheme.getItemIcon( itemIcon = self.mainTheme.getItemIcon(
nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel
) )
+10 -10
View File
@@ -48,15 +48,15 @@ class GuiMainStatus(QStatusBar):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.refTime = None self.refTime = None
self.userIdle = False self.userIdle = False
colNone = QColor(*self.theTheme.statNone) colNone = QColor(*self.mainTheme.statNone)
colTrue = QColor(*self.theTheme.statUnsaved) colTrue = QColor(*self.mainTheme.statUnsaved)
colFalse = QColor(*self.theTheme.statSaved) colFalse = QColor(*self.mainTheme.statSaved)
iPx = self.theTheme.baseIconSize iPx = self.mainTheme.baseIconSize
# Permanent Widgets # Permanent Widgets
# ================= # =================
@@ -66,7 +66,7 @@ class GuiMainStatus(QStatusBar):
# The Spell Checker Language # The Spell Checker Language
self.langIcon = QLabel("") self.langIcon = QLabel("")
self.langText = QLabel(self.tr("None")) self.langText = QLabel(self.tr("None"))
self.langIcon.setPixmap(self.theTheme.getPixmap("status_lang", (iPx, iPx))) self.langIcon.setPixmap(self.mainTheme.getPixmap("status_lang", (iPx, iPx)))
self.langIcon.setContentsMargins(0, 0, 0, 0) self.langIcon.setContentsMargins(0, 0, 0, 0)
self.langText.setContentsMargins(0, 0, xM, 0) self.langText.setContentsMargins(0, 0, xM, 0)
self.addPermanentWidget(self.langIcon) self.addPermanentWidget(self.langIcon)
@@ -91,7 +91,7 @@ class GuiMainStatus(QStatusBar):
# The Project and Session Stats # The Project and Session Stats
self.statsIcon = QLabel() self.statsIcon = QLabel()
self.statsText = QLabel("") self.statsText = QLabel("")
self.statsIcon.setPixmap(self.theTheme.getPixmap("status_stats", (iPx, iPx))) self.statsIcon.setPixmap(self.mainTheme.getPixmap("status_stats", (iPx, iPx)))
self.statsIcon.setContentsMargins(0, 0, 0, 0) self.statsIcon.setContentsMargins(0, 0, 0, 0)
self.statsText.setContentsMargins(0, 0, xM, 0) self.statsText.setContentsMargins(0, 0, xM, 0)
self.addPermanentWidget(self.statsIcon) self.addPermanentWidget(self.statsIcon)
@@ -99,14 +99,14 @@ class GuiMainStatus(QStatusBar):
# The Session Clock # The Session Clock
# Set the mimimum width so the label doesn't rescale every second # Set the mimimum width so the label doesn't rescale every second
self.timePixmap = self.theTheme.getPixmap("status_time", (iPx, iPx)) self.timePixmap = self.mainTheme.getPixmap("status_time", (iPx, iPx))
self.idlePixmap = self.theTheme.getPixmap("status_idle", (iPx, iPx)) self.idlePixmap = self.mainTheme.getPixmap("status_idle", (iPx, iPx))
self.timeIcon = QLabel() self.timeIcon = QLabel()
self.timeText = QLabel("") self.timeText = QLabel("")
self.timeIcon.setPixmap(self.timePixmap) self.timeIcon.setPixmap(self.timePixmap)
self.timeText.setToolTip(self.tr("Session Time")) self.timeText.setToolTip(self.tr("Session Time"))
self.timeText.setMinimumWidth(self.theTheme.getTextWidth("00:00:00:")) self.timeText.setMinimumWidth(self.mainTheme.getTextWidth("00:00:00:"))
self.timeIcon.setContentsMargins(0, 0, 0, 0) self.timeIcon.setContentsMargins(0, 0, 0, 0)
self.timeText.setContentsMargins(0, 0, 0, 0) self.timeText.setContentsMargins(0, 0, 0, 0)
self.addPermanentWidget(self.timeIcon) self.addPermanentWidget(self.timeIcon)
+8 -8
View File
@@ -54,7 +54,7 @@ class GuiTheme:
def __init__(self): def __init__(self):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theIcons = GuiIcons(self) self.iconCache = GuiIcons(self)
# Loaded Theme Settings # Loaded Theme Settings
# ===================== # =====================
@@ -127,13 +127,13 @@ class GuiTheme:
self.updateFont() self.updateFont()
self.updateTheme() self.updateTheme()
self.theIcons.updateTheme() self.iconCache.updateTheme()
# Icon Functions # Icon Functions
self.getIcon = self.theIcons.getIcon self.getIcon = self.iconCache.getIcon
self.getPixmap = self.theIcons.getPixmap self.getPixmap = self.iconCache.getPixmap
self.getItemIcon = self.theIcons.getItemIcon self.getItemIcon = self.iconCache.getItemIcon
self.loadDecoration = self.theIcons.loadDecoration self.loadDecoration = self.iconCache.loadDecoration
# Extract Other Info # Extract Other Info
self.guiDPI = qApp.primaryScreen().logicalDotsPerInchX() self.guiDPI = qApp.primaryScreen().logicalDotsPerInchX()
@@ -478,10 +478,10 @@ class GuiIcons:
"wiz-back": "wizard-back.jpg", "wiz-back": "wizard-back.jpg",
} }
def __init__(self, theTheme): def __init__(self, mainTheme):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theTheme = theTheme self.mainTheme = mainTheme
# Storage # Storage
self._qIcons = {} self._qIcons = {}
+12 -12
View File
@@ -45,16 +45,16 @@ class GuiViewsBar(QToolBar):
logger.debug("Initialising GuiViewsBar ...") logger.debug("Initialising GuiViewsBar ...")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
# Style # Style
iPx = self.mainConf.pxInt(22) iPx = self.mainConf.pxInt(22)
mPx = self.mainConf.pxInt(60) mPx = self.mainConf.pxInt(60)
lblFont = self.theTheme.guiFont lblFont = self.mainTheme.guiFont
lblFont.setPointSizeF(0.65*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.65*self.mainTheme.fontPointSize)
self.setMovable(False) self.setMovable(False)
self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
@@ -70,37 +70,37 @@ class GuiViewsBar(QToolBar):
self.aProject = QAction(self.tr("Project")) self.aProject = QAction(self.tr("Project"))
self.aProject.setFont(lblFont) self.aProject.setFont(lblFont)
self.aProject.setToolTip(self.tr("Show project tree and editor")) self.aProject.setToolTip(self.tr("Show project tree and editor"))
self.aProject.setIcon(self.theTheme.getIcon("view_editor")) self.aProject.setIcon(self.mainTheme.getIcon("view_editor"))
self.aProject.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.PROJECT)) self.aProject.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.PROJECT))
self.aNovel = QAction(self.tr("Novel")) self.aNovel = QAction(self.tr("Novel"))
self.aNovel.setFont(lblFont) self.aNovel.setFont(lblFont)
self.aNovel.setToolTip(self.tr("Show novel tree and editor")) self.aNovel.setToolTip(self.tr("Show novel tree and editor"))
self.aNovel.setIcon(self.theTheme.getIcon("view_novel")) self.aNovel.setIcon(self.mainTheme.getIcon("view_novel"))
self.aNovel.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.NOVEL)) self.aNovel.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.NOVEL))
self.aOutline = QAction(self.tr("Outline")) self.aOutline = QAction(self.tr("Outline"))
self.aOutline.setFont(lblFont) self.aOutline.setFont(lblFont)
self.aOutline.setToolTip(self.tr("Show novel outline")) self.aOutline.setToolTip(self.tr("Show novel outline"))
self.aOutline.setIcon(self.theTheme.getIcon("view_outline")) self.aOutline.setIcon(self.mainTheme.getIcon("view_outline"))
self.aOutline.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.OUTLINE)) self.aOutline.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.OUTLINE))
self.aBuild = QAction(self.tr("Build")) self.aBuild = QAction(self.tr("Build"))
self.aBuild.setFont(lblFont) self.aBuild.setFont(lblFont)
self.aBuild.setToolTip(self.tr("Build novel project")) self.aBuild.setToolTip(self.tr("Build novel project"))
self.aBuild.setIcon(self.theTheme.getIcon("view_build")) self.aBuild.setIcon(self.mainTheme.getIcon("view_build"))
self.aBuild.triggered.connect(lambda: self.mainGui.showBuildProjectDialog()) self.aBuild.triggered.connect(lambda: self.mainGui.showBuildProjectDialog())
self.aDetails = QAction(self.tr("Details")) self.aDetails = QAction(self.tr("Details"))
self.aDetails.setFont(lblFont) self.aDetails.setFont(lblFont)
self.aDetails.setToolTip(self.tr("Show project details")) self.aDetails.setToolTip(self.tr("Show project details"))
self.aDetails.setIcon(self.theTheme.getIcon("proj_details")) self.aDetails.setIcon(self.mainTheme.getIcon("proj_details"))
self.aDetails.triggered.connect(lambda: self.mainGui.showProjectDetailsDialog()) self.aDetails.triggered.connect(lambda: self.mainGui.showProjectDetailsDialog())
self.aStats = QAction(self.tr("Stats")) self.aStats = QAction(self.tr("Stats"))
self.aStats.setFont(lblFont) self.aStats.setFont(lblFont)
self.aStats.setToolTip(self.tr("Show project statistics")) self.aStats.setToolTip(self.tr("Show project statistics"))
self.aStats.setIcon(self.theTheme.getIcon("proj_stats")) self.aStats.setIcon(self.mainTheme.getIcon("proj_stats"))
self.aStats.triggered.connect(lambda: self.mainGui.showWritingStatsDialog()) self.aStats.triggered.connect(lambda: self.mainGui.showWritingStatsDialog())
# Settings Menu # Settings Menu
@@ -117,7 +117,7 @@ class GuiViewsBar(QToolBar):
self.tbSettings = QToolButton(self) self.tbSettings = QToolButton(self)
self.tbSettings.setFont(lblFont) self.tbSettings.setFont(lblFont)
self.tbSettings.setText(self.tr("Settings")) self.tbSettings.setText(self.tr("Settings"))
self.tbSettings.setIcon(self.theTheme.getIcon("settings")) self.tbSettings.setIcon(self.mainTheme.getIcon("settings"))
self.tbSettings.setMenu(self.mSettings) self.tbSettings.setMenu(self.mSettings)
self.tbSettings.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.tbSettings.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
self.tbSettings.setPopupMode(QToolButton.InstantPopup) self.tbSettings.setPopupMode(QToolButton.InstantPopup)
+2 -2
View File
@@ -84,7 +84,7 @@ class GuiMain(QMainWindow):
# ============ # ============
# Core Classes and Settings # Core Classes and Settings
self.theTheme = GuiTheme() self.mainTheme = GuiTheme()
self.theProject = NWProject(self) self.theProject = NWProject(self)
self.hasProject = False self.hasProject = False
self.isFocusMode = False self.isFocusMode = False
@@ -915,7 +915,7 @@ class GuiMain(QMainWindow):
if dlgConf.result() == QDialog.Accepted: if dlgConf.result() == QDialog.Accepted:
logger.debug("Applying new preferences") logger.debug("Applying new preferences")
self.initMain() self.initMain()
self.theTheme.updateTheme() self.mainTheme.updateTheme()
self.saveDocument() self.saveDocument()
self.docEditor.initEditor() self.docEditor.initEditor()
self.docViewer.initViewer() self.docViewer.initViewer()
+9 -9
View File
@@ -73,7 +73,7 @@ class GuiBuildNovel(QDialog):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self.htmlText = [] # List of html documents self.htmlText = [] # List of html documents
@@ -93,7 +93,7 @@ class GuiBuildNovel(QDialog):
self.docView = GuiBuildNovelDocView(self, self.theProject) self.docView = GuiBuildNovelDocView(self, self.theProject)
hS = self.theTheme.fontPixelSize hS = self.mainTheme.fontPixelSize
wS = 2*hS wS = 2*hS
# Title Formats # Title Formats
@@ -238,11 +238,11 @@ class GuiBuildNovel(QDialog):
pOptions.getString("GuiBuildNovel", "textFont", self.mainConf.textFont) pOptions.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)
) )
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.setMaximumWidth(int(2.5*self.mainTheme.getTextWidth("...")))
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.textSize = QSpinBox(self) self.textSize = QSpinBox(self)
self.textSize.setFixedWidth(6*self.theTheme.textNWidth) self.textSize.setFixedWidth(6*self.mainTheme.textNWidth)
self.textSize.setMinimum(6) self.textSize.setMinimum(6)
self.textSize.setMaximum(72) self.textSize.setMaximum(72)
self.textSize.setSingleStep(1) self.textSize.setSingleStep(1)
@@ -251,7 +251,7 @@ class GuiBuildNovel(QDialog):
) )
self.lineHeight = QDoubleSpinBox(self) self.lineHeight = QDoubleSpinBox(self)
self.lineHeight.setFixedWidth(6*self.theTheme.textNWidth) self.lineHeight.setFixedWidth(6*self.mainTheme.textNWidth)
self.lineHeight.setMinimum(0.8) self.lineHeight.setMinimum(0.8)
self.lineHeight.setMaximum(3.0) self.lineHeight.setMaximum(3.0)
self.lineHeight.setSingleStep(0.05) self.lineHeight.setSingleStep(0.05)
@@ -1201,10 +1201,10 @@ class GuiBuildNovelDocView(QTextBrowser):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theProject = theProject self.theProject = theProject
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.buildTime = 0 self.buildTime = 0
self.setMinimumWidth(40*self.mainGui.theTheme.textNWidth) self.setMinimumWidth(40*self.mainGui.mainTheme.textNWidth)
self.setOpenExternalLinks(False) self.setOpenExternalLinks(False)
self.document().setDocumentMargin(self.mainConf.getTextMargin()) self.document().setDocumentMargin(self.mainConf.getTextMargin())
@@ -1238,9 +1238,9 @@ class GuiBuildNovelDocView(QTextBrowser):
lblPalette.setColor(QPalette.Foreground, lblPalette.toolTipText().color()) lblPalette.setColor(QPalette.Foreground, lblPalette.toolTipText().color())
lblFont = self.font() lblFont = self.font()
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
fPx = int(1.1*self.theTheme.fontPixelSize) fPx = int(1.1*self.mainTheme.fontPixelSize)
self.theTitle = QLabel("", self) self.theTitle = QLabel("", self)
self.theTitle.setIndent(0) self.theTitle.setIndent(0)
+4 -4
View File
@@ -48,9 +48,9 @@ class GuiLipsum(QDialog):
logger.debug("Initialising GuiLipsum ...") logger.debug("Initialising GuiLipsum ...")
self.setObjectName("GuiLipsum") self.setObjectName("GuiLipsum")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.setWindowTitle(self.tr("Insert Placeholder Text")) self.setWindowTitle(self.tr("Insert Placeholder Text"))
@@ -61,7 +61,7 @@ class GuiLipsum(QDialog):
nPx = self.mainConf.pxInt(64) nPx = self.mainConf.pxInt(64)
vSp = self.mainConf.pxInt(4) vSp = self.mainConf.pxInt(4)
self.docIcon = QLabel() self.docIcon = QLabel()
self.docIcon.setPixmap(self.mainGui.theTheme.getPixmap("proj_document", (nPx, nPx))) self.docIcon.setPixmap(self.mainTheme.getPixmap("proj_document", (nPx, nPx)))
self.leftBox = QVBoxLayout() self.leftBox = QVBoxLayout()
self.leftBox.setSpacing(vSp) self.leftBox.setSpacing(vSp)
+8 -8
View File
@@ -54,11 +54,11 @@ class GuiProjectWizard(QWizard):
logger.debug("Initialising GuiProjectWizard ...") logger.debug("Initialising GuiProjectWizard ...")
self.setObjectName("GuiProjectWizard") self.setObjectName("GuiProjectWizard")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.sideImage = self.theTheme.loadDecoration( self.sideImage = self.mainTheme.loadDecoration(
"wiz-back", None, self.mainConf.pxInt(370) "wiz-back", None, self.mainConf.pxInt(370)
) )
self.setWizardStyle(QWizard.ModernStyle) self.setWizardStyle(QWizard.ModernStyle)
@@ -92,7 +92,7 @@ class ProjWizardIntroPage(QWizardPage):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
self.theTheme = theWizard.theTheme self.mainTheme = theWizard.mainTheme
self.setTitle(self.tr("Create New Project")) self.setTitle(self.tr("Create New Project"))
self.theText = QLabel(self.tr( self.theText = QLabel(self.tr(
@@ -107,7 +107,7 @@ class ProjWizardIntroPage(QWizardPage):
"Peter Mitterhofer", "CC BY-SA 4.0" "Peter Mitterhofer", "CC BY-SA 4.0"
)) ))
lblFont = self.imgCredit.font() lblFont = self.imgCredit.font()
lblFont.setPointSizeF(0.6*self.theTheme.fontPointSize) lblFont.setPointSizeF(0.6*self.mainTheme.fontPointSize)
self.imgCredit.setFont(lblFont) self.imgCredit.setFont(lblFont)
xW = self.mainConf.pxInt(300) xW = self.mainConf.pxInt(300)
@@ -162,7 +162,7 @@ class ProjWizardFolderPage(QWizardPage):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
self.theTheme = theWizard.theTheme self.mainTheme = theWizard.mainTheme
self.setTitle(self.tr("Select Project Folder")) self.setTitle(self.tr("Select Project Folder"))
self.theText = QLabel(self.tr( self.theText = QLabel(self.tr(
@@ -180,7 +180,7 @@ class ProjWizardFolderPage(QWizardPage):
self.projPath.setPlaceholderText(self.tr("Required")) self.projPath.setPlaceholderText(self.tr("Required"))
self.browseButton = QPushButton("...") self.browseButton = QPushButton("...")
self.browseButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.browseButton.setMaximumWidth(int(2.5*self.mainTheme.getTextWidth("...")))
self.browseButton.clicked.connect(self._doBrowse) self.browseButton.clicked.connect(self._doBrowse)
self.errLabel = QLabel("") self.errLabel = QLabel("")
+14 -14
View File
@@ -65,7 +65,7 @@ class GuiWritingStats(QDialog):
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
self.theTheme = mainGui.theTheme self.mainTheme = mainGui.mainTheme
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
self.logData = [] self.logData = []
@@ -125,7 +125,7 @@ class GuiWritingStats(QDialog):
self.listBox.setSortingEnabled(True) self.listBox.setSortingEnabled(True)
# Word Bar # Word Bar
self.barHeight = int(round(0.5*self.theTheme.fontPixelSize)) self.barHeight = int(round(0.5*self.mainTheme.fontPixelSize))
self.barWidth = self.mainConf.pxInt(200) self.barWidth = self.mainConf.pxInt(200)
self.barImage = QPixmap(self.barHeight, self.barHeight) self.barImage = QPixmap(self.barHeight, self.barHeight)
self.barImage.fill(self.palette().highlight().color()) self.barImage.fill(self.palette().highlight().color())
@@ -136,27 +136,27 @@ class GuiWritingStats(QDialog):
self.infoBox.setLayout(self.infoForm) self.infoBox.setLayout(self.infoForm)
self.labelTotal = QLabel(formatTime(0)) self.labelTotal = QLabel(formatTime(0))
self.labelTotal.setFont(self.theTheme.guiFontFixed) self.labelTotal.setFont(self.mainTheme.guiFontFixed)
self.labelTotal.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.labelTotal.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
self.labelIdleT = QLabel(formatTime(0)) self.labelIdleT = QLabel(formatTime(0))
self.labelIdleT.setFont(self.theTheme.guiFontFixed) self.labelIdleT.setFont(self.mainTheme.guiFontFixed)
self.labelIdleT.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.labelIdleT.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
self.labelFilter = QLabel(formatTime(0)) self.labelFilter = QLabel(formatTime(0))
self.labelFilter.setFont(self.theTheme.guiFontFixed) self.labelFilter.setFont(self.mainTheme.guiFontFixed)
self.labelFilter.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.labelFilter.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
self.novelWords = QLabel("0") self.novelWords = QLabel("0")
self.novelWords.setFont(self.theTheme.guiFontFixed) self.novelWords.setFont(self.mainTheme.guiFontFixed)
self.novelWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.novelWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
self.notesWords = QLabel("0") self.notesWords = QLabel("0")
self.notesWords.setFont(self.theTheme.guiFontFixed) self.notesWords.setFont(self.mainTheme.guiFontFixed)
self.notesWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.notesWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
self.totalWords = QLabel("0") self.totalWords = QLabel("0")
self.totalWords.setFont(self.theTheme.guiFontFixed) self.totalWords.setFont(self.mainTheme.guiFontFixed)
self.totalWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.totalWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
lblTTime = QLabel(self.tr("Total Time:")) lblTTime = QLabel(self.tr("Total Time:"))
@@ -183,7 +183,7 @@ class GuiWritingStats(QDialog):
self.infoForm.setRowStretch(6, 1) self.infoForm.setRowStretch(6, 1)
# Filter Options # Filter Options
sPx = self.theTheme.baseIconSize sPx = self.mainTheme.baseIconSize
self.filterBox = QGroupBox(self.tr("Filters"), self) self.filterBox = QGroupBox(self.tr("Filters"), self)
self.filterForm = QGridLayout(self) self.filterForm = QGridLayout(self)
@@ -605,13 +605,13 @@ class GuiWritingStats(QDialog):
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight) newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight)
newItem.setTextAlignment(self.C_BAR, Qt.AlignLeft | Qt.AlignVCenter) newItem.setTextAlignment(self.C_BAR, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setFont(self.C_TIME, self.theTheme.guiFontFixed) newItem.setFont(self.C_TIME, self.mainTheme.guiFontFixed)
newItem.setFont(self.C_LENGTH, self.theTheme.guiFontFixed) newItem.setFont(self.C_LENGTH, self.mainTheme.guiFontFixed)
newItem.setFont(self.C_COUNT, self.theTheme.guiFontFixed) newItem.setFont(self.C_COUNT, self.mainTheme.guiFontFixed)
if showIdleTime: if showIdleTime:
newItem.setFont(self.C_IDLE, self.theTheme.guiFontFixed) newItem.setFont(self.C_IDLE, self.mainTheme.guiFontFixed)
else: else:
newItem.setFont(self.C_IDLE, self.theTheme.guiFont) newItem.setFont(self.C_IDLE, self.mainTheme.guiFont)
self.listBox.addTopLevelItem(newItem) self.listBox.addTopLevelItem(newItem)
self.timeFilter += sDiff self.timeFilter += sDiff
+2 -2
View File
@@ -36,8 +36,8 @@ def testDlgAbout_NWDialog(qtbot, monkeypatch, nwGUI):
monkeypatch.setattr(QMessageBox, "question", lambda *a: QMessageBox.Yes) monkeypatch.setattr(QMessageBox, "question", lambda *a: QMessageBox.Yes)
# NW About # NW About
nwGUI.theTheme.themeName = "A Theme" nwGUI.mainTheme.themeName = "A Theme"
nwGUI.theTheme.themeAuthor = "An Author" nwGUI.mainTheme.themeAuthor = "An Author"
assert nwGUI.showAboutNWDialog(showNotes=True) is True assert nwGUI.showAboutNWDialog(showNotes=True) is True
qtbot.waitUntil(lambda: getGuiItem("GuiAbout") is not None, timeout=1000) qtbot.waitUntil(lambda: getGuiItem("GuiAbout") is not None, timeout=1000)
+32 -32
View File
@@ -93,82 +93,82 @@ def testGuiTheme_Main(qtbot, monkeypatch, nwMinimal, tmpDir):
assert thePalette.link().color() == QColor(44, 152, 247) assert thePalette.link().color() == QColor(44, 152, 247)
assert thePalette.linkVisited().color() == QColor(44, 152, 247) assert thePalette.linkVisited().color() == QColor(44, 152, 247)
assert nwGUI.theTheme.statNone == [150, 152, 150] assert nwGUI.mainTheme.statNone == [150, 152, 150]
assert nwGUI.theTheme.statSaved == [39, 135, 78] assert nwGUI.mainTheme.statSaved == [39, 135, 78]
assert nwGUI.theTheme.statUnsaved == [138, 32, 32] assert nwGUI.mainTheme.statUnsaved == [138, 32, 32]
# Check Syntax Colours # Check Syntax Colours
assert nwGUI.theTheme.colBack == [45, 45, 45] assert nwGUI.mainTheme.colBack == [45, 45, 45]
assert nwGUI.theTheme.colText == [204, 204, 204] assert nwGUI.mainTheme.colText == [204, 204, 204]
assert nwGUI.theTheme.colLink == [102, 153, 204] assert nwGUI.mainTheme.colLink == [102, 153, 204]
assert nwGUI.theTheme.colHead == [102, 153, 204] assert nwGUI.mainTheme.colHead == [102, 153, 204]
assert nwGUI.theTheme.colHeadH == [102, 153, 204] assert nwGUI.mainTheme.colHeadH == [102, 153, 204]
assert nwGUI.theTheme.colEmph == [249, 145, 57] assert nwGUI.mainTheme.colEmph == [249, 145, 57]
assert nwGUI.theTheme.colDialN == [242, 119, 122] assert nwGUI.mainTheme.colDialN == [242, 119, 122]
assert nwGUI.theTheme.colDialD == [153, 204, 153] assert nwGUI.mainTheme.colDialD == [153, 204, 153]
assert nwGUI.theTheme.colDialS == [255, 204, 102] assert nwGUI.mainTheme.colDialS == [255, 204, 102]
assert nwGUI.theTheme.colHidden == [153, 153, 153] assert nwGUI.mainTheme.colHidden == [153, 153, 153]
assert nwGUI.theTheme.colKey == [242, 119, 122] assert nwGUI.mainTheme.colKey == [242, 119, 122]
assert nwGUI.theTheme.colVal == [204, 153, 204] assert nwGUI.mainTheme.colVal == [204, 153, 204]
assert nwGUI.theTheme.colSpell == [242, 119, 122] assert nwGUI.mainTheme.colSpell == [242, 119, 122]
assert nwGUI.theTheme.colError == [153, 204, 153] assert nwGUI.mainTheme.colError == [153, 204, 153]
assert nwGUI.theTheme.colRepTag == [102, 204, 204] assert nwGUI.mainTheme.colRepTag == [102, 204, 204]
assert nwGUI.theTheme.colMod == [249, 145, 57] assert nwGUI.mainTheme.colMod == [249, 145, 57]
# Test Icon class # Test Icon class
theIcons = nwGUI.theTheme.theIcons iconCache = nwGUI.mainTheme.iconCache
novelwriter.CONFIG.guiIcons = "invalid" novelwriter.CONFIG.guiIcons = "invalid"
assert theIcons.updateTheme() is True assert iconCache.updateTheme() is True
assert novelwriter.CONFIG.guiIcons == "typicons_light" assert novelwriter.CONFIG.guiIcons == "typicons_light"
# Ask for a non-existent key # Ask for a non-existent key
anImg = theIcons.loadDecoration("nonsense", 20, 20) anImg = iconCache.loadDecoration("nonsense", 20, 20)
assert isinstance(anImg, QPixmap) assert isinstance(anImg, QPixmap)
assert anImg.isNull() assert anImg.isNull()
# Add a non-existent file and request it # Add a non-existent file and request it
theIcons.DECO_MAP["nonsense"] = "nofile.jpg" iconCache.DECO_MAP["nonsense"] = "nofile.jpg"
anImg = theIcons.loadDecoration("nonsense", 20, 20) anImg = iconCache.loadDecoration("nonsense", 20, 20)
assert isinstance(anImg, QPixmap) assert isinstance(anImg, QPixmap)
assert anImg.isNull() assert anImg.isNull()
# Get a real image, with different size parameters # Get a real image, with different size parameters
anImg = theIcons.loadDecoration("wiz-back", 20, None) anImg = iconCache.loadDecoration("wiz-back", 20, None)
assert isinstance(anImg, QPixmap) assert isinstance(anImg, QPixmap)
assert not anImg.isNull() assert not anImg.isNull()
assert anImg.width() == 20 assert anImg.width() == 20
assert anImg.height() >= 56 assert anImg.height() >= 56
anImg = theIcons.loadDecoration("wiz-back", None, 70) anImg = iconCache.loadDecoration("wiz-back", None, 70)
assert isinstance(anImg, QPixmap) assert isinstance(anImg, QPixmap)
assert not anImg.isNull() assert not anImg.isNull()
assert anImg.height() == 70 assert anImg.height() == 70
assert anImg.width() >= 24 assert anImg.width() >= 24
anImg = theIcons.loadDecoration("wiz-back", 30, 70) anImg = iconCache.loadDecoration("wiz-back", 30, 70)
assert isinstance(anImg, QPixmap) assert isinstance(anImg, QPixmap)
assert not anImg.isNull() assert not anImg.isNull()
assert anImg.height() == 70 assert anImg.height() == 70
assert anImg.width() == 30 assert anImg.width() == 30
anImg = theIcons.loadDecoration("wiz-back", None, None) anImg = iconCache.loadDecoration("wiz-back", None, None)
assert isinstance(anImg, QPixmap) assert isinstance(anImg, QPixmap)
assert not anImg.isNull() assert not anImg.isNull()
assert anImg.height() >= 1500 assert anImg.height() >= 1500
assert anImg.width() >= 500 assert anImg.width() >= 500
# Load icons # Load icons
anIcon = theIcons.getIcon("nonsense") anIcon = iconCache.getIcon("nonsense")
assert isinstance(anIcon, QIcon) assert isinstance(anIcon, QIcon)
assert anIcon.isNull() assert anIcon.isNull()
anIcon = theIcons.getIcon("novelwriter") anIcon = iconCache.getIcon("novelwriter")
assert isinstance(anIcon, QIcon) assert isinstance(anIcon, QIcon)
assert not anIcon.isNull() assert not anIcon.isNull()
# Check return empty icon if file not found # Check return empty icon if file not found
theIcons.ICON_KEYS.add("testicon3") iconCache.ICON_KEYS.add("testicon3")
anIcon = theIcons.getIcon("testicon3") anIcon = iconCache.getIcon("testicon3")
assert isinstance(anIcon, QIcon) assert isinstance(anIcon, QIcon)
assert anIcon.isNull() assert anIcon.isNull()