Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e9d7f077
Commit
e9d7f077
authored
May 12, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored, with some future plans in mind.
This now uses the new gotofileline() method defined in FileList.py.
parent
6cb7a219
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
Tools/idle/StackViewer.py
Tools/idle/StackViewer.py
+23
-11
No files found.
Tools/idle/StackViewer.py
View file @
e9d7f077
import
os
import
sys
import
string
from
Tkinter
import
*
import
linecache
from
TreeWidget
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
ObjectBrowser
import
ObjectTreeItem
,
make_objecttreeitem
from
OldStackViewer
import
StackViewer
,
NamespaceViewer
def
StackBrowser
(
root
,
flist
=
None
,
stack
=
None
):
top
=
Toplevel
(
root
)
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
)
item
=
StackTreeItem
(
flist
,
tb
)
node
=
TreeNode
(
sc
.
canvas
,
None
,
item
)
node
.
expand
()
class
StackTreeItem
(
TreeItem
):
def
__init__
(
self
,
flist
=
None
):
def
__init__
(
self
,
flist
=
None
,
tb
=
None
):
self
.
flist
=
flist
self
.
stack
=
get_stack
()
self
.
stack
=
get_stack
(
tb
)
self
.
text
=
get_exception
()
def
GetText
(
self
):
...
...
@@ -71,8 +74,8 @@ class FrameTreeItem(TreeItem):
if
self
.
flist
:
frame
,
lineno
=
self
.
info
filename
=
frame
.
f_code
.
co_filename
edit
=
self
.
flist
.
open
(
filename
)
edit
.
gotoline
(
lineno
)
if
os
.
path
.
isfile
(
filename
):
self
.
flist
.
gotofileline
(
filename
,
lineno
)
class
VariablesTreeItem
(
ObjectTreeItem
):
...
...
@@ -129,7 +132,16 @@ def get_exception(type=None, value=None):
s
=
s
+
": "
+
str
(
value
)
return
s
if
__name__
==
"__main__"
:
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
()
root
.
withdraw
()
StackBrowser
(
root
)
StackBrowser
(
None
,
top
=
root
)
root
.
mainloop
()
if
__name__
==
"__main__"
:
_test
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment