[IPython-dev] Notebook extensions

Matthias BUSSONNIER bussonniermatthias at gmail.com
Tue Mar 26 02:52:45 EDT 2013


Hi, 

Le 25 mars 2013 à 23:39, Juergen Hasch a écrit :

> Hi,
> thank you for adding extensions to the iPython notebook. I think this is really useful.
Thanks for the feedback, 

> It allowed me to add a feature I always wanted to have in the notebook: breakpoints.
> Now I can easily set a breakpoint in a code cell and execute from the current cell to the cell with the breakpoint set.

Just FYI, in case it might be of any help,and  before I forgot, Codemirror support BreakPoint In gutter.
http://codemirror.net/demo/marker.html
If someone is motivated to activate a per line debug once Min's Stdin branch works and is merged...

> Here is the extension:
> https://gist.github.com/juhasch/5241322


> There is one question I have: Is it possible to restrict the checkboxes that are generated using CellToolbar.utils.checkbox_ui_generator() to codecells only ?


Checkbox UI generator is pretty strait forward, and is just a helper, 
https://github.com/ipython/ipython/blob/master/IPython/frontend/html/notebook/static/js/celltoolbar.js#L322

You can recode it if you want more fine grained logic. 

In you case you should be able to simply wrapped the returned function 

var helper_breakpoint = CellToolbar.utils.checkbox_ui_generator('Breakpoint',...)

var breakpoint = function(div, cell){
	if ((cell instanceof IPython.CodeCell)) { 
		return helper_breakpoint(div,cell)
	}  //else do nothing
}

I didn't test but you get the idea, 

Thanks ,keep us informed if it works. 
-- 
Matthias








More information about the IPython-dev mailing list