Split the include in build flag into its own column in the project tree, and updated etails pane accordingly
This commit is contained in:
@@ -29,7 +29,7 @@ import logging
|
|||||||
import nw
|
import nw
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import QFont
|
from PyQt5.QtGui import QFont, QIcon, QPixmap
|
||||||
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel
|
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel
|
||||||
|
|
||||||
from nw.constants import (
|
from nw.constants import (
|
||||||
@@ -47,30 +47,37 @@ class GuiDocDetails(QFrame):
|
|||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theProject
|
||||||
|
self.theTheme = theParent.theTheme
|
||||||
|
|
||||||
self.mainBox = QGridLayout(self)
|
self.mainBox = QGridLayout(self)
|
||||||
self.mainBox.setVerticalSpacing(1)
|
self.mainBox.setVerticalSpacing(1)
|
||||||
self.mainBox.setHorizontalSpacing(6)
|
self.mainBox.setHorizontalSpacing(6)
|
||||||
self.setLayout(self.mainBox)
|
self.setLayout(self.mainBox)
|
||||||
|
|
||||||
|
self.pS = 0.9*self.theTheme.fontPointSize
|
||||||
|
self.iS = self.theTheme.textIconSize
|
||||||
|
|
||||||
|
self.expCheck = self.theTheme.getPixmap("check", (self.iS, self.iS))
|
||||||
|
self.expCross = self.theTheme.getPixmap("cross", (self.iS, self.iS))
|
||||||
|
|
||||||
self.fntLabel = QFont()
|
self.fntLabel = QFont()
|
||||||
self.fntLabel.setPointSize(10)
|
self.fntLabel.setPointSize(10)
|
||||||
self.fntLabel.setBold(True)
|
self.fntLabel.setPointSizeF(self.pS)
|
||||||
|
|
||||||
self.fntFixed = QFont()
|
self.fntFixed = QFont()
|
||||||
self.fntFixed.setFamily("Monospace")
|
self.fntFixed.setFamily("Monospace")
|
||||||
self.fntFixed.setPointSize(10)
|
self.fntFixed.setPointSizeF(self.pS)
|
||||||
|
|
||||||
self.fntValue = QFont()
|
self.fntValue = QFont()
|
||||||
self.fntValue.setPointSize(10)
|
self.fntValue.setPointSizeF(self.pS)
|
||||||
|
|
||||||
# Label
|
# Label
|
||||||
self.labelName = QLabel("Label ")
|
self.labelName = QLabel("Label")
|
||||||
self.labelName.setFont(self.fntLabel)
|
self.labelName.setFont(self.fntLabel)
|
||||||
self.labelName.setAlignment(Qt.AlignLeft | Qt.AlignBaseline)
|
self.labelName.setAlignment(Qt.AlignLeft | Qt.AlignBaseline)
|
||||||
|
|
||||||
self.labelFlag = QLabel("")
|
self.labelFlag = QLabel("")
|
||||||
self.labelFlag.setFont(self.fntFixed)
|
# self.labelFlag.setFont(self.fntFixed)
|
||||||
self.labelFlag.setAlignment(Qt.AlignRight | Qt.AlignBaseline)
|
self.labelFlag.setAlignment(Qt.AlignRight | Qt.AlignBaseline)
|
||||||
|
|
||||||
self.labelData = QLabel("")
|
self.labelData = QLabel("")
|
||||||
@@ -79,12 +86,11 @@ class GuiDocDetails(QFrame):
|
|||||||
self.labelData.setWordWrap(True)
|
self.labelData.setWordWrap(True)
|
||||||
|
|
||||||
# Status
|
# Status
|
||||||
self.statusName = QLabel("Status ")
|
self.statusName = QLabel("Status")
|
||||||
self.statusName.setFont(self.fntLabel)
|
self.statusName.setFont(self.fntLabel)
|
||||||
self.statusName.setAlignment(Qt.AlignLeft)
|
self.statusName.setAlignment(Qt.AlignLeft)
|
||||||
|
|
||||||
self.statusFlag = QLabel("")
|
self.statusFlag = QLabel("")
|
||||||
self.statusFlag.setFont(self.fntFixed)
|
|
||||||
self.statusFlag.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
|
self.statusFlag.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
|
||||||
|
|
||||||
self.statusData = QLabel("")
|
self.statusData = QLabel("")
|
||||||
@@ -92,7 +98,7 @@ class GuiDocDetails(QFrame):
|
|||||||
self.statusData.setAlignment(Qt.AlignLeft)
|
self.statusData.setAlignment(Qt.AlignLeft)
|
||||||
|
|
||||||
# Class
|
# Class
|
||||||
self.className = QLabel("Class ")
|
self.className = QLabel("Class")
|
||||||
self.className.setFont(self.fntLabel)
|
self.className.setFont(self.fntLabel)
|
||||||
self.className.setAlignment(Qt.AlignLeft)
|
self.className.setAlignment(Qt.AlignLeft)
|
||||||
|
|
||||||
@@ -105,7 +111,7 @@ class GuiDocDetails(QFrame):
|
|||||||
self.classData.setAlignment(Qt.AlignLeft)
|
self.classData.setAlignment(Qt.AlignLeft)
|
||||||
|
|
||||||
# Layout
|
# Layout
|
||||||
self.layoutName = QLabel("Layout ")
|
self.layoutName = QLabel("Layout")
|
||||||
self.layoutName.setFont(self.fntLabel)
|
self.layoutName.setFont(self.fntLabel)
|
||||||
self.layoutName.setAlignment(Qt.AlignLeft)
|
self.layoutName.setAlignment(Qt.AlignLeft)
|
||||||
|
|
||||||
@@ -172,6 +178,7 @@ class GuiDocDetails(QFrame):
|
|||||||
self.mainBox.setColumnStretch(2,1)
|
self.mainBox.setColumnStretch(2,1)
|
||||||
self.mainBox.setColumnStretch(3,0)
|
self.mainBox.setColumnStretch(3,0)
|
||||||
self.mainBox.setColumnStretch(4,0)
|
self.mainBox.setColumnStretch(4,0)
|
||||||
|
self.mainBox.setColumnMinimumWidth(1, 20)
|
||||||
|
|
||||||
logger.debug("DocDetails initialisation complete")
|
logger.debug("DocDetails initialisation complete")
|
||||||
|
|
||||||
@@ -214,14 +221,12 @@ class GuiDocDetails(QFrame):
|
|||||||
|
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
if nwItem.isExported:
|
if nwItem.isExported:
|
||||||
exportFlag = nwUnicode.U_CHECK
|
self.labelFlag.setPixmap(self.expCheck)
|
||||||
else:
|
else:
|
||||||
exportFlag = " "
|
self.labelFlag.setPixmap(self.expCross)
|
||||||
else:
|
else:
|
||||||
exportFlag = "-"
|
self.labelFlag.setPixmap(QPixmap(1,1))
|
||||||
|
self.statusFlag.setPixmap(flagIcon.pixmap(0.9*self.iS, 0.9*self.iS))
|
||||||
self.labelFlag.setText(exportFlag)
|
|
||||||
self.statusFlag.setPixmap(flagIcon.pixmap(10, 10))
|
|
||||||
self.classFlag.setText(nwLabels.CLASS_FLAG[nwItem.itemClass])
|
self.classFlag.setText(nwLabels.CLASS_FLAG[nwItem.itemClass])
|
||||||
if nwItem.itemLayout == nwItemLayout.NO_LAYOUT:
|
if nwItem.itemLayout == nwItemLayout.NO_LAYOUT:
|
||||||
self.layoutFlag.setText("-")
|
self.layoutFlag.setText("-")
|
||||||
|
|||||||
+35
-24
@@ -29,7 +29,7 @@ import logging
|
|||||||
import nw
|
import nw
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QSize
|
from PyQt5.QtCore import Qt, QSize
|
||||||
from PyQt5.QtGui import QFont, QColor
|
from PyQt5.QtGui import QFont, QColor, QIcon
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
qApp, QTreeWidget, QTreeWidgetItem, QAbstractItemView, QMessageBox
|
qApp, QTreeWidget, QTreeWidgetItem, QAbstractItemView, QMessageBox
|
||||||
)
|
)
|
||||||
@@ -45,8 +45,9 @@ class GuiDocTree(QTreeWidget):
|
|||||||
|
|
||||||
C_NAME = 0
|
C_NAME = 0
|
||||||
C_COUNT = 1
|
C_COUNT = 1
|
||||||
C_FLAGS = 2
|
C_EXPORT = 2
|
||||||
C_HANDLE = 3
|
C_FLAGS = 3
|
||||||
|
C_HANDLE = 4
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent, theProject):
|
||||||
QTreeWidget.__init__(self, theParent)
|
QTreeWidget.__init__(self, theParent)
|
||||||
@@ -64,15 +65,19 @@ class GuiDocTree(QTreeWidget):
|
|||||||
self.clearTree()
|
self.clearTree()
|
||||||
|
|
||||||
# Build GUI
|
# Build GUI
|
||||||
self.setIconSize(QSize(13,13))
|
self.setIconSize(QSize(13, 13))
|
||||||
self.setExpandsOnDoubleClick(True)
|
self.setExpandsOnDoubleClick(True)
|
||||||
self.setIndentation(13)
|
self.setIndentation(13)
|
||||||
self.setColumnCount(4)
|
self.setColumnCount(5)
|
||||||
self.setHeaderLabels(["Label","Words","Flags","Handle"])
|
self.setHeaderLabels(["Label","Words","Inc","Flags","Handle"])
|
||||||
self.hideColumn(self.C_HANDLE)
|
self.hideColumn(self.C_HANDLE)
|
||||||
|
|
||||||
treeHead = self.headerItem()
|
treeHead = self.headerItem()
|
||||||
treeHead.setTextAlignment(self.C_COUNT,Qt.AlignRight)
|
treeHead.setTextAlignment(self.C_COUNT, Qt.AlignRight)
|
||||||
|
treeHead.setToolTip(self.C_NAME, "Item label")
|
||||||
|
treeHead.setToolTip(self.C_COUNT, "Word count")
|
||||||
|
treeHead.setToolTip(self.C_EXPORT, "Include in build")
|
||||||
|
treeHead.setToolTip(self.C_FLAGS, "Status, class, and layout flags")
|
||||||
|
|
||||||
# Allow Move by Drag & Drop
|
# Allow Move by Drag & Drop
|
||||||
self.setDragEnabled(True)
|
self.setDragEnabled(True)
|
||||||
@@ -88,10 +93,14 @@ class GuiDocTree(QTreeWidget):
|
|||||||
# self.setSelectionBehavior(QAbstractItemView.SelectRows)
|
# self.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||||
|
|
||||||
for colN in range(len(self.mainConf.treeColWidth)):
|
for colN in range(len(self.mainConf.treeColWidth)):
|
||||||
self.setColumnWidth(colN,self.mainConf.treeColWidth[colN])
|
self.setColumnWidth(colN, self.mainConf.treeColWidth[colN])
|
||||||
|
|
||||||
self.fontFlags = QFont("Monospace",10)
|
self.resizeColumnToContents(self.C_EXPORT)
|
||||||
self.fontCount = QFont("Monospace",10)
|
self.resizeColumnToContents(self.C_FLAGS)
|
||||||
|
|
||||||
|
self.fntFixed = QFont()
|
||||||
|
self.fntFixed.setFamily("Monospace")
|
||||||
|
self.fntFixed.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||||
|
|
||||||
logger.debug("DocTree initialisation complete")
|
logger.debug("DocTree initialisation complete")
|
||||||
|
|
||||||
@@ -271,7 +280,6 @@ class GuiDocTree(QTreeWidget):
|
|||||||
retVals = [
|
retVals = [
|
||||||
self.columnWidth(0),
|
self.columnWidth(0),
|
||||||
self.columnWidth(1),
|
self.columnWidth(1),
|
||||||
self.columnWidth(2),
|
|
||||||
]
|
]
|
||||||
return retVals
|
return retVals
|
||||||
|
|
||||||
@@ -422,30 +430,30 @@ class GuiDocTree(QTreeWidget):
|
|||||||
tHandle = nwItem.itemHandle
|
tHandle = nwItem.itemHandle
|
||||||
pHandle = nwItem.parHandle
|
pHandle = nwItem.parHandle
|
||||||
|
|
||||||
stExport = " "
|
expIcon = QIcon()
|
||||||
stClass = nwLabels.CLASS_FLAG[nwItem.itemClass]
|
|
||||||
stLayout = ""
|
|
||||||
|
|
||||||
|
stClass = nwLabels.CLASS_FLAG[nwItem.itemClass]
|
||||||
|
stLayout = ""
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
stLayout = "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
|
stLayout = "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
|
||||||
if nwItem.isExported:
|
if nwItem.isExported:
|
||||||
stExport = nwUnicode.U_CHECK
|
expIcon = self.theTheme.getIcon("check")
|
||||||
else:
|
else:
|
||||||
stExport = "-"
|
expIcon = self.theTheme.getIcon("cross")
|
||||||
|
tStatus = stClass+stLayout
|
||||||
tStatus = stExport+" "+stClass+stLayout
|
|
||||||
|
|
||||||
iStatus = nwItem.itemStatus
|
iStatus = nwItem.itemStatus
|
||||||
if tClass == nwItemClass.NOVEL:
|
if tClass == nwItemClass.NOVEL:
|
||||||
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's valid
|
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's valid
|
||||||
flagIcon = self.theParent.statusIcons[iStatus]
|
flagIcon = self.theParent.statusIcons[iStatus]
|
||||||
else:
|
else:
|
||||||
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's valid
|
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's valid
|
||||||
flagIcon = self.theParent.importIcons[iStatus]
|
flagIcon = self.theParent.importIcons[iStatus]
|
||||||
|
|
||||||
trItem.setText(self.C_NAME, tName)
|
trItem.setText(self.C_NAME, tName)
|
||||||
trItem.setText(self.C_FLAGS,tStatus)
|
trItem.setIcon(self.C_EXPORT, expIcon)
|
||||||
trItem.setIcon(self.C_FLAGS,flagIcon)
|
trItem.setText(self.C_FLAGS, tStatus)
|
||||||
|
trItem.setIcon(self.C_FLAGS, flagIcon)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -569,12 +577,14 @@ class GuiDocTree(QTreeWidget):
|
|||||||
|
|
||||||
newItem.setText(self.C_NAME, "")
|
newItem.setText(self.C_NAME, "")
|
||||||
newItem.setText(self.C_COUNT, "0")
|
newItem.setText(self.C_COUNT, "0")
|
||||||
|
newItem.setText(self.C_EXPORT, "")
|
||||||
newItem.setText(self.C_FLAGS, "")
|
newItem.setText(self.C_FLAGS, "")
|
||||||
newItem.setText(self.C_HANDLE, tHandle)
|
newItem.setText(self.C_HANDLE, tHandle)
|
||||||
|
|
||||||
# newItem.setForeground(self.C_COUNT,QColor(*self.theParent.theTheme.treeWCount))
|
# newItem.setForeground(self.C_COUNT,QColor(*self.theParent.theTheme.treeWCount))
|
||||||
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight)
|
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight)
|
||||||
newItem.setFont(self.C_FLAGS, self.fontFlags)
|
# newItem.setTextAlignment(self.C_EXPORT, Qt.AlignHCenter)
|
||||||
|
newItem.setFont(self.C_FLAGS, self.fntFixed)
|
||||||
|
|
||||||
self.theMap[tHandle] = newItem
|
self.theMap[tHandle] = newItem
|
||||||
if pHandle is None:
|
if pHandle is None:
|
||||||
@@ -627,6 +637,7 @@ class GuiDocTree(QTreeWidget):
|
|||||||
newItem = QTreeWidgetItem([""]*4)
|
newItem = QTreeWidgetItem([""]*4)
|
||||||
newItem.setText(self.C_NAME, "Orphaned Files")
|
newItem.setText(self.C_NAME, "Orphaned Files")
|
||||||
newItem.setText(self.C_COUNT, "")
|
newItem.setText(self.C_COUNT, "")
|
||||||
|
newItem.setText(self.C_EXPORT, "")
|
||||||
newItem.setText(self.C_FLAGS, "")
|
newItem.setText(self.C_FLAGS, "")
|
||||||
newItem.setText(self.C_HANDLE, "")
|
newItem.setText(self.C_HANDLE, "")
|
||||||
self.addTopLevelItem(newItem)
|
self.addTopLevelItem(newItem)
|
||||||
|
|||||||
Reference in New Issue
Block a user