Merge branch 'master' into release_0.7

This commit is contained in:
Veronica K. B. Olsen
2020-06-01 12:36:53 +02:00
6 changed files with 54 additions and 14 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
+20 -4
View File
@@ -52,7 +52,7 @@ class GuiDocTree(QTreeWidget):
def __init__(self, theParent, theProject): def __init__(self, theParent, theProject):
QTreeWidget.__init__(self, theParent) QTreeWidget.__init__(self, theParent)
logger.debug("Initialising DocTree ...") logger.debug("Initialising GuiDocTree ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theTheme = theParent.theTheme self.theTheme = theParent.theTheme
@@ -80,6 +80,14 @@ class GuiDocTree(QTreeWidget):
treeHead.setToolTip(self.C_EXPORT, "Include in build") treeHead.setToolTip(self.C_EXPORT, "Include in build")
treeHead.setToolTip(self.C_FLAGS, "Status, class, and layout flags") treeHead.setToolTip(self.C_FLAGS, "Status, class, and layout flags")
# Force the font to fix font sizing issues on some platforms
# like Ubuntu. This must also be set when the rows are added.
self.setFont(self.theTheme.guiFont)
treeHead.setFont(self.C_NAME, self.theTheme.guiFont)
treeHead.setFont(self.C_COUNT,self.theTheme.guiFont)
treeHead.setFont(self.C_EXPORT, self.theTheme.guiFont)
treeHead.setFont(self.C_FLAGS, self.theTheme.guiFont)
# Allow Move by Drag & Drop # Allow Move by Drag & Drop
self.setDragEnabled(True) self.setDragEnabled(True)
self.setDragDropMode(QAbstractItemView.InternalMove) self.setDragDropMode(QAbstractItemView.InternalMove)
@@ -93,13 +101,14 @@ class GuiDocTree(QTreeWidget):
# self.setSelectionMode(QAbstractItemView.ExtendedSelection) # self.setSelectionMode(QAbstractItemView.ExtendedSelection)
# self.setSelectionBehavior(QAbstractItemView.SelectRows) # self.setSelectionBehavior(QAbstractItemView.SelectRows)
# Get user's column width preferences for NAME and COUNT
for colN, colW in enumerate(self.mainConf.treeColWidth): for colN, colW in enumerate(self.mainConf.treeColWidth):
self.setColumnWidth(colN, colW) self.setColumnWidth(colN, colW)
self.resizeColumnToContents(self.C_EXPORT) self.resizeColumnToContents(self.C_EXPORT)
self.resizeColumnToContents(self.C_FLAGS) self.resizeColumnToContents(self.C_FLAGS)
logger.debug("DocTree initialisation complete") logger.debug("GuiDocTree initialisation complete")
# Internal Mapping # Internal Mapping
self.makeAlert = self.theParent.makeAlert self.makeAlert = self.theParent.makeAlert
@@ -114,7 +123,7 @@ class GuiDocTree(QTreeWidget):
"""Clear the GUI content and the related maps. """Clear the GUI content and the related maps.
""" """
self.clear() self.clear()
self.theMap = {} self.theMap = {}
self.orphRoot = None self.orphRoot = None
return return
@@ -578,7 +587,14 @@ class GuiDocTree(QTreeWidget):
newItem.setText(self.C_FLAGS, "") newItem.setText(self.C_FLAGS, "")
newItem.setText(self.C_HANDLE, tHandle) newItem.setText(self.C_HANDLE, tHandle)
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight) newItem.setTextAlignment(self.C_NAME, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight | Qt.AlignVCenter)
newItem.setTextAlignment(self.C_EXPORT, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setTextAlignment(self.C_FLAGS, Qt.AlignLeft | Qt.AlignVCenter)
newItem.setFont(self.C_NAME, self.theTheme.guiFont)
newItem.setFont(self.C_COUNT, self.theTheme.guiFont)
newItem.setFont(self.C_FLAGS, self.theTheme.guiFont)
self.theMap[tHandle] = newItem self.theMap[tHandle] = newItem
if pHandle is None: if pHandle is None:
+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