Mercurial > cpython-lru_cache-weakref
annotate Lib/idlelib/Debugger.py @ 79691:05c8928362ee
Merge __next__ method link fixes with 3.3.
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Fri, 12 Oct 2012 13:46:37 +0300 |
| parents | ef4cca2d6171 |
| children |
| rev | line source |
|---|---|
| 13975 | 1 import os |
| 2 import bdb | |
| 23547 | 3 import types |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47088
diff
changeset
|
4 from tkinter import * |
|
42714
2ec16b6b4d04
Switch to absolute imports to support direct execution of modules. Many
Kurt B. Kaiser <kbk@shore.net>
parents:
42577
diff
changeset
|
5 from idlelib.WindowList import ListedToplevel |
|
2ec16b6b4d04
Switch to absolute imports to support direct execution of modules. Many
Kurt B. Kaiser <kbk@shore.net>
parents:
42577
diff
changeset
|
6 from idlelib.ScrolledList import ScrolledList |
|
2ec16b6b4d04
Switch to absolute imports to support direct execution of modules. Many
Kurt B. Kaiser <kbk@shore.net>
parents:
42577
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 | |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41480
diff
changeset
|
256 def show_frame(self, stackitem): |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41480
diff
changeset
|
257 frame, lineno = stackitem |
| 13975 | 258 self.frame = frame |
| 259 self.show_variables() | |
| 260 | |
| 261 localsviewer = None | |
| 262 globalsviewer = None | |
| 263 | |
| 264 def show_locals(self): | |
| 265 lv = self.localsviewer | |
| 266 if self.vlocals.get(): | |
| 267 if not lv: | |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
268 self.localsviewer = NamespaceViewer(self.flocals, "Locals") |
| 13975 | 269 else: |
| 270 if lv: | |
| 271 self.localsviewer = None | |
| 272 lv.close() | |
| 273 self.flocals['height'] = 1 | |
| 274 self.show_variables() | |
| 275 | |
| 276 def show_globals(self): | |
| 277 gv = self.globalsviewer | |
| 278 if self.vglobals.get(): | |
| 279 if not gv: | |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
280 self.globalsviewer = NamespaceViewer(self.fglobals, "Globals") |
| 13975 | 281 else: |
| 282 if gv: | |
| 283 self.globalsviewer = None | |
| 284 gv.close() | |
| 285 self.fglobals['height'] = 1 | |
| 286 self.show_variables() | |
| 287 | |
| 288 def show_variables(self, force=0): | |
| 289 lv = self.localsviewer | |
| 290 gv = self.globalsviewer | |
| 291 frame = self.frame | |
| 292 if not frame: | |
| 293 ldict = gdict = None | |
| 294 else: | |
| 295 ldict = frame.f_locals | |
| 296 gdict = frame.f_globals | |
| 297 if lv and gv and ldict is gdict: | |
| 298 ldict = None | |
| 299 if lv: | |
|
23876
832f0501148b
Polish RemoteDebugger code.
Kurt B. Kaiser <kbk@shore.net>
parents:
23547
diff
changeset
|
300 lv.load_dict(ldict, force, self.pyshell.interp.rpcclt) |
| 13975 | 301 if gv: |
|
23876
832f0501148b
Polish RemoteDebugger code.
Kurt B. Kaiser <kbk@shore.net>
parents:
23547
diff
changeset
|
302 gv.load_dict(gdict, force, self.pyshell.interp.rpcclt) |
| 13975 | 303 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
304 def set_breakpoint_here(self, filename, lineno): |
| 26487 | 305 self.idb.set_break(filename, lineno) |
| 13975 | 306 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
307 def clear_breakpoint_here(self, filename, lineno): |
| 26487 | 308 self.idb.clear_break(filename, lineno) |
|
23932
eab8eca9ec51
1. Debugger Breakpoints, finish implementation
Kurt B. Kaiser <kbk@shore.net>
parents:
23876
diff
changeset
|
309 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
310 def clear_file_breaks(self, filename): |
| 26487 | 311 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
|
312 |
|
25894
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
313 def load_breakpoints(self): |
|
19500c9b58c1
Implement Restoring Breakpoints in Subprocess Debugger
Kurt B. Kaiser <kbk@shore.net>
parents:
25284
diff
changeset
|
314 "Load PyShellEditorWindow breakpoints into subprocess debugger" |
|
42725
fa9a40ef0780
Conform to py3k dict.{keys, items, values} with some advice from 2b3
Kurt B. Kaiser <kbk@shore.net>
parents:
42714
diff
changeset
|
315 for editwin in self.pyshell.flist.inversedict: |
|
25894
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): |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
33218
diff
changeset
|
326 if macosxSupport.runningAsOSXApp(): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
33218
diff
changeset
|
327 # At least on with the stock AquaTk version on OSX 10.4 you'll |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
33218
diff
changeset
|
328 # get an shaking GUI that eventually kills IDLE if the width |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
33218
diff
changeset
|
329 # argument is specified. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
33218
diff
changeset
|
330 ScrolledList.__init__(self, master) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
33218
diff
changeset
|
331 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
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) |
|
41480
99027c2b3fd2
Remove functions in string module that are also string methods. Also remove:
Neal Norwitz <nnorwitz@gmail.com>
parents:
39442
diff
changeset
|
351 sourceline = sourceline.strip() |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
352 if funcname in ("?", "", None): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
353 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
|
354 else: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
355 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
|
356 lineno, sourceline) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
357 if i == index: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
358 item = "> " + item |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
359 self.append(item) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
360 if index is not None: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
361 self.select(index) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
362 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
363 def popup_event(self, event): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
364 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
365 if self.stack: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
366 return ScrolledList.popup_event(self, event) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
367 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
368 def fill_menu(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
369 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
370 menu = self.menu |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
371 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
|
372 command=self.goto_source_line) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
373 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
|
374 command=self.show_stack_frame) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
375 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
376 def on_select(self, index): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
377 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
378 if 0 <= index < len(self.stack): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
379 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
|
380 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
381 def on_double(self, index): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
382 "override base method" |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
383 self.show_source(index) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
384 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
385 def goto_source_line(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
386 index = self.listbox.index("active") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
387 self.show_source(index) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
388 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
389 def show_stack_frame(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
390 index = self.listbox.index("active") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
391 if 0 <= index < len(self.stack): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
392 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
|
393 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
394 def show_source(self, index): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
395 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
|
396 return |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
397 frame, lineno = self.stack[index] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
398 code = frame.f_code |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
399 filename = code.co_filename |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
400 if os.path.isfile(filename): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
401 edit = self.flist.open(filename) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
402 if edit: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
403 edit.gotoline(lineno) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
404 |
|
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 class NamespaceViewer: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
407 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
408 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
|
409 width = 0 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
410 height = 40 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
411 if dict: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
412 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
|
413 self.master = master |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
414 self.title = title |
|
47088
4f1a079df427
Rename the repr module to reprlib.
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
42999
diff
changeset
|
415 import reprlib |
|
4f1a079df427
Rename the repr module to reprlib.
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
42999
diff
changeset
|
416 self.repr = reprlib.Repr() |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
417 self.repr.maxstring = 60 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
418 self.repr.maxother = 60 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
419 self.frame = frame = Frame(master) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
420 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
|
421 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
|
422 self.label.pack(fill="x") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
423 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
|
424 vbar.pack(side="right", fill="y") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
425 self.canvas = canvas = Canvas(frame, |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
426 height=min(300, max(40, height)), |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
427 scrollregion=(0, 0, width, height)) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
428 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
|
429 vbar["command"] = canvas.yview |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
430 canvas["yscrollcommand"] = vbar.set |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
431 self.subframe = subframe = Frame(canvas) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
432 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
|
433 self.load_dict(dict) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
434 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
435 dict = -1 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
436 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
437 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
|
438 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
|
439 return |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
440 subframe = self.subframe |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
441 frame = self.frame |
|
42577
0ed3d182920b
Fix two obvious 2.xisms.
Guido van Rossum <guido@python.org>
parents:
42324
diff
changeset
|
442 for c in list(subframe.children.values()): |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
443 c.destroy() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
444 self.dict = None |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
445 if not dict: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
446 l = Label(subframe, text="None") |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
447 l.grid(row=0, column=0) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
448 else: |
|
42999
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
449 #names = sorted(dict) |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
450 ### |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
451 # Because of (temporary) limitations on the dict_keys type (not yet |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
452 # public or pickleable), have the subprocess to send a list of |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
453 # keys, not a dict_keys object. sorted() will take a dict_keys |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
454 # (no subprocess) or a list. |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
455 # |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
456 # There is also an obscure bug in sorted(dict) where the |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
457 # interpreter gets into a loop requesting non-existing dict[0], |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
458 # dict[1], dict[2], etc from the RemoteDebugger.DictProxy. |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
459 ### |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
460 keys_list = dict.keys() |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
461 names = sorted(keys_list) |
|
dc0f0ffd4257
1. Debugger was failing to start due to DictProxy limitations.
Kurt B. Kaiser <kbk@shore.net>
parents:
42725
diff
changeset
|
462 ### |
|
24114
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
463 row = 0 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
464 for name in names: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
465 value = dict[name] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
466 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
|
467 # 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
|
468 # 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
|
469 if rpc_client: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
470 svalue = svalue[1:-1] |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
471 l = Label(subframe, text=name) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
472 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
|
473 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
|
474 l.insert(0, svalue) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
475 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
|
476 row = row+1 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
477 self.dict = dict |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
478 # 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
|
479 subframe.update_idletasks() # Alas! |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
480 width = subframe.winfo_reqwidth() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
481 height = subframe.winfo_reqheight() |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
482 canvas = self.canvas |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
483 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
|
484 if height > 300: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
485 canvas["height"] = 300 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
486 frame.pack(expand=1) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
487 else: |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
488 canvas["height"] = height |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
489 frame.pack(expand=0) |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
490 |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
491 def close(self): |
|
ff6873d28a14
Combine OldStackViewer.py with Debugger.py, removing dead code.
unknown <tools@python.org>
parents:
23974
diff
changeset
|
492 self.frame.destroy() |
