summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-16 16:10:45 (GMT)
committerGuido van Rossum <guido@python.org>1998-10-16 16:10:45 (GMT)
commit88d90070380fc8b40982e2c4e67cce45db875353 (patch)
tree65747f9be8af888099c9873e0ede43b392c9bd9c
parent95ef4982ed1fd6c7f193d8e806e9e62dee8098fb (diff)
downloadcpython-88d90070380fc8b40982e2c4e67cce45db875353.zip
cpython-88d90070380fc8b40982e2c4e67cce45db875353.tar.gz
cpython-88d90070380fc8b40982e2c4e67cce45db875353.tar.bz2
Rename classes to StackViewer (the widget) and StackBrowser (the toplevel).
-rw-r--r--Tools/idle/StackViewer.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/Tools/idle/StackViewer.py b/Tools/idle/StackViewer.py
index f3c6fec..878d5fc 100644
--- a/Tools/idle/StackViewer.py
+++ b/Tools/idle/StackViewer.py
@@ -8,9 +8,9 @@ from repr import Repr
from ScrolledList import ScrolledList
-class StackViewer:
+class StackBrowser:
- def __init__(self, root, flist):
+ def __init__(self, root, flist, stack=None):
self.top = top = Toplevel(root)
top.protocol("WM_DELETE_WINDOW", self.close)
top.wm_title("Stack viewer")
@@ -20,8 +20,10 @@ class StackViewer:
borderwidth=2, relief="groove")
self.helplabel.pack(fill="x")
#
- self.sv = StackViewer1(top, flist, self)
- self.sv.load_stack(get_stack())
+ self.sv = StackViewer(top, flist, self)
+ if stack is None:
+ stack = get_stack()
+ self.sv.load_stack(stack)
def close(self):
self.top.destroy()
@@ -89,14 +91,14 @@ class StackViewer:
self.localsframe.forget()
-class StackViewer1(ScrolledList):
+class StackViewer(ScrolledList):
def __init__(self, master, flist, browser):
ScrolledList.__init__(self, master)
self.flist = flist
self.browser = browser
- def load_stack(self, stack):
+ def load_stack(self, stack, index=None):
self.stack = stack
self.clear()
## if len(stack) > 10:
@@ -121,6 +123,8 @@ class StackViewer1(ScrolledList):
item = "%s.%s(), line %d: %s" % (modname, funcname,
lineno, sourceline)
self.append(item)
+ if index is not None:
+ self.select(index)
def fill_menu(self):
menu = self.menu