Mercurial > cpython-lru_cache-weakref
annotate Lib/idlelib/Debugger.py @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | eab361617f6a |
| children |
| rev | line source |
|---|---|
| 13975 | 1 import os |
| 2 import bdb | |
| 23547 | 3 import types |
|
47183
b53604fad54b
Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents:
47101
diff
changeset
|
4 from Tkinter import * |
|
60144
eab361617f6a
#7092: Fix additional "-3" warnings in the idlelib package, and convert to absolute imports.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
47221
diff
changeset
|
5 from idlelib.WindowList import ListedToplevel |
|
eab361617f6a
#7092: Fix additional "-3" warnings in the idlelib package, and convert to absolute imports.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
47221
diff
changeset
|
6 from idlelib.ScrolledList import ScrolledList |
|
eab361617f6a
#7092: Fix additional "-3" warnings in the idlelib package, and convert to absolute imports.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
47221
diff
changeset
|
7 from idlelib import macosxSupport |
| 13975 | 8 |
| 9 | |
| 23547 | 10 class Idb(bdb.Bdb): |
| 11 | |
| 12 def __init__(self, gui): | |
| 13 self.gui = gui | |
| 14 bdb.Bdb.__init__(self) | |
| 15 | |
| 16 def user_line(self, frame): | |
|
29059
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
17 if self.in_rpc_code(frame): |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
18 self.set_step() |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
19 return |
| 23547 | 20 message = self.__frame2message(frame) |
| 21 self.gui.interaction(message, frame) | |
| 22 | |
| 23 def user_exception(self, frame, info): | |
|
29059
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
24 if self.in_rpc_code(frame): |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
25 self.set_step() |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
26 return |
| 23547 | 27 message = self.__frame2message(frame) |
| 28 self.gui.interaction(message, frame, info) | |
| 29 | |
|
29059
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
30 def in_rpc_code(self, frame): |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
31 if frame.f_code.co_filename.count('rpc.py'): |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
32 return True |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
33 else: |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
34 prev_frame = frame.f_back |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
35 if prev_frame.f_code.co_filename.count('Debugger.py'): |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
36 # (that test will catch both Debugger.py and RemoteDebugger.py) |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
37 return False |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
38 return self.in_rpc_code(prev_frame) |
|
92ebd3daf507
1. Update debugger to not trace RPC code even when calling Queue and
Kurt B. Kaiser <kbk@shore.net>
parents:
26992
diff
changeset
|
39 |
| 23547 | 40 def __frame2message(self, frame): |
| 41 code = frame.f_code | |
| 42 filename = code.co_filename | |
| 43 lineno = frame.f_lineno | |
| 44 basename = os.path.basename(filename) | |
| 45 message = "%s:%s" % (basename, lineno) | |
| 46 if code.co_name != "?": | |
| 47 message = "%s: %s()" % (message, code.co_name) | |
| 48 return message | |
| 49 | |
| 50 | |
| 51 class Debugger: | |
| 13975 | 52 |
| 53 vstack = vsource = vlocals = vglobals = None | |
| 54 | |
| 23547 | 55 def __init__(self, pyshell, idb=None): |
| 56 if idb is None: | |
| 57 idb = Idb(self) | |
| 13975 | 58 self.pyshell = pyshell |
| 23547 | 59 self.idb = idb |
|
23876
832f0501148b
Polish RemoteDebugger code.
Kurt B. Kaiser <kbk@shore.net>
parents:
23547
diff
changeset
|
60 self.frame = None |
| 13975 | 61 self.make_gui() |
|
23876
832f0501148b
Polish RemoteDebugger code.
Kurt B. Kaiser <kbk@shore.net>
parents:
23547
diff
changeset
|
62 self.interacting = 0 |
| 26959 | 63 |
| 23547 | 64 def run(self, *args): |
| 65 try: | |
| 66 self.interacting = 1 | |
| 67 return self.idb.run(*args) | |
| 68 finally: | |
| 69 self.interacting = 0 | |
| 13975 | 70 |
| 71 def close(self, event=None): | |
| 72 if self.interacting: | |
| 73 self.top.bell() | |
| 74 return | |
| 75 if self.stackviewer: | |
| 76 self.stackviewer.close(); self.stackviewer = None | |
|
23974
c69dc43b700a
Remove all EditorWindow BREAK tags when closing Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
23969
diff
changeset
|
77 # Clean up pyshell if user clicked debugger control close widget. |
|
c69dc43b700a
Remove all EditorWindow BREAK tags when closing Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
23969
diff
changeset
|
78 # (Causes a harmless extra cycle through close_debugger() if user |
|
c69dc43b700a
Remove all EditorWindow BREAK tags when closing Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
23969
diff
changeset
|
79 # toggled debugger from pyshell Debug menu) |
| 13975 | 80 self.pyshell.close_debugger() |
|
23974
c69dc43b700a
Remove all EditorWindow BREAK tags when closing Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
23969
diff
changeset
|
81 # Now close the debugger control window.... |
| 13975 | 82 self.top.destroy() |
| 83 | |
| 84 def make_gui(self): | |
| 85 pyshell = self.pyshell | |
| 86 self.flist = pyshell.flist | |
| 87 self.root = root = pyshell.root | |
|
33218
066c7890cd61
1. If user passes a non-existant filename on the commandline, just open
Kurt B. Kaiser <kbk@shore.net>
parents:
29059
diff
changeset
|
88 self.top = top = ListedToplevel(root) |
| 13975 | 89 self.top.wm_title("Debug Control") |
| 90 self.top.wm_iconname("Debug") | |
| 91 top.wm_protocol("WM_DELETE_WINDOW", self.close) | |
| 92 self.top.bind("<Escape>", self.close) | |
| 93 # | |
| 94 self.bframe = bframe = Frame(top) | |
| 95 self.bframe.pack(anchor="w") | |
| 96 self.buttons = bl = [] | |
| 97 # | |
| 98 self.bcont = b = Button(bframe, text="Go", command=self.cont) | |
| 99 bl.append(b) | |
| 100 self.bstep = b = Button(bframe, text="Step", command=self.step) | |
| 101 bl.append(b) | |
| 102 self.bnext = b = Button(bframe, text="Over", command=self.next) | |
| 103 bl.append(b) | |
| 104 self.bret = b = Button(bframe, text="Out", command=self.ret) | |
| 105 bl.append(b) | |
| 106 self.bret = b = Button(bframe, text="Quit", command=self.quit) | |
| 107 bl.append(b) | |
| 108 # | |
| 109 for b in bl: | |
| 110 b.configure(state="disabled") | |
| 111 b.pack(side="left") | |
| 112 # | |
| 113 self.cframe = cframe = Frame(bframe) | |
| 114 self.cframe.pack(side="left") | |
| 115 # | |
| 116 if not self.vstack: | |
| 117 self.__class__.vstack = BooleanVar(top) | |
| 118 self.vstack.set(1) | |
| 119 self.bstack = Checkbutton(cframe, | |
| 120 text="Stack", command=self.show_stack, variable=self.vstack) | |
| 121 self.bstack.grid(row=0, column=0) | |
| 122 if not self.vsource: | |
| 123 self.__class__.vsource = BooleanVar(top) | |
| 124 self.bsource = Checkbutton(cframe, | |
| 125 text="Source", command=self.show_source, variable=self.vsource) | |
| 126 self.bsource.grid(row=0, column=1) | |
| 127 if not self.vlocals: | |
| 128 self.__class__.vlocals = BooleanVar(top) | |
| 129 self.vlocals.set(1) | |
| 130 self.blocals = Checkbutton(cframe, | |
| 131 text="Locals", command=self.show_locals, variable=self.vlocals) | |
| 132 self.blocals.grid(row=1, column=0) | |
| 133 if not self.vglobals: | |
| 134 self.__class__.vglobals = BooleanVar(top) | |
| 135 self.bglobals = Checkbutton(cframe, | |
| 136 text="Globals", command=self.show_globals, variable=self.vglobals) | |
| 137 self.bglobals.grid(row=1, column=1) | |
| 138 # | |
| 139 self.status = Label(top, anchor="w") | |
| 140 self.status.pack(anchor="w") | |
| 141 self.error = Label(top, anchor="w") | |
| 142 self.error.pack(anchor="w", fill="x") | |
| 143 self.errorbg = self.error.cget("background") | |
| 144 # | |
| 145 self.fstack = Frame(top, height=1) | |
| 146 self.fstack.pack(expand=1, fill="both") | |
| 147 self.flocals = Frame(top) | |
| 148 self.flocals.pack(expand=1, fill="both") | |
| 149 self.fglobals = Frame(top, height=1) | |
| 150 self.fglobals.pack(expand=1, fill="both") | |
| 151 # | |
| 152 if self.vstack.get(): | |
| 153 self.show_stack() | |
| 154 if self.vlocals.get(): | |
| 155 self.show_locals() | |
| 156 if self.vglobals.get(): | |
| 157 self.show_globals() | |
| 158 | |
| 23547 | 159 def interaction(self, message, frame, info=None): |
| 13975 | 160 self.frame = frame |
| 161 self.status.configure(text=message) | |
| 162 # | |
| 163 if info: | |
| 164 type, value, tb = info | |
| 165 try: | |
| 166 m1 = type.__name__ | |
| 167 except AttributeError: | |
| 168 m1 = "%s" % str(type) | |
| 169 if value is not None: | |
| 170 try: | |
| 171 m1 = "%s: %s" % (m1, str(value)) | |
| 172 except: | |
| 173 pass | |
| 174 bg = "yellow" | |
| 175 else: | |
| 176 m1 = "" | |
| 177 tb = None | |
| 178 bg = self.errorbg | |
| 179 self.error.configure(text=m1, background=bg) | |
| 180 # | |
| 181 sv = self.stackviewer | |
| 182 if sv: | |
| 23547 | 183 stack, i = self.idb.get_stack(self.frame, tb) |
| 13975 | 184 sv.load_stack(stack, i) |
| 185 # | |
| 186 self.show_variables(1) | |
| 187 # | |
| 188 if self.vsource.get(): | |
| 189 self.sync_source_line() | |
| 190 # | |
| 191 for b in self.buttons: | |
| 192 b.configure(state="normal") | |
| 193 # | |
|
33218
066c7890cd61
1. If user passes a non-existant filename on the commandline, just open
Kurt B. Kaiser <kbk@shore.net>
parents:
29059
diff
changeset
|
194 self.top.wakeup() |
| 13975 | 195 self.root.mainloop() |
| 196 # | |
| 197 for b in self.buttons: | |
| 198 b.configure(state="disabled") | |
| 199 self.status.configure(text="") | |
| 200 self.error.configure(text="", background=self.errorbg) | |
| 201 self.frame = None | |
| 202 | |
| 203 def sync_source_line(self): | |
| 204 frame = self.frame | |
| 205 if not frame: | |
| 206 return | |
| 23547 | 207 filename, lineno = self.__frame2fileline(frame) |
| 208 if filename[:1] + filename[-1:] != "<>" and os.path.exists(filename): | |
| 209 self.flist.gotofileline(filename, lineno) | |
| 210 | |
| 211 def __frame2fileline(self, frame): | |
| 13975 | 212 code = frame.f_code |
| 23547 | 213 filename = code.co_filename |
| 13975 | 214 lineno = frame.f_lineno |
| 23547 | 215 return filename, lineno |
| 13975 | 216 |
| 217 def cont(self): | |
| 23547 | 218 self.idb.set_continue() |
| 13975 | 219 self.root.quit() |
| 220 | |
| 221 def step(self): | |
| 23547 | 222 self.idb.set_step() |
| 13975 | 223 self.root.quit() |
| 224 | |
| 225 def next(self): | |
| 23547 | 226 self.idb.set_next(self.frame) |
| 13975 | 227 self.root.quit() |
| 228 | |
| 229 def ret(self): | |
| 23547 | 230 self.idb.set_return(self.frame) |
| 13975 | 231 self.root.quit() |
| 232 | |
| 233 def quit(self): | |
| 23547 | 234 self.idb.set_quit() |
| 13975 | 235 self.root.quit() |
| 236 | |
| 237 stackviewer = None | |
| 238 | |
| 239 def show_stack(self): | |
| 240 if not self.stackviewer and self.vstack.get(): | |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
241 self.stackviewer = sv = StackViewer(self.fstack, self.flist, self) |
| 13975 | 242 if self.frame: |
| 23547 | 243 stack, i = self.idb.get_stack(self.frame, None) |
| 13975 | 244 sv.load_stack(stack, i) |
| 245 else: | |
| 246 sv = self.stackviewer | |
| 247 if sv and not self.vstack.get(): | |
| 248 self.stackviewer = None | |
| 249 sv.close() | |
| 250 self.fstack['height'] = 1 | |
| 251 | |
| 252 def show_source(self): | |
| 253 if self.vsource.get(): | |
| 254 self.sync_source_line() | |
| 255 | |
| 256 def show_frame(self, (frame, lineno)): | |
| 257 self.frame = frame | |
| 258 self.show_variables() | |
| 259 | |
| 260 localsviewer = None | |
| 261 globalsviewer = None | |
| 262 | |
| 263 def show_locals(self): | |
| 264 lv = self.localsviewer | |
| 265 if self.vlocals.get(): | |
| 266 if not lv: | |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
267 self.localsviewer = NamespaceViewer(self.flocals, "Locals") |
| 13975 | 268 else: |
| 269 if lv: | |
| 270 self.localsviewer = None | |
| 271 lv.close() | |
| 272 self.flocals['height'] = 1 | |
| 273 self.show_variables() | |
| 274 | |
| 275 def show_globals(self): | |
| 276 gv = self.globalsviewer | |
| 277 if self.vglobals.get(): | |
| 278 if not gv: | |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
279 self.globalsviewer = NamespaceViewer(self.fglobals, "Globals") |
| 13975 | 280 else: |
| 281 if gv: | |
| 282 self.globalsviewer = None | |
| 283 gv.close() | |
| 284 self.fglobals['height'] = 1 | |
| 285 self.show_variables() | |
| 286 | |
| 287 def show_variables(self, force=0): | |
| 288 lv = self.localsviewer | |
| 289 gv = self.globalsviewer | |
| 290 frame = self.frame | |
| 291 if not frame: | |
| 292 ldict = gdict = None | |
| 293 else: | |
| 294 ldict = frame.f_locals | |
| 295 gdict = frame.f_globals | |
| 296 if lv and gv and ldict is gdict: | |
| 297 ldict = None | |
| 298 if lv: | |
|
23876
832f0501148b
Polish RemoteDebugger code.
Kurt B. Kaiser <kbk@shore.net>
parents:
23547
diff
changeset
|
299 lv.load_dict(ldict, force, self.pyshell.interp.rpcclt) |
| 13975 | 300 if gv: |
|
23876
832f0501148b
Polish RemoteDebugger code.
Kurt B. Kaiser <kbk@shore.net>
parents:
23547
diff
changeset
|
301 gv.load_dict(gdict, force, self.pyshell.interp.rpcclt) |
| 13975 | 302 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
303 def set_breakpoint_here(self, filename, lineno): |
| 26487 | 304 self.idb.set_break(filename, lineno) |
| 13975 | 305 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
306 def clear_breakpoint_here(self, filename, lineno): |
| 26487 | 307 self.idb.clear_break(filename, lineno) |
|
23932
eab8eca9ec51
1. Debugger Breakpoints, finish implementation
Kurt B. Kaiser <kbk@shore.net>
parents:
23876
diff
changeset
|
308 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
309 def clear_file_breaks(self, filename): |
| 26487 | 310 self.idb.clear_all_file_breaks(filename) |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
311 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
312 def load_breakpoints(self): |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
313 "Load PyShellEditorWindow breakpoints into subprocess debugger" |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
314 pyshell_edit_windows = self.pyshell.flist.inversedict.keys() |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
315 for editwin in pyshell_edit_windows: |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
316 filename = editwin.io.filename |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
317 try: |
| 26659 | 318 for lineno in editwin.breakpoints: |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
319 self.set_breakpoint_here(filename, lineno) |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
320 except AttributeError: |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
321 continue |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
322 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
323 class StackViewer(ScrolledList): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
324 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
325 def __init__(self, master, flist, gui): |
|
38924
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
326 if macosxSupport.runningAsOSXApp(): |
|
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
327 # At least on with the stock AquaTk version on OSX 10.4 you'll |
|
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
328 # get an shaking GUI that eventually kills IDLE if the width |
|
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
329 # argument is specified. |
|
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
330 ScrolledList.__init__(self, master) |
|
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
331 else: |
|
c7532856fd17
Workaround for bug #1512124
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
33218
diff
changeset
|
332 ScrolledList.__init__(self, master, width=80) |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
333 self.flist = flist |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
334 self.gui = gui |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
335 self.stack = [] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
336 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
337 def load_stack(self, stack, index=None): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
338 self.stack = stack |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
339 self.clear() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
340 for i in range(len(stack)): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
341 frame, lineno = stack[i] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
342 try: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
343 modname = frame.f_globals["__name__"] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
344 except: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
345 modname = "?" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
346 code = frame.f_code |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
347 filename = code.co_filename |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
348 funcname = code.co_name |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
349 import linecache |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
350 sourceline = linecache.getline(filename, lineno) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
351 import string |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
352 sourceline = string.strip(sourceline) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
353 if funcname in ("?", "", None): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
354 item = "%s, line %d: %s" % (modname, lineno, sourceline) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
355 else: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
356 item = "%s.%s(), line %d: %s" % (modname, funcname, |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
357 lineno, sourceline) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
358 if i == index: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
359 item = "> " + item |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
360 self.append(item) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
361 if index is not None: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
362 self.select(index) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
363 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
364 def popup_event(self, event): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
365 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
366 if self.stack: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
367 return ScrolledList.popup_event(self, event) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
368 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
369 def fill_menu(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
370 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
371 menu = self.menu |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
372 menu.add_command(label="Go to source line", |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
373 command=self.goto_source_line) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
374 menu.add_command(label="Show stack frame", |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
375 command=self.show_stack_frame) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
376 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
377 def on_select(self, index): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
378 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
379 if 0 <= index < len(self.stack): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
380 self.gui.show_frame(self.stack[index]) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
381 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
382 def on_double(self, index): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
383 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
384 self.show_source(index) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
385 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
386 def goto_source_line(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
387 index = self.listbox.index("active") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
388 self.show_source(index) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
389 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
390 def show_stack_frame(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
391 index = self.listbox.index("active") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
392 if 0 <= index < len(self.stack): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
393 self.gui.show_frame(self.stack[index]) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
394 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
395 def show_source(self, index): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
396 if not (0 <= index < len(self.stack)): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
397 return |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
398 frame, lineno = self.stack[index] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
399 code = frame.f_code |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
400 filename = code.co_filename |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
401 if os.path.isfile(filename): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
402 edit = self.flist.open(filename) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
403 if edit: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
404 edit.gotoline(lineno) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
405 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
406 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
407 class NamespaceViewer: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
408 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
409 def __init__(self, master, title, dict=None): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
410 width = 0 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
411 height = 40 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
412 if dict: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
413 height = 20*len(dict) # XXX 20 == observed height of Entry widget |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
414 self.master = master |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
415 self.title = title |
|
47221
9fbc41abdd4b
Revert the renaming of repr to reprlib.
Brett Cannon <bcannon@gmail.com>
parents:
47183
diff
changeset
|
416 import repr |
|
9fbc41abdd4b
Revert the renaming of repr to reprlib.
Brett Cannon <bcannon@gmail.com>
parents:
47183
diff
changeset
|
417 self.repr = repr.Repr() |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
418 self.repr.maxstring = 60 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
419 self.repr.maxother = 60 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
420 self.frame = frame = Frame(master) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
421 self.frame.pack(expand=1, fill="both") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
422 self.label = Label(frame, text=title, borderwidth=2, relief="groove") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
423 self.label.pack(fill="x") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
424 self.vbar = vbar = Scrollbar(frame, name="vbar") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
425 vbar.pack(side="right", fill="y") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
426 self.canvas = canvas = Canvas(frame, |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
427 height=min(300, max(40, height)), |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
428 scrollregion=(0, 0, width, height)) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
429 canvas.pack(side="left", fill="both", expand=1) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
430 vbar["command"] = canvas.yview |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
431 canvas["yscrollcommand"] = vbar.set |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
432 self.subframe = subframe = Frame(canvas) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
433 self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
434 self.load_dict(dict) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
435 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
436 dict = -1 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
437 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
438 def load_dict(self, dict, force=0, rpc_client=None): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
439 if dict is self.dict and not force: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
440 return |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
441 subframe = self.subframe |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
442 frame = self.frame |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
443 for c in subframe.children.values(): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
444 c.destroy() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
445 self.dict = None |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
446 if not dict: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
447 l = Label(subframe, text="None") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
448 l.grid(row=0, column=0) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
449 else: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
450 names = dict.keys() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
451 names.sort() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
452 row = 0 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
453 for name in names: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
454 value = dict[name] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
455 svalue = self.repr.repr(value) # repr(value) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
456 # Strip extra quotes caused by calling repr on the (already) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
457 # repr'd value sent across the RPC interface: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
458 if rpc_client: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
459 svalue = svalue[1:-1] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
460 l = Label(subframe, text=name) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
461 l.grid(row=row, column=0, sticky="nw") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
462 l = Entry(subframe, width=0, borderwidth=0) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
463 l.insert(0, svalue) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
464 l.grid(row=row, column=1, sticky="nw") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
465 row = row+1 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
466 self.dict = dict |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
467 # XXX Could we use a <Configure> callback for the following? |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
468 subframe.update_idletasks() # Alas! |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
469 width = subframe.winfo_reqwidth() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
470 height = subframe.winfo_reqheight() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
471 canvas = self.canvas |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
472 self.canvas["scrollregion"] = (0, 0, width, height) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
473 if height > 300: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
474 canvas["height"] = 300 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
475 frame.pack(expand=1) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
476 else: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
477 canvas["height"] = height |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
478 frame.pack(expand=0) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
479 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
480 def close(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
481 self.frame.destroy() |
