Merge pull request #275 from vkbo/font_sizes

Font Sizes – Continued
This commit is contained in:
Veronica K. Berglyd Olsen
2020-06-01 12:36:06 +02:00
committed by GitHub
5 changed files with 34 additions and 10 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ class GuiBuildNovel(QDialog):
self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont) self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)
) )
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(30) self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("...")))
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.textSize = QSpinBox(self) self.textSize = QSpinBox(self)
+2 -2
View File
@@ -188,7 +188,7 @@ class GuiConfigEditGeneralTab(QWidget):
self.guiFont.setFixedWidth(162) self.guiFont.setFixedWidth(162)
self.guiFont.setText(self.mainConf.guiFont) self.guiFont.setText(self.mainConf.guiFont)
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(30) self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("...")))
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.mainForm.addRow( self.mainForm.addRow(
"Font family", "Font family",
@@ -393,7 +393,7 @@ class GuiConfigEditLayoutTab(QWidget):
self.textStyleFont.setFixedWidth(162) self.textStyleFont.setFixedWidth(162)
self.textStyleFont.setText(self.mainConf.textFont) self.textStyleFont.setText(self.mainConf.textFont)
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(30) self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("...")))
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.mainForm.addRow( self.mainForm.addRow(
"Font family", "Font family",
+15 -5
View File
@@ -31,7 +31,7 @@ import nw
from os import path from os import path
from datetime import datetime from datetime import datetime
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QKeySequence from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QTreeWidget, QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QTreeWidget,
@@ -57,6 +57,7 @@ class GuiProjectLoad(QDialog):
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theTheme = theParent.theTheme
self.openState = self.NONE_STATE self.openState = self.NONE_STATE
self.openPath = None self.openPath = None
@@ -70,12 +71,13 @@ class GuiProjectLoad(QDialog):
self.setMinimumHeight(400) self.setMinimumHeight(400)
self.setModal(True) 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.innerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.projectForm = QGridLayout() self.projectForm = QGridLayout()
self.projectForm.setContentsMargins(0, 0, 0, 0) self.projectForm.setContentsMargins(0, 0, 0, 0)
iPx = self.theTheme.textIconSize
self.listBox = QTreeWidget() self.listBox = QTreeWidget()
self.listBox.setSelectionMode(QAbstractItemView.SingleSelection) self.listBox.setSelectionMode(QAbstractItemView.SingleSelection)
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop) self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
@@ -85,10 +87,14 @@ class GuiProjectLoad(QDialog):
self.listBox.setColumnHidden(3, True) self.listBox.setColumnHidden(3, True)
self.listBox.itemSelectionChanged.connect(self._doSelectRecent) self.listBox.itemSelectionChanged.connect(self._doSelectRecent)
self.listBox.itemDoubleClicked.connect(self._doOpenRecent) self.listBox.itemDoubleClicked.connect(self._doOpenRecent)
self.listBox.setIconSize(QSize(iPx, iPx))
treeHead = self.listBox.headerItem() treeHead = self.listBox.headerItem()
treeHead.setTextAlignment(1, Qt.AlignRight) treeHead.setTextAlignment(1, Qt.AlignRight)
treeHead.setTextAlignment(2, 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("<b>Recently Opened Projects</b>") self.lblRecent = QLabel("<b>Recently Opened Projects</b>")
self.lblPath = QLabel("<b>Path</b>") self.lblPath = QLabel("<b>Path</b>")
@@ -96,7 +102,7 @@ class GuiProjectLoad(QDialog):
self.selPath.setReadOnly(True) self.selPath.setReadOnly(True)
self.browseButton = QPushButton("...") self.browseButton = QPushButton("...")
self.browseButton.setMaximumWidth(30) self.browseButton.setMaximumWidth(int(2.5*self.theTheme.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)
@@ -251,8 +257,12 @@ class GuiProjectLoad(QDialog):
newItem.setText(1, formatInt(listData[timeStamp][1])) newItem.setText(1, formatInt(listData[timeStamp][1]))
newItem.setText(2, datetime.fromtimestamp(timeStamp).strftime("%x %X")) newItem.setText(2, datetime.fromtimestamp(timeStamp).strftime("%x %X"))
newItem.setText(3, listData[timeStamp][2]) newItem.setText(3, listData[timeStamp][2])
newItem.setTextAlignment(1, Qt.AlignRight) newItem.setTextAlignment(0, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setTextAlignment(2, Qt.AlignRight) 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) self.listBox.addTopLevelItem(newItem)
if not hasSelection: if not hasSelection:
newItem.setSelected(True) newItem.setSelected(True)
+8
View File
@@ -450,8 +450,14 @@ class GuiProjectEditReplace(QWidget):
self.listBox.itemSelectionChanged.connect(self._selectedItem) self.listBox.itemSelectionChanged.connect(self._selectedItem)
self.listBox.setIndentation(0) 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(): for aKey, aVal in self.theProject.autoReplace.items():
newItem = QTreeWidgetItem(["<%s>" % aKey, aVal]) newItem = QTreeWidgetItem(["<%s>" % aKey, aVal])
newItem.setFont(0, self.theTheme.guiFont)
newItem.setFont(1, self.theTheme.guiFont)
self.listBox.addTopLevelItem(newItem) self.listBox.addTopLevelItem(newItem)
self.listBox.sortByColumn(0, Qt.AscendingOrder) self.listBox.sortByColumn(0, Qt.AscendingOrder)
@@ -542,6 +548,8 @@ class GuiProjectEditReplace(QWidget):
saveKey = "<keyword%d>" % (self.listBox.topLevelItemCount() + 1) saveKey = "<keyword%d>" % (self.listBox.topLevelItemCount() + 1)
newVal = "" newVal = ""
newItem = QTreeWidgetItem([saveKey, newVal]) newItem = QTreeWidgetItem([saveKey, newVal])
newItem.setFont(0, self.theTheme.guiFont)
newItem.setFont(1, self.theTheme.guiFont)
self.listBox.addTopLevelItem(newItem) self.listBox.addTopLevelItem(newItem)
return True return True
+8 -2
View File
@@ -89,8 +89,9 @@ class GuiProjectOutline(QTreeWidget):
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theProject = theProject self.theProject = theProject
self.theIndex = self.theParent.theIndex self.theTheme = theParent.theTheme
self.optState = self.theProject.optState self.theIndex = theParent.theIndex
self.optState = theProject.optState
self.headerMenu = GuiOutlineHeaderMenu(self) self.headerMenu = GuiOutlineHeaderMenu(self)
self.firstView = True self.firstView = True
@@ -337,6 +338,8 @@ class GuiProjectOutline(QTreeWidget):
headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight) headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.WCOUNT], Qt.AlignRight) headItem.setTextAlignment(self.colIndex[nwOutline.WCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.PCOUNT], 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 currTitle = None
currChapter = 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.ENTITY], ", ".join(theRefs[nwKeyWords.ENTITY_KEY]))
newItem.setText(self.colIndex[nwOutline.CUSTOM], ", ".join(theRefs[nwKeyWords.CUSTOM_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 return newItem
# END Class GuiProjectOutline # END Class GuiProjectOutline