Current Path: > > lib64 > python2.7 > idlelib >
Operation : Linux premium107.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 198.54.126.246 | Your IP: 216.73.216.181 Domains : 1034 Domain(s) Permission : [ 0755 ]
| Name | Type | Size | Last Modified | Actions |
|---|---|---|---|---|
| Icons | Directory | - | - | |
| idle_test | Directory | - | - | |
| AutoComplete.py | File | 8964 bytes | April 10 2024 04:58:35. | |
| AutoComplete.pyc | File | 8012 bytes | April 10 2024 04:58:46. | |
| AutoComplete.pyo | File | 8012 bytes | April 10 2024 04:58:46. | |
| AutoCompleteWindow.py | File | 17318 bytes | April 10 2024 04:58:35. | |
| AutoCompleteWindow.pyc | File | 12480 bytes | April 10 2024 04:58:46. | |
| AutoCompleteWindow.pyo | File | 12421 bytes | April 10 2024 04:58:43. | |
| AutoExpand.py | File | 3395 bytes | April 10 2024 04:58:35. | |
| AutoExpand.pyc | File | 3502 bytes | April 10 2024 04:58:46. | |
| AutoExpand.pyo | File | 3502 bytes | April 10 2024 04:58:46. | |
| Bindings.py | File | 2976 bytes | April 10 2024 04:58:35. | |
| Bindings.pyc | File | 4695 bytes | April 10 2024 04:58:46. | |
| Bindings.pyo | File | 4695 bytes | April 10 2024 04:58:46. | |
| CREDITS.txt | File | 1866 bytes | April 10 2024 04:58:35. | |
| CallTipWindow.py | File | 6065 bytes | April 10 2024 04:58:35. | |
| CallTipWindow.pyc | File | 6136 bytes | April 10 2024 04:58:46. | |
| CallTipWindow.pyo | File | 6136 bytes | April 10 2024 04:58:46. | |
| CallTips.py | File | 7740 bytes | April 10 2024 04:58:35. | |
| CallTips.pyc | File | 8133 bytes | April 10 2024 04:58:46. | |
| CallTips.pyo | File | 8133 bytes | April 10 2024 04:58:46. | |
| ChangeLog | File | 56393 bytes | April 10 2024 04:58:35. | |
| ClassBrowser.py | File | 6999 bytes | April 10 2024 04:58:35. | |
| ClassBrowser.pyc | File | 9500 bytes | April 10 2024 04:58:46. | |
| ClassBrowser.pyo | File | 9500 bytes | April 10 2024 04:58:46. | |
| CodeContext.py | File | 8342 bytes | April 10 2024 04:58:35. | |
| CodeContext.pyc | File | 6658 bytes | April 10 2024 04:58:46. | |
| CodeContext.pyo | File | 6614 bytes | April 10 2024 04:58:43. | |
| ColorDelegator.py | File | 9762 bytes | April 10 2024 04:58:35. | |
| ColorDelegator.pyc | File | 8898 bytes | April 10 2024 04:58:46. | |
| ColorDelegator.pyo | File | 8898 bytes | April 10 2024 04:58:46. | |
| Debugger.py | File | 18236 bytes | April 10 2024 04:58:35. | |
| Debugger.pyc | File | 17546 bytes | April 10 2024 04:58:46. | |
| Debugger.pyo | File | 17546 bytes | April 10 2024 04:58:46. | |
| Delegator.py | File | 665 bytes | April 10 2024 04:58:35. | |
| Delegator.pyc | File | 1268 bytes | April 10 2024 04:58:46. | |
| Delegator.pyo | File | 1268 bytes | April 10 2024 04:58:46. | |
| EditorWindow.py | File | 65498 bytes | April 10 2024 04:58:35. | |
| EditorWindow.pyc | File | 56858 bytes | April 10 2024 04:58:46. | |
| EditorWindow.pyo | File | 56756 bytes | April 10 2024 04:58:43. | |
| FileList.py | File | 3718 bytes | April 10 2024 04:58:35. | |
| FileList.pyc | File | 4025 bytes | April 10 2024 04:58:46. | |
| FileList.pyo | File | 3992 bytes | April 10 2024 04:58:43. | |
| FormatParagraph.py | File | 7287 bytes | April 10 2024 04:58:35. | |
| FormatParagraph.pyc | File | 7142 bytes | April 10 2024 04:58:46. | |
| FormatParagraph.pyo | File | 7142 bytes | April 10 2024 04:58:46. | |
| GrepDialog.py | File | 5145 bytes | April 10 2024 04:58:35. | |
| GrepDialog.pyc | File | 6425 bytes | April 10 2024 04:58:46. | |
| GrepDialog.pyo | File | 6425 bytes | April 10 2024 04:58:46. | |
| HISTORY.txt | File | 10317 bytes | April 10 2024 04:58:35. | |
| HyperParser.py | File | 10497 bytes | April 10 2024 04:58:35. | |
| HyperParser.pyc | File | 6673 bytes | April 10 2024 04:58:46. | |
| HyperParser.pyo | File | 6673 bytes | April 10 2024 04:58:46. | |
| IOBinding.py | File | 21911 bytes | April 10 2024 04:58:35. | |
| IOBinding.pyc | File | 18535 bytes | April 10 2024 04:58:46. | |
| IOBinding.pyo | File | 18535 bytes | April 10 2024 04:58:46. | |
| IdleHistory.py | File | 4052 bytes | April 10 2024 04:58:35. | |
| IdleHistory.pyc | File | 4060 bytes | April 10 2024 04:58:46. | |
| IdleHistory.pyo | File | 4060 bytes | April 10 2024 04:58:46. | |
| MultiCall.py | File | 17701 bytes | April 10 2024 04:58:35. | |
| MultiCall.pyc | File | 16351 bytes | April 10 2024 04:58:46. | |
| MultiCall.pyo | File | 16277 bytes | April 10 2024 04:58:43. | |
| MultiStatusBar.py | File | 1348 bytes | April 10 2024 04:58:35. | |
| MultiStatusBar.pyc | File | 2279 bytes | April 10 2024 04:58:46. | |
| MultiStatusBar.pyo | File | 2279 bytes | April 10 2024 04:58:46. | |
| NEWS.txt | File | 47247 bytes | April 10 2024 04:58:35. | |
| ObjectBrowser.py | File | 4376 bytes | April 10 2024 04:58:35. | |
| ObjectBrowser.pyc | File | 7067 bytes | April 10 2024 04:58:46. | |
| ObjectBrowser.pyo | File | 7067 bytes | April 10 2024 04:58:46. | |
| OutputWindow.py | File | 4576 bytes | April 10 2024 04:58:35. | |
| OutputWindow.pyc | File | 5232 bytes | April 10 2024 04:58:46. | |
| OutputWindow.pyo | File | 5232 bytes | April 10 2024 04:58:46. | |
| ParenMatch.py | File | 6714 bytes | April 10 2024 04:58:35. | |
| ParenMatch.pyc | File | 7129 bytes | April 10 2024 04:58:46. | |
| ParenMatch.pyo | File | 7129 bytes | April 10 2024 04:58:46. | |
| PathBrowser.py | File | 3009 bytes | April 10 2024 04:58:35. | |
| PathBrowser.pyc | File | 4486 bytes | April 10 2024 04:58:46. | |
| PathBrowser.pyo | File | 4486 bytes | April 10 2024 04:58:46. | |
| Percolator.py | File | 3222 bytes | April 10 2024 04:58:35. | |
| Percolator.pyc | File | 4608 bytes | April 10 2024 04:58:46. | |
| Percolator.pyo | File | 4424 bytes | April 10 2024 04:58:43. | |
| PyParse.py | File | 19510 bytes | April 10 2024 04:58:35. | |
| PyParse.pyc | File | 10005 bytes | April 10 2024 04:58:46. | |
| PyParse.pyo | File | 9567 bytes | April 10 2024 04:58:43. | |
| PyShell.py | File | 58862 bytes | April 10 2024 04:58:35. | |
| PyShell.pyc | File | 52826 bytes | April 10 2024 04:58:46. | |
| PyShell.pyo | File | 52724 bytes | April 10 2024 04:58:43. | |
| README.txt | File | 7890 bytes | April 10 2024 04:58:35. | |
| RemoteDebugger.py | File | 11632 bytes | April 10 2024 04:58:35. | |
| RemoteDebugger.pyc | File | 16325 bytes | April 10 2024 04:58:46. | |
| RemoteDebugger.pyo | File | 16171 bytes | April 10 2024 04:58:43. | |
| RemoteObjectBrowser.py | File | 942 bytes | April 10 2024 04:58:35. | |
| RemoteObjectBrowser.pyc | File | 2150 bytes | April 10 2024 04:58:46. | |
| RemoteObjectBrowser.pyo | File | 2150 bytes | April 10 2024 04:58:46. | |
| ReplaceDialog.py | File | 6639 bytes | April 10 2024 04:58:35. | |
| ReplaceDialog.pyc | File | 7756 bytes | April 10 2024 04:58:46. | |
| ReplaceDialog.pyo | File | 7756 bytes | April 10 2024 04:58:46. | |
| RstripExtension.py | File | 1050 bytes | April 10 2024 04:58:35. | |
| RstripExtension.pyc | File | 1613 bytes | April 10 2024 04:58:46. | |
| RstripExtension.pyo | File | 1613 bytes | April 10 2024 04:58:46. | |
| ScriptBinding.py | File | 8459 bytes | April 10 2024 04:58:35. | |
| ScriptBinding.pyc | File | 8201 bytes | April 10 2024 04:58:46. | |
| ScriptBinding.pyo | File | 8201 bytes | April 10 2024 04:58:46. | |
| ScrolledList.py | File | 4373 bytes | April 10 2024 04:58:35. | |
| ScrolledList.pyc | File | 6482 bytes | April 10 2024 04:58:46. | |
| ScrolledList.pyo | File | 6482 bytes | April 10 2024 04:58:46. | |
| SearchDialog.py | File | 2630 bytes | April 10 2024 04:58:35. | |
| SearchDialog.pyc | File | 3983 bytes | April 10 2024 04:58:46. | |
| SearchDialog.pyo | File | 3983 bytes | April 10 2024 04:58:46. | |
| SearchDialogBase.py | File | 7094 bytes | April 10 2024 04:58:35. | |
| SearchDialogBase.pyc | File | 8462 bytes | April 10 2024 04:58:46. | |
| SearchDialogBase.pyo | File | 8462 bytes | April 10 2024 04:58:46. | |
| SearchEngine.py | File | 7463 bytes | April 10 2024 04:58:35. | |
| SearchEngine.pyc | File | 8302 bytes | April 10 2024 04:58:46. | |
| SearchEngine.pyo | File | 8302 bytes | April 10 2024 04:58:46. | |
| StackViewer.py | File | 4431 bytes | April 10 2024 04:58:35. | |
| StackViewer.pyc | File | 6404 bytes | April 10 2024 04:58:46. | |
| StackViewer.pyo | File | 6404 bytes | April 10 2024 04:58:46. | |
| TODO.txt | File | 8478 bytes | April 10 2024 04:58:35. | |
| ToolTip.py | File | 3173 bytes | April 10 2024 04:58:35. | |
| ToolTip.pyc | File | 4669 bytes | April 10 2024 04:58:46. | |
| ToolTip.pyo | File | 4669 bytes | April 10 2024 04:58:46. | |
| TreeWidget.py | File | 15037 bytes | April 10 2024 04:58:35. | |
| TreeWidget.pyc | File | 17694 bytes | April 10 2024 04:58:46. | |
| TreeWidget.pyo | File | 17694 bytes | April 10 2024 04:58:46. | |
| UndoDelegator.py | File | 10787 bytes | April 10 2024 04:58:35. | |
| UndoDelegator.pyc | File | 13555 bytes | April 10 2024 04:58:46. | |
| UndoDelegator.pyo | File | 13555 bytes | April 10 2024 04:58:46. | |
| WidgetRedirector.py | File | 6906 bytes | April 10 2024 04:58:35. | |
| WidgetRedirector.pyc | File | 7769 bytes | April 10 2024 04:58:46. | |
| WidgetRedirector.pyo | File | 7769 bytes | April 10 2024 04:58:46. | |
| WindowList.py | File | 2473 bytes | April 10 2024 04:58:35. | |
| WindowList.pyc | File | 3636 bytes | April 10 2024 04:58:46. | |
| WindowList.pyo | File | 3636 bytes | April 10 2024 04:58:46. | |
| ZoomHeight.py | File | 1300 bytes | April 10 2024 04:58:35. | |
| ZoomHeight.pyc | File | 1646 bytes | April 10 2024 04:58:46. | |
| ZoomHeight.pyo | File | 1646 bytes | April 10 2024 04:58:46. | |
| __init__.py | File | 288 bytes | April 10 2024 04:58:35. | |
| __init__.pyc | File | 431 bytes | April 10 2024 04:58:46. | |
| __init__.pyo | File | 431 bytes | April 10 2024 04:58:46. | |
| aboutDialog.py | File | 7014 bytes | April 10 2024 04:58:35. | |
| aboutDialog.pyc | File | 6848 bytes | April 10 2024 04:58:46. | |
| aboutDialog.pyo | File | 6848 bytes | April 10 2024 04:58:46. | |
| config-extensions.def | File | 2965 bytes | April 10 2024 04:58:35. | |
| config-highlight.def | File | 2515 bytes | April 10 2024 04:58:35. | |
| config-keys.def | File | 7777 bytes | April 10 2024 04:58:35. | |
| config-main.def | File | 2561 bytes | April 10 2024 04:58:35. | |
| configDialog.py | File | 65958 bytes | April 10 2024 04:58:35. | |
| configDialog.pyc | File | 53291 bytes | April 10 2024 04:58:46. | |
| configDialog.pyo | File | 53291 bytes | April 10 2024 04:58:46. | |
| configHandler.py | File | 32485 bytes | April 10 2024 04:58:35. | |
| configHandler.pyc | File | 29361 bytes | April 10 2024 04:58:46. | |
| configHandler.pyo | File | 29361 bytes | April 10 2024 04:58:46. | |
| configHelpSourceEdit.py | File | 6686 bytes | April 10 2024 04:58:35. | |
| configHelpSourceEdit.pyc | File | 6595 bytes | April 10 2024 04:58:46. | |
| configHelpSourceEdit.pyo | File | 6595 bytes | April 10 2024 04:58:46. | |
| configSectionNameDialog.py | File | 4040 bytes | April 10 2024 04:58:35. | |
| configSectionNameDialog.pyc | File | 4419 bytes | April 10 2024 04:58:46. | |
| configSectionNameDialog.pyo | File | 4419 bytes | April 10 2024 04:58:46. | |
| dynOptionMenuWidget.py | File | 1984 bytes | April 10 2024 04:58:35. | |
| dynOptionMenuWidget.pyc | File | 2790 bytes | April 10 2024 04:58:46. | |
| dynOptionMenuWidget.pyo | File | 2790 bytes | April 10 2024 04:58:46. | |
| extend.txt | File | 3642 bytes | April 10 2024 04:58:35. | |
| help.html | File | 42414 bytes | April 10 2024 04:58:35. | |
| help.py | File | 11035 bytes | April 10 2024 04:58:35. | |
| help.pyc | File | 12270 bytes | April 10 2024 04:58:46. | |
| help.pyo | File | 12270 bytes | April 10 2024 04:58:46. | |
| help.txt | File | 12144 bytes | April 10 2024 04:58:35. | |
| idle.py | File | 453 bytes | April 10 2024 04:58:35. | |
| idle.pyc | File | 410 bytes | April 10 2024 04:58:46. | |
| idle.pyo | File | 410 bytes | April 10 2024 04:58:46. | |
| idle.pyw | File | 563 bytes | April 10 2024 04:58:35. | |
| idlever.py | File | 415 bytes | April 10 2024 04:58:35. | |
| idlever.pyc | File | 578 bytes | April 10 2024 04:58:46. | |
| idlever.pyo | File | 578 bytes | April 10 2024 04:58:46. | |
| keybindingDialog.py | File | 12468 bytes | April 10 2024 04:58:35. | |
| keybindingDialog.pyc | File | 12173 bytes | April 10 2024 04:58:46. | |
| keybindingDialog.pyo | File | 12173 bytes | April 10 2024 04:58:46. | |
| macosxSupport.py | File | 8435 bytes | April 10 2024 04:58:35. | |
| macosxSupport.pyc | File | 8351 bytes | April 10 2024 04:58:46. | |
| macosxSupport.pyo | File | 8213 bytes | April 10 2024 04:58:43. | |
| rpc.py | File | 20150 bytes | April 10 2024 04:58:35. | |
| rpc.pyc | File | 21728 bytes | April 10 2024 04:58:46. | |
| rpc.pyo | File | 21622 bytes | April 10 2024 04:58:43. | |
| run.py | File | 12917 bytes | April 10 2024 04:58:35. | |
| run.pyc | File | 13419 bytes | April 10 2024 04:58:46. | |
| run.pyo | File | 13361 bytes | April 10 2024 04:58:43. | |
| tabbedpages.py | File | 18439 bytes | April 10 2024 04:58:35. | |
| tabbedpages.pyc | File | 18561 bytes | April 10 2024 04:58:46. | |
| tabbedpages.pyo | File | 18561 bytes | April 10 2024 04:58:46. | |
| textView.py | File | 3520 bytes | April 10 2024 04:58:35. | |
| textView.pyc | File | 4025 bytes | April 10 2024 04:58:46. | |
| textView.pyo | File | 4025 bytes | April 10 2024 04:58:46. |
import os
import bdb
from Tkinter import *
from idlelib.WindowList import ListedToplevel
from idlelib.ScrolledList import ScrolledList
from idlelib import macosxSupport
class Idb(bdb.Bdb):
def __init__(self, gui):
self.gui = gui
bdb.Bdb.__init__(self)
def user_line(self, frame):
if self.in_rpc_code(frame):
self.set_step()
return
message = self.__frame2message(frame)
try:
self.gui.interaction(message, frame)
except TclError: # When closing debugger window with [x] in 3.x
pass
def user_exception(self, frame, info):
if self.in_rpc_code(frame):
self.set_step()
return
message = self.__frame2message(frame)
self.gui.interaction(message, frame, info)
def in_rpc_code(self, frame):
if frame.f_code.co_filename.count('rpc.py'):
return True
else:
prev_frame = frame.f_back
if prev_frame.f_code.co_filename.count('Debugger.py'):
# (that test will catch both Debugger.py and RemoteDebugger.py)
return False
return self.in_rpc_code(prev_frame)
def __frame2message(self, frame):
code = frame.f_code
filename = code.co_filename
lineno = frame.f_lineno
basename = os.path.basename(filename)
message = "%s:%s" % (basename, lineno)
if code.co_name != "?":
message = "%s: %s()" % (message, code.co_name)
return message
class Debugger:
vstack = vsource = vlocals = vglobals = None
def __init__(self, pyshell, idb=None):
if idb is None:
idb = Idb(self)
self.pyshell = pyshell
self.idb = idb
self.frame = None
self.make_gui()
self.interacting = 0
self.nesting_level = 0
def run(self, *args):
# Deal with the scenario where we've already got a program running
# in the debugger and we want to start another. If that is the case,
# our second 'run' was invoked from an event dispatched not from
# the main event loop, but from the nested event loop in 'interaction'
# below. So our stack looks something like this:
# outer main event loop
# run()
# <running program with traces>
# callback to debugger's interaction()
# nested event loop
# run() for second command
#
# This kind of nesting of event loops causes all kinds of problems
# (see e.g. issue #24455) especially when dealing with running as a
# subprocess, where there's all kinds of extra stuff happening in
# there - insert a traceback.print_stack() to check it out.
#
# By this point, we've already called restart_subprocess() in
# ScriptBinding. However, we also need to unwind the stack back to
# that outer event loop. To accomplish this, we:
# - return immediately from the nested run()
# - abort_loop ensures the nested event loop will terminate
# - the debugger's interaction routine completes normally
# - the restart_subprocess() will have taken care of stopping
# the running program, which will also let the outer run complete
#
# That leaves us back at the outer main event loop, at which point our
# after event can fire, and we'll come back to this routine with a
# clean stack.
if self.nesting_level > 0:
self.abort_loop()
self.root.after(100, lambda: self.run(*args))
return
try:
self.interacting = 1
return self.idb.run(*args)
finally:
self.interacting = 0
def close(self, event=None):
try:
self.quit()
except Exception:
pass
if self.interacting:
self.top.bell()
return
if self.stackviewer:
self.stackviewer.close(); self.stackviewer = None
# Clean up pyshell if user clicked debugger control close widget.
# (Causes a harmless extra cycle through close_debugger() if user
# toggled debugger from pyshell Debug menu)
self.pyshell.close_debugger()
# Now close the debugger control window....
self.top.destroy()
def make_gui(self):
pyshell = self.pyshell
self.flist = pyshell.flist
self.root = root = pyshell.root
self.top = top = ListedToplevel(root)
self.top.wm_title("Debug Control")
self.top.wm_iconname("Debug")
top.wm_protocol("WM_DELETE_WINDOW", self.close)
self.top.bind("<Escape>", self.close)
#
self.bframe = bframe = Frame(top)
self.bframe.pack(anchor="w")
self.buttons = bl = []
#
self.bcont = b = Button(bframe, text="Go", command=self.cont)
bl.append(b)
self.bstep = b = Button(bframe, text="Step", command=self.step)
bl.append(b)
self.bnext = b = Button(bframe, text="Over", command=self.next)
bl.append(b)
self.bret = b = Button(bframe, text="Out", command=self.ret)
bl.append(b)
self.bret = b = Button(bframe, text="Quit", command=self.quit)
bl.append(b)
#
for b in bl:
b.configure(state="disabled")
b.pack(side="left")
#
self.cframe = cframe = Frame(bframe)
self.cframe.pack(side="left")
#
if not self.vstack:
self.__class__.vstack = BooleanVar(top)
self.vstack.set(1)
self.bstack = Checkbutton(cframe,
text="Stack", command=self.show_stack, variable=self.vstack)
self.bstack.grid(row=0, column=0)
if not self.vsource:
self.__class__.vsource = BooleanVar(top)
self.bsource = Checkbutton(cframe,
text="Source", command=self.show_source, variable=self.vsource)
self.bsource.grid(row=0, column=1)
if not self.vlocals:
self.__class__.vlocals = BooleanVar(top)
self.vlocals.set(1)
self.blocals = Checkbutton(cframe,
text="Locals", command=self.show_locals, variable=self.vlocals)
self.blocals.grid(row=1, column=0)
if not self.vglobals:
self.__class__.vglobals = BooleanVar(top)
self.bglobals = Checkbutton(cframe,
text="Globals", command=self.show_globals, variable=self.vglobals)
self.bglobals.grid(row=1, column=1)
#
self.status = Label(top, anchor="w")
self.status.pack(anchor="w")
self.error = Label(top, anchor="w")
self.error.pack(anchor="w", fill="x")
self.errorbg = self.error.cget("background")
#
self.fstack = Frame(top, height=1)
self.fstack.pack(expand=1, fill="both")
self.flocals = Frame(top)
self.flocals.pack(expand=1, fill="both")
self.fglobals = Frame(top, height=1)
self.fglobals.pack(expand=1, fill="both")
#
if self.vstack.get():
self.show_stack()
if self.vlocals.get():
self.show_locals()
if self.vglobals.get():
self.show_globals()
def interaction(self, message, frame, info=None):
self.frame = frame
self.status.configure(text=message)
#
if info:
type, value, tb = info
try:
m1 = type.__name__
except AttributeError:
m1 = "%s" % str(type)
if value is not None:
try:
m1 = "%s: %s" % (m1, str(value))
except:
pass
bg = "yellow"
else:
m1 = ""
tb = None
bg = self.errorbg
self.error.configure(text=m1, background=bg)
#
sv = self.stackviewer
if sv:
stack, i = self.idb.get_stack(self.frame, tb)
sv.load_stack(stack, i)
#
self.show_variables(1)
#
if self.vsource.get():
self.sync_source_line()
#
for b in self.buttons:
b.configure(state="normal")
#
self.top.wakeup()
# Nested main loop: Tkinter's main loop is not reentrant, so use
# Tcl's vwait facility, which reenters the event loop until an
# event handler sets the variable we're waiting on
self.nesting_level += 1
self.root.tk.call('vwait', '::idledebugwait')
self.nesting_level -= 1
#
for b in self.buttons:
b.configure(state="disabled")
self.status.configure(text="")
self.error.configure(text="", background=self.errorbg)
self.frame = None
def sync_source_line(self):
frame = self.frame
if not frame:
return
filename, lineno = self.__frame2fileline(frame)
if filename[:1] + filename[-1:] != "<>" and os.path.exists(filename):
self.flist.gotofileline(filename, lineno)
def __frame2fileline(self, frame):
code = frame.f_code
filename = code.co_filename
lineno = frame.f_lineno
return filename, lineno
def cont(self):
self.idb.set_continue()
self.abort_loop()
def step(self):
self.idb.set_step()
self.abort_loop()
def next(self):
self.idb.set_next(self.frame)
self.abort_loop()
def ret(self):
self.idb.set_return(self.frame)
self.abort_loop()
def quit(self):
self.idb.set_quit()
self.abort_loop()
def abort_loop(self):
self.root.tk.call('set', '::idledebugwait', '1')
stackviewer = None
def show_stack(self):
if not self.stackviewer and self.vstack.get():
self.stackviewer = sv = StackViewer(self.fstack, self.flist, self)
if self.frame:
stack, i = self.idb.get_stack(self.frame, None)
sv.load_stack(stack, i)
else:
sv = self.stackviewer
if sv and not self.vstack.get():
self.stackviewer = None
sv.close()
self.fstack['height'] = 1
def show_source(self):
if self.vsource.get():
self.sync_source_line()
def show_frame(self, stackitem):
self.frame = stackitem[0] # lineno is stackitem[1]
self.show_variables()
localsviewer = None
globalsviewer = None
def show_locals(self):
lv = self.localsviewer
if self.vlocals.get():
if not lv:
self.localsviewer = NamespaceViewer(self.flocals, "Locals")
else:
if lv:
self.localsviewer = None
lv.close()
self.flocals['height'] = 1
self.show_variables()
def show_globals(self):
gv = self.globalsviewer
if self.vglobals.get():
if not gv:
self.globalsviewer = NamespaceViewer(self.fglobals, "Globals")
else:
if gv:
self.globalsviewer = None
gv.close()
self.fglobals['height'] = 1
self.show_variables()
def show_variables(self, force=0):
lv = self.localsviewer
gv = self.globalsviewer
frame = self.frame
if not frame:
ldict = gdict = None
else:
ldict = frame.f_locals
gdict = frame.f_globals
if lv and gv and ldict is gdict:
ldict = None
if lv:
lv.load_dict(ldict, force, self.pyshell.interp.rpcclt)
if gv:
gv.load_dict(gdict, force, self.pyshell.interp.rpcclt)
def set_breakpoint_here(self, filename, lineno):
self.idb.set_break(filename, lineno)
def clear_breakpoint_here(self, filename, lineno):
self.idb.clear_break(filename, lineno)
def clear_file_breaks(self, filename):
self.idb.clear_all_file_breaks(filename)
def load_breakpoints(self):
"Load PyShellEditorWindow breakpoints into subprocess debugger"
pyshell_edit_windows = self.pyshell.flist.inversedict.keys()
for editwin in pyshell_edit_windows:
filename = editwin.io.filename
try:
for lineno in editwin.breakpoints:
self.set_breakpoint_here(filename, lineno)
except AttributeError:
continue
class StackViewer(ScrolledList):
def __init__(self, master, flist, gui):
if macosxSupport.isAquaTk():
# At least on with the stock AquaTk version on OSX 10.4 you'll
# get a shaking GUI that eventually kills IDLE if the width
# argument is specified.
ScrolledList.__init__(self, master)
else:
ScrolledList.__init__(self, master, width=80)
self.flist = flist
self.gui = gui
self.stack = []
def load_stack(self, stack, index=None):
self.stack = stack
self.clear()
for i in range(len(stack)):
frame, lineno = stack[i]
try:
modname = frame.f_globals["__name__"]
except:
modname = "?"
code = frame.f_code
filename = code.co_filename
funcname = code.co_name
import linecache
sourceline = linecache.getline(filename, lineno)
import string
sourceline = string.strip(sourceline)
if funcname in ("?", "", None):
item = "%s, line %d: %s" % (modname, lineno, sourceline)
else:
item = "%s.%s(), line %d: %s" % (modname, funcname,
lineno, sourceline)
if i == index:
item = "> " + item
self.append(item)
if index is not None:
self.select(index)
def popup_event(self, event):
"override base method"
if self.stack:
return ScrolledList.popup_event(self, event)
def fill_menu(self):
"override base method"
menu = self.menu
menu.add_command(label="Go to source line",
command=self.goto_source_line)
menu.add_command(label="Show stack frame",
command=self.show_stack_frame)
def on_select(self, index):
"override base method"
if 0 <= index < len(self.stack):
self.gui.show_frame(self.stack[index])
def on_double(self, index):
"override base method"
self.show_source(index)
def goto_source_line(self):
index = self.listbox.index("active")
self.show_source(index)
def show_stack_frame(self):
index = self.listbox.index("active")
if 0 <= index < len(self.stack):
self.gui.show_frame(self.stack[index])
def show_source(self, index):
if not (0 <= index < len(self.stack)):
return
frame, lineno = self.stack[index]
code = frame.f_code
filename = code.co_filename
if os.path.isfile(filename):
edit = self.flist.open(filename)
if edit:
edit.gotoline(lineno)
class NamespaceViewer:
def __init__(self, master, title, dict=None):
width = 0
height = 40
if dict:
height = 20*len(dict) # XXX 20 == observed height of Entry widget
self.master = master
self.title = title
import repr
self.repr = repr.Repr()
self.repr.maxstring = 60
self.repr.maxother = 60
self.frame = frame = Frame(master)
self.frame.pack(expand=1, fill="both")
self.label = Label(frame, text=title, borderwidth=2, relief="groove")
self.label.pack(fill="x")
self.vbar = vbar = Scrollbar(frame, name="vbar")
vbar.pack(side="right", fill="y")
self.canvas = canvas = Canvas(frame,
height=min(300, max(40, height)),
scrollregion=(0, 0, width, height))
canvas.pack(side="left", fill="both", expand=1)
vbar["command"] = canvas.yview
canvas["yscrollcommand"] = vbar.set
self.subframe = subframe = Frame(canvas)
self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw")
self.load_dict(dict)
dict = -1
def load_dict(self, dict, force=0, rpc_client=None):
if dict is self.dict and not force:
return
subframe = self.subframe
frame = self.frame
for c in subframe.children.values():
c.destroy()
self.dict = None
if not dict:
l = Label(subframe, text="None")
l.grid(row=0, column=0)
else:
names = dict.keys()
names.sort()
row = 0
for name in names:
value = dict[name]
svalue = self.repr.repr(value) # repr(value)
# Strip extra quotes caused by calling repr on the (already)
# repr'd value sent across the RPC interface:
if rpc_client:
svalue = svalue[1:-1]
l = Label(subframe, text=name)
l.grid(row=row, column=0, sticky="nw")
l = Entry(subframe, width=0, borderwidth=0)
l.insert(0, svalue)
l.grid(row=row, column=1, sticky="nw")
row = row+1
self.dict = dict
# XXX Could we use a <Configure> callback for the following?
subframe.update_idletasks() # Alas!
width = subframe.winfo_reqwidth()
height = subframe.winfo_reqheight()
canvas = self.canvas
self.canvas["scrollregion"] = (0, 0, width, height)
if height > 300:
canvas["height"] = 300
frame.pack(expand=1)
else:
canvas["height"] = height
frame.pack(expand=0)
def close(self):
self.frame.destroy()
SILENT KILLER Tool