text.tag_add("BREAK", "insert linestart", "insert lineend +1char")
def clear_breakpoint_here(self, edit):
- text = edit.text
- filename = edit.io.filename
- if not filename:
- text.bell()
- return
- lineno = int(float(text.index("insert")))
- msg = self.idb.clear_break(filename, lineno)
- if msg:
- text.bell()
- return
- text.tag_remove("BREAK", "insert linestart",\
- "insert lineend +1char")
-
+ text = edit.text
+ filename = edit.io.filename
+ if not filename:
+ text.bell()
+ return
+ lineno = int(float(text.index("insert")))
+ msg = self.idb.clear_break(filename, lineno)
+ if msg:
+ text.bell()
+ return
+ text.tag_remove("BREAK", "insert linestart",\
+ "insert lineend +1char")
+ def clear_file_breaks(self, edit):
+ text = edit.text
+ filename = edit.io.filename
+ if not filename:
+ text.bell()
+ return
+ msg = self.idb.clear_all_file_breaks(filename)
+ if msg:
+ text.bell()
+ return
+ text.tag_delete("BREAK")
self.per.insertfilter(self.undo)
def ResetColorizer(self):
- #this function is called from configDialog.py
- #to update the colour theme if it is changed
+ "Update the colour theme if it is changed"
+ # Called from configDialog.py
if self.color:
self.color = self.ColorDelegator()
self.per.insertfilter(self.color)
def ResetFont(self):
- #this function is called from configDialog.py
- #to update the text widgets' font if it is changed
+ "Update the text widgets' font if it is changed"
+ # Called from configDialog.py
fontWeight='normal'
if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
fontWeight='bold'
fontWeight))
def ResetKeybindings(self):
- #this function is called from configDialog.py
- #to update the keybindings if they are changed
+ "Update the keybindings if they are changed"
+ # Called from configDialog.py
self.Bindings.default_keydefs=idleConf.GetCurrentKeySet()
keydefs = self.Bindings.default_keydefs
for event, keylist in keydefs.items():
#print 'accel now:',accel,'\n'
def ResetExtraHelpMenu(self):
- #load or update the Extra Help menu if required
+ "Load or update the Extra Help menu if required"
menuList=idleConf.GetAllExtraHelpSourcesList()
helpMenu=self.menudict['help']
cascadeIndex=helpMenu.index(END)-1
return DisplayExtraHelp
def UpdateRecentFilesList(self,newFile=None):
- #load or update the recent files list, and menu if required
+ "Load or update the recent files list, and menu if required"
rfList=[]
if os.path.exists(self.recentFilesPath):
RFfile=open(self.recentFilesPath,'r')
rfList.remove(newFile)
rfList.insert(0,newFile)
rfList=self.__CleanRecentFiles(rfList)
- print self.top.instanceDict
- print self
+ #print self.flist.inversedict
+ #print self.top.instanceDict
+ #print self
if rfList:
for instance in self.top.instanceDict.keys():
instance.menuRecentFiles.delete(1,END)
return reply
def _close(self):
- print self.io.filename
+ #print self.io.filename
if self.io.filename:
self.UpdateRecentFilesList(newFile=self.io.filename)
-
+ shell = self.flist.pyshell
+ if shell and shell.interp.debugger:
+ shell.interp.debugger.clear_file_breaks(self)
WindowList.unregister_callback(self.postwindowsmenu)
if self.close_hook:
self.close_hook()
methodname = methodname + "_event"
if hasattr(ins, methodname):
self.text.bind(vevent, getattr(ins, methodname))
-
if hasattr(ins, "menudefs"):
self.fill_menus(ins.menudefs, keydefs)
return ins
apply(text.event_add, (event,) + tuple(keylist))
def fill_menus(self, defs=None, keydefs=None):
- # Fill the menus. Menus that are absent or None in
- # self.menudict are ignored.
+ """Add appropriate entries to the menus and submenus
+
+ Menus that are absent or None in self.menudict are ignored.
+ """
if defs is None:
defs = self.Bindings.menudefs
if keydefs is None:
class PyShellFileList(FileList):
-
- # File list when a shell is present
+ "Extend base class: file list when a shell is present"
EditorWindow = PyShellEditorWindow
class ModifiedColorDelegator(ColorDelegator):
-
- # Colorizer for the shell window itself
+ "Extend base class: colorizer for the shell window itself"
def __init__(self):
ColorDelegator.__init__(self)
})
class ModifiedUndoDelegator(UndoDelegator):
-
- # Forbid insert/delete before the I/O mark
+ "Extend base class: forbid insert/delete before the I/O mark"
def insert(self, index, chars, tags=None):
try:
gid = 0
def execsource(self, source):
- # Like runsource() but assumes complete exec source
+ "Like runsource() but assumes complete exec source"
filename = self.stuffsource(source)
self.execfile(filename, source)
def execfile(self, filename, source=None):
- # Execute an existing file
+ "Execute an existing file"
if source is None:
source = open(filename, "r").read()
try:
self.runcode(code)
def runsource(self, source):
- # Extend base class to stuff the source in the line cache first
+ "Extend base class method: Stuff the source in the line cache first"
filename = self.stuffsource(source)
self.more = 0
self.save_warnings_filters = warnings.filters[:]
self.save_warnings_filters = None
def stuffsource(self, source):
- # Stuff source in the filename cache
+ "Stuff source in the filename cache"
filename = "<pyshell#%d>" % self.gid
self.gid = self.gid + 1
lines = string.split(source, "\n")
return filename
def showsyntaxerror(self, filename=None):
- # Extend base class to color the offending position
- # (instead of printing it and pointing at it with a caret)
+ """Extend base class method: Add Colorizing
+
+ Color the offending position instead of printing it and pointing at it
+ with a caret.
+
+ """
text = self.tkconsole.text
stuff = self.unpackerror()
if not stuff:
return None
def showtraceback(self):
- # Extend base class method to reset output properly
+ "Extend base class method to reset output properly"
self.tkconsole.resetoutput()
self.checklinecache()
InteractiveInterpreter.showtraceback(self)
return self.debugger
def runcommand(self, code):
- # This runs the code without invoking the debugger.
+ "Run the code without invoking the debugger"
# The code better not raise an exception!
if self.tkconsole.executing:
tkMessageBox.showerror(
return 1
def runcode(self, code):
- # Override base class method
+ "Override base class method"
if self.tkconsole.executing:
tkMessageBox.showerror(
"Already executing",
"please wait until it is finished.",
master=self.tkconsole.text)
return
-
+ #
self.checklinecache()
if self.save_warnings_filters is not None:
warnings.filters[:] = self.save_warnings_filters
self.active_seq = self.rpcclt.asynccall("exec", "runcode",
(code,), {})
return
-
+ #
try:
self.tkconsole.beginexecuting()
try:
self.showtraceback()
except:
self.showtraceback()
-
+ #
finally:
self.tkconsole.endexecuting()
def write(self, s):
- # Override base class write
+ "Override base class method"
self.tkconsole.console.write(s)
class PyShell(OutputWindow):
##sys.settrace(self._cancel_check)
def endexecuting(self):
- # Helper for ModifiedInterpreter
+ "Helper for ModifiedInterpreter"
##sys.settrace(None)
##self._cancel_check = None
self.executing = 0
self.showprompt()
def close(self):
- # Extend base class method
+ "Extend EditorWindow.close()"
if self.executing:
# XXX Need to ask a question here
if not tkMessageBox.askokcancel(
if self.reading:
self.top.quit()
return "cancel"
- return OutputWindow.close(self)
+ return EditorWindow.close(self)
def _close(self):
+ "Extend EditorWindow._close(), shut down debugger and execution server"
self.close_debugger()
self.interp.kill_subprocess()
# Restore std streams
self.auto = None
self.flist.pyshell = None
self.history = None
- OutputWindow._close(self) # Really EditorWindow._close
+ EditorWindow._close(self)
def ispythonsource(self, filename):
- # Override this so EditorWindow never removes the colorizer
+ "Override EditorWindow method: never remove the colorizer"
return 1
def short_title(self):
i = i-1
line = line[:i]
more = self.interp.runsource(line)
- # XXX This was causing extra prompt with shell KBK
-# if not more:
-# self.showprompt()
def cancel_check(self, frame, what, args,
dooneevent=tkinter.dooneevent,
def clear_break(self, filename, lineno):
msg = self.idb.clear_break(filename, lineno)
+ def clear_all_file_breaks(self, filename):
+ msg = self.idb.clear_all_file_breaks(filename)
+
#----------called by a FrameProxy----------
def frame_attr(self, fid, name):
dict = dicttable[did]
value = dict[key]
value = repr(value)
-# try:
-# # Test for picklability
-# import cPickle
-# pklstr = cPickle.dumps(value)
-# except:
-# print >>sys.__stderr__, "** dict_item pickle failed: ", value
-# raise
-# #value = None
return value
#----------end class IdbAdapter----------
"""Start the debugger and its RPC link in the Python subprocess
Start the subprocess side of the split debugger and set up that side of the
- RPC link by instantiating the GUIProxy, Idle debugger, and IdbAdapter
+ RPC link by instantiating the GUIProxy, Idb debugger, and IdbAdapter
objects and linking them together. Register the IdbAdapter to handle RPC
- requests from the split Debugger GUI via the IdbProxy.
+ requests from the split debugger GUI via the IdbProxy.
"""
gui_proxy = GUIProxy(conn, gui_adap_oid)
def clear_break(self, filename, lineno):
msg = self.call("clear_break", filename, lineno)
+ def clear_all_file_breaks(self, filename):
+ msg = self.call("clear_all_file_breaks", filename)
+
+
def start_remote_debugger(conn, pyshell):
"""Start the subprocess debugger, initialize the debugger GUI and RPC link
Request the RPCServer start the Python subprocess debugger and link. Set
up the Idle side of the split debugger by instantiating the IdbProxy,
- Debugger GUI, and Debugger GUIAdapter objects and linking them together.
+ debugger GUI, and debugger GUIAdapter objects and linking them together.
Register the GUIAdapter to handle debugger GUI interaction requests coming
from the subprocess debugger via the GUIProxy.