[Idle-dev] CVS: idle StackViewer.py,1.3,1.4
Kurt B. Kaiser
kbk@users.sourceforge.net
Fri, 13 Jul 2001 22:15:31 -0700
Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv7142
Modified Files:
StackViewer.py
Log Message:
py-cvs-2001_07_13 (Rev 1.16) merge
"Refactored, with some future plans in mind. This now uses the new
gotofileline() method defined in FileList.py" --GvR
Index: StackViewer.py
===================================================================
RCS file: /cvsroot/idlefork/idle/StackViewer.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** StackViewer.py 2001/07/14 01:16:56 1.3
--- StackViewer.py 2001/07/14 05:15:29 1.4
***************
*** 1,4 ****
import string
- from Tkinter import *
import linecache
--- 1,5 ----
+ import os
+ import sys
import string
import linecache
***************
*** 7,15 ****
from OldStackViewer import StackViewer, NamespaceViewer
! def StackBrowser(root, flist=None, stack=None):
! top = Toplevel(root)
sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
sc.frame.pack(expand=1, fill="both")
! item = StackTreeItem(flist)
node = TreeNode(sc.canvas, None, item)
node.expand()
--- 8,18 ----
from OldStackViewer import StackViewer, NamespaceViewer
! def StackBrowser(root, flist=None, tb=None, top=None):
! if top is None:
! from Tkinter import Toplevel
! top = Toplevel(root)
sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
sc.frame.pack(expand=1, fill="both")
! item = StackTreeItem(flist, tb)
node = TreeNode(sc.canvas, None, item)
node.expand()
***************
*** 17,23 ****
class StackTreeItem(TreeItem):
! def __init__(self, flist=None):
self.flist = flist
! self.stack = get_stack()
self.text = get_exception()
--- 20,26 ----
class StackTreeItem(TreeItem):
! def __init__(self, flist=None, tb=None):
self.flist = flist
! self.stack = get_stack(tb)
self.text = get_exception()
***************
*** 72,77 ****
frame, lineno = self.info
filename = frame.f_code.co_filename
! edit = self.flist.open(filename)
! edit.gotoline(lineno)
class VariablesTreeItem(ObjectTreeItem):
--- 75,80 ----
frame, lineno = self.info
filename = frame.f_code.co_filename
! if os.path.isfile(filename):
! self.flist.gotofileline(filename, lineno)
class VariablesTreeItem(ObjectTreeItem):
***************
*** 130,135 ****
return s
! if __name__ == "__main__":
root = Tk()
! root.withdraw()
! StackBrowser(root)
--- 133,147 ----
return s
! def _test():
! try:
! import testcode
! reload(testcode)
! except:
! sys.last_type, sys.last_value, sys.last_traceback = sys.exc_info()
! from Tkinter import Tk
root = Tk()
! StackBrowser(None, top=root)
! root.mainloop()
!
! if __name__ == "__main__":
! _test()