Stop lookup error on none in project tree meta panel
This commit is contained in:
+41
-38
@@ -227,55 +227,58 @@ class GuiItemDetails(QWidget):
|
|||||||
def updateViewBox(self, tHandle):
|
def updateViewBox(self, tHandle):
|
||||||
"""Populate the details box from a given handle.
|
"""Populate the details box from a given handle.
|
||||||
"""
|
"""
|
||||||
self.theHandle = tHandle
|
if tHandle is None:
|
||||||
nwItem = self.theProject.projTree[tHandle]
|
self.clearDetails()
|
||||||
|
return
|
||||||
|
|
||||||
|
nwItem = self.theProject.projTree[tHandle]
|
||||||
if nwItem is None:
|
if nwItem is None:
|
||||||
self.clearDetails()
|
self.clearDetails()
|
||||||
|
return
|
||||||
|
|
||||||
|
self.theHandle = tHandle
|
||||||
|
theLabel = nwItem.itemName
|
||||||
|
if len(theLabel) > 100:
|
||||||
|
theLabel = theLabel[:96].rstrip()+" ..."
|
||||||
|
|
||||||
|
itStatus = nwItem.itemStatus
|
||||||
|
if nwItem.itemClass == nwItemClass.NOVEL:
|
||||||
|
itStatus = self.theProject.statusItems.checkEntry(itStatus) # Make sure it's valid
|
||||||
|
flagIcon = self.theParent.statusIcons[itStatus]
|
||||||
else:
|
else:
|
||||||
theLabel = nwItem.itemName
|
itStatus = self.theProject.importItems.checkEntry(itStatus) # Make sure it's valid
|
||||||
if len(theLabel) > 100:
|
flagIcon = self.theParent.importIcons[itStatus]
|
||||||
theLabel = theLabel[:96].rstrip()+" ..."
|
|
||||||
|
|
||||||
itStatus = nwItem.itemStatus
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
if nwItem.itemClass == nwItemClass.NOVEL:
|
if nwItem.isExported:
|
||||||
itStatus = self.theProject.statusItems.checkEntry(itStatus) # Make sure it's valid
|
self.labelFlag.setPixmap(self.expCheck)
|
||||||
flagIcon = self.theParent.statusIcons[itStatus]
|
|
||||||
else:
|
else:
|
||||||
itStatus = self.theProject.importItems.checkEntry(itStatus) # Make sure it's valid
|
self.labelFlag.setPixmap(self.expCross)
|
||||||
flagIcon = self.theParent.importIcons[itStatus]
|
else:
|
||||||
|
self.labelFlag.setPixmap(QPixmap(1, 1))
|
||||||
|
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
iPx = int(round(0.8*self.theTheme.baseIconSize))
|
||||||
if nwItem.isExported:
|
self.statusFlag.setPixmap(flagIcon.pixmap(iPx, iPx))
|
||||||
self.labelFlag.setPixmap(self.expCheck)
|
self.classFlag.setText(nwLabels.CLASS_FLAG[nwItem.itemClass])
|
||||||
else:
|
|
||||||
self.labelFlag.setPixmap(self.expCross)
|
|
||||||
else:
|
|
||||||
self.labelFlag.setPixmap(QPixmap(1, 1))
|
|
||||||
|
|
||||||
iPx = int(round(0.8*self.theTheme.baseIconSize))
|
if nwItem.itemLayout == nwItemLayout.NO_LAYOUT:
|
||||||
self.statusFlag.setPixmap(flagIcon.pixmap(iPx, iPx))
|
self.layoutFlag.setText("-")
|
||||||
self.classFlag.setText(nwLabels.CLASS_FLAG[nwItem.itemClass])
|
else:
|
||||||
|
self.layoutFlag.setText(nwLabels.LAYOUT_FLAG[nwItem.itemLayout])
|
||||||
|
|
||||||
if nwItem.itemLayout == nwItemLayout.NO_LAYOUT:
|
self.labelData.setText(theLabel)
|
||||||
self.layoutFlag.setText("-")
|
self.statusData.setText(nwItem.itemStatus)
|
||||||
else:
|
self.classData.setText(nwLabels.CLASS_NAME[nwItem.itemClass])
|
||||||
self.layoutFlag.setText(nwLabels.LAYOUT_FLAG[nwItem.itemLayout])
|
self.layoutData.setText(nwLabels.LAYOUT_NAME[nwItem.itemLayout])
|
||||||
|
|
||||||
self.labelData.setText(theLabel)
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
self.statusData.setText(nwItem.itemStatus)
|
self.cCountData.setText(f"{nwItem.charCount:n}")
|
||||||
self.classData.setText(nwLabels.CLASS_NAME[nwItem.itemClass])
|
self.wCountData.setText(f"{nwItem.wordCount:n}")
|
||||||
self.layoutData.setText(nwLabels.LAYOUT_NAME[nwItem.itemLayout])
|
self.pCountData.setText(f"{nwItem.paraCount:n}")
|
||||||
|
else:
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
self.cCountData.setText("–")
|
||||||
self.cCountData.setText(f"{nwItem.charCount:n}")
|
self.wCountData.setText("–")
|
||||||
self.wCountData.setText(f"{nwItem.wordCount:n}")
|
self.pCountData.setText("–")
|
||||||
self.pCountData.setText(f"{nwItem.paraCount:n}")
|
|
||||||
else:
|
|
||||||
self.cCountData.setText("–")
|
|
||||||
self.wCountData.setText("–")
|
|
||||||
self.pCountData.setText("–")
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user