MCPcopy Create free account
hub / github.com/pyqtgraph/pyqtgraph / setStack

Method setStack

pyqtgraph/console/stackwidget.py:48–69  ·  view source on GitHub ↗

Display a call stack and exception traceback. This allows the user to probe the contents of any frame in the given stack. *frame* may either be a Frame instance or None, in which case the current frame is retrieved from ``sys._getframe()``. If *tb* is provided th

(self, frame=None, expand=True, lastFrame=None)

Source from the content-addressed store, hash-verified

46 items[0].setExpanded(True)
47
48 def setStack(self, frame=None, expand=True, lastFrame=None):
49 """Display a call stack and exception traceback.
50
51 This allows the user to probe the contents of any frame in the given stack.
52
53 *frame* may either be a Frame instance or None, in which case the current
54 frame is retrieved from ``sys._getframe()``.
55
56 If *tb* is provided then the frames in the traceback will be appended to
57 the end of the stack list. If *tb* is None, then sys.exc_info() will
58 be checked instead.
59 """
60 if frame is None:
61 frame = sys._getframe().f_back
62
63 self.clear()
64
65 stack = stackFromFrame(frame, lastFrame=lastFrame)
66 items = makeItemTree(stack, "Call stack")
67 self.addTopLevelItem(items[0])
68 if expand:
69 items[0].setExpanded(True)
70
71
72def stackFromFrame(frame, lastFrame=None):

Callers

nothing calls this directly

Calls 5

clearMethod · 0.95
stackFromFrameFunction · 0.85
makeItemTreeFunction · 0.85
addTopLevelItemMethod · 0.80
setExpandedMethod · 0.80

Tested by

no test coverage detected