Jed, do you think this patch is an acceptable solution to issues
849<https://code.google.com/p/spyderlib/issues/detail?id=849&q=MS%3Dv2.3&colspec=ID%20MS%20Stars%20Priority%20Modified%20Cat%20Type%20Status%20Owner%20Summary>
and
609<https://code.google.com/p/spyderlib/issues/detail?id=609&q=MS%3Dv2.3&colspec=ID%20MS%20Stars%20Priority%20Modified%20Cat%20Type%20Status%20Owner%20Summary>
?
Cheers,
S.
On Tuesday, April 2, 2013 2:33:05 PM UTC-4, Doug Bonar wrote:
>
> Cool, I'll make the change in my copy. Personally, I can't really imagine
> having more than one debugger session active at a time, but better to keep
> them in sync.
>
> Doug
>
>
> On Tuesday, April 2, 2013 2:28:47 PM UTC-4, Sylvain Corlay wrote:
>>
>> Awesome!
>> It works for me.
>>
>> The only limitation is that it does update the breakpoint list only in
>> the console that has the focus. If another console has a debugging session
>> ongoing, its breakpoints will not be updated.
>>
>> A way to solve this is to replace
>>
>> * shellwidget = self.tabwidget.currentWidget() *
>> * if shellwidget is not None:*
>> * shellwidget.shell.reload_breakpoints( filename )*
>>
>> by
>> * for shellwidget in self.shellwidgets:*
>> * shellwidget.shell.reload_breakpoints( filename )*
>>
>> in your patch.
>>
>> Sylvain
>>
>> On Tuesday, April 2, 2013 11:17:02 AM UTC-4, Doug Bonar wrote:
>>>
>>> In case it might be useful to someone in a more informal form than a
>>> diff, here are the extracted changes as lines of code.
>>>
>>> ---------------------------------------
>>>
>>> #
>>> # Two pieces which allow the monitor to trigger reloading breakpoints.
>>> #
>>>
>>> *In monitor.py*
>>>
>>> In Monitor add a function
>>>
>>> def reload_breakpoints(self, file):
>>> if not self.pdb_obj:
>>> return
>>> # command defined and patched into place in sitecustomize.py
>>> self.pdb_obj.reload_spyder_breakpoints( file )
>>>
>>> and, in Monitor.__init__ register it
>>>
>>> "reload_breakpoints":self.reload_breakpoints,
>>>
>>>
>>> *sitecustomize.py*
>>>
>>> In SpyderPdb, add in the function for the monitor to use.
>>>
>>> def reload_spyder_breakpoints(self, filename):
>>> # TODO, fix this so that it just adds/removes the diffs, not all
>>> bps
>>> from spyderlib.config import CONF
>>> filename = self.canonic(filename)
>>>
>>> self.clear_all_file_breaks( filename )
>>>
>>> # load in new ones
>>> CONF.load_from_ini()
>>> if CONF.get('run', 'breakpoints/enabled', True):
>>> breakpoints = CONF.get('run','breakpoints', {})
>>> for fname, data in breakpoints.iteritems():
>>> fname = self.canonic(fname)
>>> if filename == fname: # add it
>>> for linenumber, condition in data:
>>> self.set_break(fname, linenumber,
>>> cond=condition)
>>>
>>>
>>> #
>>> # And three pieces which set it up so that the editor will trigger the
>>> loading
>>> #
>>>
>>> *plugins/editor.py*
>>>
>>> In Editor.save_breakpoints, add a final line
>>>
>>> self.emit(SIGNAL("reload_spyder_breakpoints(QString)"), filename)
>>>
>>>
>>> *externalconsole.py*
>>>
>>> In ExternalConsole.register_plugin, add a new registration
>>>
>>> self.connect(self.main.editor,
>>> SIGNAL("reload_spyder_breakpoints(QString)"),
>>> self.reload_spyder_breakpoints)
>>>
>>> and in ExternalConsole add the appropriate function
>>>
>>> def reload_spyder_breakpoints(self, filename):
>>> # ? Basically, works when the debugger is the top external
>>> console
>>> # BTW, could do shellwidget.shell.ask_monitor(...)
>>> # but the style seems to be to let the shell take care off
>>> # asking the monitor.
>>> shellwidget = self.tabwidget.currentWidget()
>>> if shellwidget is not None:
>>> shellwidget.shell.reload_breakpoints( filename )
>>>
>>>
>>> *pythonshell.py*
>>>
>>> In ExtPythonShellWidget, add the function to ask the Monitor
>>>
>>> def reload_breakpoints(self, file):
>>> return self.ask_monitor("reload_breakpoints(r'%s')" % file)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, April 2, 2013 10:35:39 AM UTC-4, Doug Bonar wrote:
>>>>
>>>> My local version has some other changes as well, plus in only on
>>>> 2.1.11. I'll try doing the same thing in a clean, newer version over the
>>>> weekend.
>>>>
>>>> On Monday, April 1, 2013 6:41:52 PM UTC-4, Sylvain Corlay wrote:
>>>>>
>>>>> Great, could you share your patch? I would be interested to test it.
>>>>> S.
>>>>>
>>>>> On Monday, April 1, 2013 11:43:38 AM UTC-4, Doug Bonar wrote:
>>>>>>
>>>>>> I ended up just adding a bit to my local version.
>>>>>>
>>>>>> I added a new signal, 'reload_spyder_breakpoints(filename)' to
>>>>>> plugins/editor.py and caught it in externalconsole.py. That then looks
>>>>>> at
>>>>>> the current tab widget and asks its monitor to run a new function I
>>>>>> patched
>>>>>> into SpyderPdb in sitecustomize.py. It touches 4 files, but it didn't
>>>>>> seem
>>>>>> too hideous.
>>>>>>
>>>>>> For now, my patched in function is just clearing all breakpoints for
>>>>>> the file using Pdb's clear_all_file_breaks( filename ) and then loading
>>>>>> the
>>>>>> ones from CONF as the existing set_spyder_breakpoints does. If I get
>>>>>> ambitious, I might change that to leave the ones that are unchanged in
>>>>>> place (matching of file, line & condition string) since right now the
>>>>>> numbering of all breakpoints in the file changes when you adjust any
>>>>>> one.
>>>>>> But it is a start.
>>>>>>
>>>>>> Doug
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thursday, March 7, 2013 4:55:59 PM UTC-5, Doug Bonar wrote:
>>>>>>>
>>>>>>> Thanks Jed. Not the answers I wanted to hear, but glad to know I
>>>>>>> wasn't missing anything.
>>>>>>>
>>>>>>>
>>>>>>> On Wednesday, March 6, 2013 5:41:37 PM UTC-5, Doug Bonar wrote:
>>>>>>>>
>>>>>>>> Can I set the graphically?
>>>>>>>>
>>>>>>>> In spyderlib/plugins/editor.py I see breakpoint related actions
>>>>>>>> being set up, but I can't find the breakpoint_menu anywhere as an
>>>>>>>> actual UI
>>>>>>>> widget. That said, F12 does put a dot in the edge of the file --
>>>>>>>> looks
>>>>>>>> like it should be a breakpoint. Unfortunately, it I start the
>>>>>>>> debugger,
>>>>>>>> then create a breakpoint, the debugger doesn't seem to see it.
>>>>>>>>
>>>>>>>> So, a 2-part question.
>>>>>>>> 1) Is there some way other than F12 to set breakpoints?
>>>>>>>> 2) Is there a way to add a breakpoint while the debugger is
>>>>>>>> running?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.