[IPython-dev] [PATCH] Jumpy notebook fixes

Brian Granger ellisonbg@gmail....
Mon Jun 4 14:26:31 CDT 2012


Bob,

Thanks for this - we have been meaning to look at this.  Can you open
a pull request on github so we can review it there.

Thanks!

Brian

On Mon, Jun 4, 2012 at 12:03 PM, Bob McElrath <bob+ipython@mcelrath.org> wrote:
> I was bothered that in a number of different circumstances, the contents of the
> Notebook would "jump".  For instance, when I focus on different cells in the
> notebook, the text would jump over and down by 1px due to the added border.  The
> menu bar has the same problem.  Also, clicking on a large cell that is partially
> off screen would cause the window to recenter on its input cell, making it
> difficult to select or examine part of a long output cell.
>
> So attached is a tiny patch for these problems.  (against git head)
>
> Explanation:
>
> Menu: the menu items need a 1px border so that when one is added by jQuery, the
> menu item doesn't shift by 1px.  (ui-menu and ui-menu-item classes)
>
> Cell focus: The jQuery class .ui-widget-content draws the border on the focused
> cell, but the unfocused cell doesn't have a border, causing 1px jumping.  The
> solution is to add a border for it, but then this will have higher specificity
> than the jQuery class.  So I also added a redefinition of the focused cell
> border with div.ui-widget-content, which has higher specificity.  A selected
> cell was additionally getting an outline from jQuery when :active.  I also
> disabled this by setting 'outline: none', to prevent flashing of the border when
> a cell is clicked on.
>
> Cell focus scrolling: The CodeMirror focus() call causes the window to scroll to
> the CodeMirror input cell.  I removed this call from CodeCell.prototype.select()
> and RawCell.prototype.select().  Additionally, the CodeMirror refresh() call is
> only required if the input cell changes and must be redrawn.  This doesn't
> happen on focus, it happens on edit, and refresh() is properly called in
> TextCell.prototype.edit(), so isn't required in select().  I removed these
> superfluous refresh() calls too.
>
> In the future I'll use git, because I anticipate doing more work on IPython, but
> for this tiny first patch, I thought I'd send it here.
>
> Aside: nice job guys, you've managed to get me to do real mathematical work in
> something other than Maple.  I *love* the IPython Notebook.  I've been cursing
> and screaming at Maple/Mathematica, wanting something like the IPython notebook
> for *years*.  (Some years ago I wrote an Axiom/TiddlyWiki "notebook"-like
> interface that's very similar to your notebook, but didn't have the time/energy
> to take it further)  If anyone is interested in a TiddlyWiki/IPython
> combination, talk to me.
>
> --
> Cheers, Bob McElrath
>
> "The individual has always had to struggle to keep from being overwhelmed by
> the tribe.  If you try it, you will be lonely often, and sometimes frightened.
> But no price is too high to pay for the privilege of owning yourself."
>    -- Friedrich Nietzsche
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com


More information about the IPython-dev mailing list