def toolTip(self, index):
if index.column() > 0:
return self.data(index)
obj = self.itemData()
if hasattr(obj, "exc_info") and obj.exc_info is not None:
html_orig = '<html><head><style type="text/css">{style}' \
'</style></head><body>'
formatter, style = None, ""
if pygments is not None:
formatter = HtmlFormatter()
style = formatter.get_style_defs()
txt = html_orig.format(style=style)
if formatter is None:
txt += "<pre>%s</pre>" % obj.exc_info
else:
txt += highlight(obj.exc_info, PythonTracebackLexer(),
formatter)
txt += "</body></html>"
else:
txt = "{0} {1}".format(getElementTypeToolTip(obj.type), obj.name)
return txt
评论列表
文章目录