[Idle-dev] [ idlefork-Patches-571464 ] clearing breakpoints

noreply@sourceforge.net noreply@sourceforge.net
Wed, 19 Jun 2002 21:12:31 -0700


Patches item #571464, was opened at 2002-06-20 14:12
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=309579&aid=571464&group_id=9579

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Stephen M. Gava (elguavas)
Assigned to: Nobody/Anonymous (nobody)
Summary: clearing breakpoints

Initial Comment:
This was submitted earlier this year to idle-dev by
Edward K. Ream, but I forgot to copy it in here. Thanks
to Edward for reminding me about it.

------------------

The following patch lets the user of IDLE clear
breakpoints in
exactly the same way that they are set, that is, by
right-clicking a
source line containing a breakpoint.

(I've inserted backslashes so this doesn't get
line-breaked to death.)

1. In PyShell.py, add the following two lines,
indicated by # EKR:

    def __init__(self, *args):
        apply(EditorWindow.__init__, (self,) + args)
        self.text.bind("<<set-breakpoint-here>>",\
            self.set_breakpoint_here)
        self.text.bind("<<clear-this-breakpoint>>",\
            self.clear_this_breakpoint) # EKR
        self.text.bind("<<open-python-shell>>",
self.flist.open_shell)

    rmenu_specs = [
        ("Set breakpoint here", "<<set-breakpoint-here>>"),
        ("Clear this breakpoint",
"<<clear-this-breakpoint>>"), # EKR
    ]

2. In PyShell.py, add the following method:

    def clear_this_breakpoint(self, event=None):
        if not self.flist.pyshell or \
            not self.flist.pyshell.interp.debugger:
            self.text.bell()
            return
       
self.flist.pyshell.interp.debugger.clear_this_breakpoint(self)

3. In Debugger.py, add the following method:

    def clear_this_breakpoint(self, edit):
        text = edit.text
        filename = edit.io.filename
        if not filename:
            text.bell()
            return
        lineno = int(float(text.index("insert")))
        msg = self.clear_break(filename, lineno)
        if msg:
            text.bell()
            return
        text.tag_remove("BREAK", "insert linestart", \
            "insert lineend+1char")


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=309579&aid=571464&group_id=9579