objgraphwidget: filter common primitive types out, change showBackrefs to have more useful output
This commit is contained in:
parent
dec908d20d
commit
53ab8b12bf
@ -6,7 +6,7 @@ import contextlib
|
|||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from PySide import QtGui
|
from PySide import QtGui, QtCore
|
||||||
import logging
|
import logging
|
||||||
from PySide.QtCore import Qt
|
from PySide.QtCore import Qt
|
||||||
import gc
|
import gc
|
||||||
@ -83,9 +83,13 @@ class ObjGraphWidget(QtGui.QWidget):
|
|||||||
icon = QtGui.QIcon.fromTheme("dialog-error")
|
icon = QtGui.QIcon.fromTheme("dialog-error")
|
||||||
self.imageView.setPixmap(icon.pixmap(64, 64))
|
self.imageView.setPixmap(icon.pixmap(64, 64))
|
||||||
|
|
||||||
|
def filterPrimitives(self, obj):
|
||||||
|
return not isinstance(obj, (str, unicode, int, float, QtCore.Signal)) and obj is not None
|
||||||
|
|
||||||
def showGarbage(self):
|
def showGarbage(self):
|
||||||
with self.showTempImage() as fn:
|
with self.showTempImage() as fn:
|
||||||
objgraph.show_refs(gc.garbage,
|
objgraph.show_refs(gc.garbage,
|
||||||
|
filter=self.filterPrimitives,
|
||||||
max_depth=self.depthLimitBox.value(),
|
max_depth=self.depthLimitBox.value(),
|
||||||
too_many=self.widthLimitBox.value(), filename=fn)
|
too_many=self.widthLimitBox.value(), filename=fn)
|
||||||
|
|
||||||
@ -93,6 +97,7 @@ class ObjGraphWidget(QtGui.QWidget):
|
|||||||
objType = str(self.inputWidget.text())
|
objType = str(self.inputWidget.text())
|
||||||
with self.showTempImage() as fn:
|
with self.showTempImage() as fn:
|
||||||
objgraph.show_refs(objgraph.by_type(objType),
|
objgraph.show_refs(objgraph.by_type(objType),
|
||||||
|
filter=self.filterPrimitives,
|
||||||
max_depth=self.depthLimitBox.value(),
|
max_depth=self.depthLimitBox.value(),
|
||||||
too_many=self.widthLimitBox.value(), filename=fn)
|
too_many=self.widthLimitBox.value(), filename=fn)
|
||||||
|
|
||||||
@ -102,11 +107,10 @@ class ObjGraphWidget(QtGui.QWidget):
|
|||||||
objects = objgraph.by_type(objType)
|
objects = objgraph.by_type(objType)
|
||||||
if len(objects) == 0:
|
if len(objects) == 0:
|
||||||
return
|
return
|
||||||
objgraph.show_chain(objgraph.find_backref_chain(objects[0],
|
objgraph.show_backrefs(objects[0],
|
||||||
objgraph.is_proper_module,
|
max_depth=self.depthLimitBox.value(),
|
||||||
max_depth=self.depthLimitBox.value(),
|
extra_ignore=(id(gc.garbage),id(objects)),
|
||||||
extra_ignore=(id(gc.garbage),)),
|
too_many=self.widthLimitBox.value(), filename=fn)
|
||||||
too_many=self.widthLimitBox.value(), filename=fn)
|
|
||||||
|
|
||||||
def showGraph(self):
|
def showGraph(self):
|
||||||
from mcedit2 import editorapp
|
from mcedit2 import editorapp
|
||||||
|
Reference in New Issue
Block a user