Inspect: fix null shapes; limit number of lines displayed

This commit is contained in:
DeepSOIC 2016-08-22 00:25:29 +03:00
parent 04f5d9d64c
commit ea3e24a327

View File

@ -72,21 +72,24 @@ class _CommandInspect:
if not hasattr(sel.Object,"Shape"): if not hasattr(sel.Object,"Shape"):
strStructure = ["<object has no shape!>"] strStructure = ["<object has no shape!>"]
else: else:
for (child, msg, it) in LCE.CompoundExplorer(sel.Object.Shape): if sel.Object.Shape.isNull():
#child is a shape. strStructure.append(unicode("<NULL SHAPE!>"))
#msg is int equal to one of three constants: else:
# CompoundExplorer.MSG_LEAF - child is a leaf (non-compound) for (child, msg, it) in LCE.CompoundExplorer(sel.Object.Shape):
# CompoundExplorer.MSG_DIVEDOWN - child is a compound that is about to be traversed #child is a shape.
# CompoundExplorer.MSG_BUBBLEUP - child is a compound that was just finished traversing #msg is int equal to one of three constants:
#it is reference to iterator class (can be useful to extract current depth, or index stack) # CompoundExplorer.MSG_LEAF - child is a leaf (non-compound)
if msg == LCE.CompoundExplorer.MSG_LEAF or msg == LCE.CompoundExplorer.MSG_DIVEDOWN: # CompoundExplorer.MSG_DIVEDOWN - child is a compound that is about to be traversed
try: # CompoundExplorer.MSG_BUBBLEUP - child is a compound that was just finished traversing
strMsg = ' ' * it.curDepth() + shapeInfoString(child) #it is reference to iterator class (can be useful to extract current depth, or index stack)
if msg == LCE.CompoundExplorer.MSG_DIVEDOWN: if msg == LCE.CompoundExplorer.MSG_LEAF or msg == LCE.CompoundExplorer.MSG_DIVEDOWN:
strMsg += ":" try:
except Exception as err: strMsg = ' ' * it.curDepth() + shapeInfoString(child)
strMsg = "ERROR: " + err.message if msg == LCE.CompoundExplorer.MSG_DIVEDOWN:
strStructure.append(unicode(strMsg)) strMsg += ":"
except Exception as err:
strMsg = "ERROR: " + err.message
strStructure.append(unicode(strMsg))
strSubInfo = [] strSubInfo = []
if sel.HasSubObjects: if sel.HasSubObjects:
@ -115,7 +118,11 @@ class _CommandInspect:
allText += u'\n'.join(strStructure) allText += u'\n'.join(strStructure)
mb = QtGui.QMessageBox() mb = QtGui.QMessageBox()
mb.setIcon(mb.Icon.Information) mb.setIcon(mb.Icon.Information)
mb.setText(allText) lines = allText.split(u"\n")
if len(lines)>30:
lines = lines[0:30]
lines.append(u"...")
mb.setText(u"\n".join(lines))
mb.setWindowTitle(translate("Lattice2_Inspect","Selection info", None)) mb.setWindowTitle(translate("Lattice2_Inspect","Selection info", None))
btnClose = mb.addButton(QtGui.QMessageBox.StandardButton.Close) btnClose = mb.addButton(QtGui.QMessageBox.StandardButton.Close)