Merge branch 'master' into release_0.7
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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("<b>Recently Opened Projects</b>")
|
||||
self.lblPath = QLabel("<b>Path</b>")
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = "<keyword%d>" % (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
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class GuiDocTree(QTreeWidget):
|
||||
def __init__(self, theParent, theProject):
|
||||
QTreeWidget.__init__(self, theParent)
|
||||
|
||||
logger.debug("Initialising DocTree ...")
|
||||
logger.debug("Initialising GuiDocTree ...")
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theParent = theParent
|
||||
self.theTheme = theParent.theTheme
|
||||
@@ -80,6 +80,14 @@ class GuiDocTree(QTreeWidget):
|
||||
treeHead.setToolTip(self.C_EXPORT, "Include in build")
|
||||
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
|
||||
self.setDragEnabled(True)
|
||||
self.setDragDropMode(QAbstractItemView.InternalMove)
|
||||
@@ -93,13 +101,14 @@ class GuiDocTree(QTreeWidget):
|
||||
# self.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
||||
# self.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
|
||||
# Get user's column width preferences for NAME and COUNT
|
||||
for colN, colW in enumerate(self.mainConf.treeColWidth):
|
||||
self.setColumnWidth(colN, colW)
|
||||
|
||||
self.resizeColumnToContents(self.C_EXPORT)
|
||||
self.resizeColumnToContents(self.C_FLAGS)
|
||||
|
||||
logger.debug("DocTree initialisation complete")
|
||||
logger.debug("GuiDocTree initialisation complete")
|
||||
|
||||
# Internal Mapping
|
||||
self.makeAlert = self.theParent.makeAlert
|
||||
@@ -114,7 +123,7 @@ class GuiDocTree(QTreeWidget):
|
||||
"""Clear the GUI content and the related maps.
|
||||
"""
|
||||
self.clear()
|
||||
self.theMap = {}
|
||||
self.theMap = {}
|
||||
self.orphRoot = None
|
||||
return
|
||||
|
||||
@@ -578,7 +587,14 @@ class GuiDocTree(QTreeWidget):
|
||||
newItem.setText(self.C_FLAGS, "")
|
||||
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
|
||||
if pHandle is None:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user