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

@ -71,6 +71,9 @@ class _CommandInspect:
strStructure = [] strStructure = []
if not hasattr(sel.Object,"Shape"): if not hasattr(sel.Object,"Shape"):
strStructure = ["<object has no shape!>"] strStructure = ["<object has no shape!>"]
else:
if sel.Object.Shape.isNull():
strStructure.append(unicode("<NULL SHAPE!>"))
else: else:
for (child, msg, it) in LCE.CompoundExplorer(sel.Object.Shape): for (child, msg, it) in LCE.CompoundExplorer(sel.Object.Shape):
#child is a shape. #child is a shape.
@ -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)