diff --git a/nw/gui/build.py b/nw/gui/build.py index 3c2e73da..72df5920 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -181,7 +181,7 @@ class GuiBuildNovel(QDialog): self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont) ) self.fontButton = QPushButton("...") - self.fontButton.setMaximumWidth(30) + self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.clicked.connect(self._selectFont) self.textSize = QSpinBox(self) diff --git a/nw/gui/dialogs/preferences.py b/nw/gui/dialogs/preferences.py index be45b396..35abd6b3 100644 --- a/nw/gui/dialogs/preferences.py +++ b/nw/gui/dialogs/preferences.py @@ -188,7 +188,7 @@ class GuiConfigEditGeneralTab(QWidget): self.guiFont.setFixedWidth(162) self.guiFont.setText(self.mainConf.guiFont) self.fontButton = QPushButton("...") - self.fontButton.setMaximumWidth(30) + self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.clicked.connect(self._selectFont) self.mainForm.addRow( "Font family", @@ -393,7 +393,7 @@ class GuiConfigEditLayoutTab(QWidget): self.textStyleFont.setFixedWidth(162) self.textStyleFont.setText(self.mainConf.textFont) self.fontButton = QPushButton("...") - self.fontButton.setMaximumWidth(30) + self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.clicked.connect(self._selectFont) self.mainForm.addRow( "Font family", diff --git a/nw/gui/dialogs/projectload.py b/nw/gui/dialogs/projectload.py index f5513ea0..63f0be9f 100644 --- a/nw/gui/dialogs/projectload.py +++ b/nw/gui/dialogs/projectload.py @@ -31,7 +31,7 @@ import nw from os import path from datetime import datetime -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import ( QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QTreeWidget, @@ -57,6 +57,7 @@ class GuiProjectLoad(QDialog): self.mainConf = nw.CONFIG self.theParent = theParent + self.theTheme = theParent.theTheme self.openState = self.NONE_STATE self.openPath = None @@ -70,12 +71,13 @@ class GuiProjectLoad(QDialog): self.setMinimumHeight(400) self.setModal(True) - self.guiDeco = self.theParent.theTheme.loadDecoration("nwicon", (96, 96)) + self.guiDeco = self.theTheme.loadDecoration("nwicon", (96, 96)) self.innerBox.addWidget(self.guiDeco, 0, Qt.AlignTop) self.projectForm = QGridLayout() self.projectForm.setContentsMargins(0, 0, 0, 0) + iPx = self.theTheme.textIconSize self.listBox = QTreeWidget() self.listBox.setSelectionMode(QAbstractItemView.SingleSelection) self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop) @@ -85,10 +87,14 @@ class GuiProjectLoad(QDialog): self.listBox.setColumnHidden(3, True) self.listBox.itemSelectionChanged.connect(self._doSelectRecent) self.listBox.itemDoubleClicked.connect(self._doOpenRecent) + self.listBox.setIconSize(QSize(iPx, iPx)) treeHead = self.listBox.headerItem() treeHead.setTextAlignment(1, Qt.AlignRight) treeHead.setTextAlignment(2, Qt.AlignRight) + treeHead.setFont(0, self.theTheme.guiFont) + treeHead.setFont(1, self.theTheme.guiFont) + treeHead.setFont(2, self.theTheme.guiFont) self.lblRecent = QLabel("Recently Opened Projects") self.lblPath = QLabel("Path") @@ -96,7 +102,7 @@ class GuiProjectLoad(QDialog): self.selPath.setReadOnly(True) self.browseButton = QPushButton("...") - self.browseButton.setMaximumWidth(30) + self.browseButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.browseButton.clicked.connect(self._doBrowse) self.projectForm.addWidget(self.lblRecent, 0, 0, 1, 3) @@ -251,8 +257,12 @@ class GuiProjectLoad(QDialog): newItem.setText(1, formatInt(listData[timeStamp][1])) newItem.setText(2, datetime.fromtimestamp(timeStamp).strftime("%x %X")) newItem.setText(3, listData[timeStamp][2]) - newItem.setTextAlignment(1, Qt.AlignRight) - newItem.setTextAlignment(2, Qt.AlignRight) + newItem.setTextAlignment(0, Qt.AlignLeft | Qt.AlignVCenter) + newItem.setTextAlignment(1, Qt.AlignRight | Qt.AlignVCenter) + newItem.setTextAlignment(2, Qt.AlignRight | Qt.AlignVCenter) + newItem.setFont(0, self.theTheme.guiFont) + newItem.setFont(1, self.theTheme.guiFont) + newItem.setFont(2, self.theTheme.guiFont) self.listBox.addTopLevelItem(newItem) if not hasSelection: newItem.setSelected(True) diff --git a/nw/gui/dialogs/projectsettings.py b/nw/gui/dialogs/projectsettings.py index a49193d1..66af994a 100644 --- a/nw/gui/dialogs/projectsettings.py +++ b/nw/gui/dialogs/projectsettings.py @@ -450,8 +450,14 @@ class GuiProjectEditReplace(QWidget): self.listBox.itemSelectionChanged.connect(self._selectedItem) self.listBox.setIndentation(0) + treeHead = self.listBox.headerItem() + treeHead.setFont(0, self.theTheme.guiFont) + treeHead.setFont(1, self.theTheme.guiFont) + for aKey, aVal in self.theProject.autoReplace.items(): newItem = QTreeWidgetItem(["<%s>" % aKey, aVal]) + newItem.setFont(0, self.theTheme.guiFont) + newItem.setFont(1, self.theTheme.guiFont) self.listBox.addTopLevelItem(newItem) self.listBox.sortByColumn(0, Qt.AscendingOrder) @@ -542,6 +548,8 @@ class GuiProjectEditReplace(QWidget): saveKey = "" % (self.listBox.topLevelItemCount() + 1) newVal = "" newItem = QTreeWidgetItem([saveKey, newVal]) + newItem.setFont(0, self.theTheme.guiFont) + newItem.setFont(1, self.theTheme.guiFont) self.listBox.addTopLevelItem(newItem) return True diff --git a/nw/gui/elements/outline.py b/nw/gui/elements/outline.py index 7c196d2e..982f21c9 100644 --- a/nw/gui/elements/outline.py +++ b/nw/gui/elements/outline.py @@ -89,8 +89,9 @@ class GuiProjectOutline(QTreeWidget): self.mainConf = nw.CONFIG self.theParent = theParent self.theProject = theProject - self.theIndex = self.theParent.theIndex - self.optState = self.theProject.optState + self.theTheme = theParent.theTheme + self.theIndex = theParent.theIndex + self.optState = theProject.optState self.headerMenu = GuiOutlineHeaderMenu(self) self.firstView = True @@ -337,6 +338,8 @@ class GuiProjectOutline(QTreeWidget): headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight) headItem.setTextAlignment(self.colIndex[nwOutline.WCOUNT], Qt.AlignRight) headItem.setTextAlignment(self.colIndex[nwOutline.PCOUNT], Qt.AlignRight) + for hItem in self.treeOrder: + headItem.setFont(self.colIndex[hItem], self.theTheme.guiFont) currTitle = None currChapter = None @@ -427,6 +430,9 @@ class GuiProjectOutline(QTreeWidget): newItem.setText(self.colIndex[nwOutline.ENTITY], ", ".join(theRefs[nwKeyWords.ENTITY_KEY])) newItem.setText(self.colIndex[nwOutline.CUSTOM], ", ".join(theRefs[nwKeyWords.CUSTOM_KEY])) + for i in self.treeOrder: + newItem.setFont(self.colIndex[i], self.theTheme.guiFont) + return newItem # END Class GuiProjectOutline