Commit Graph

1077 Commits

Author SHA1 Message Date
Fernando Perez
ac548bd8bc Merge pull request #1711 from ipython/tooltipCompleterJSRefactor
New Tooltip, New Completer and JS Refactor.

This is a major reworking of lots of notebook client code, both introducing new features and allowing certain things to be done more cleanly:

- New graphical tooltip with keyboard control: successive presses of the TAB key will expand it, pin it for 10 s (a clock icon is shown), and send its content to the bottom help pager (which is now resizable).

- Completer has been refactored into a new class and now can analyze the current cell to support completions on objects that don't exist in the kernel yet (because the cell hasn't been executed).

- All the client-side JavaScript has been decoupled to ease reuse of parts of the machinery without having to build a full-blown notebook. This will make it much easier to communicate with an IPython kernel from existing web pages and to integrate single cells into other sites, without loading the full notebook document-like UI.

- This refactoring also enables the possibility of writing dynamic javascript widgets that are returned from Python code and that present an interactive view to the user, with callbacks in Javascript executing calls to the Kernel.  This will enable many interactive elements to be added by users in notebooks.  

An example of this capability has been provided as a proof of concept in `docs/examples/widgets` that lets you directly communicate with one or more parallel engines, acting as a mini-console for parallel debugging and introspection.

Closes #1498.
2012-05-31 17:25:17 -07:00
Brian Granger
4c31453ea7 Making Notebook.set_dirty an event so CodeCell can set it.
This allows code outside notebook.js to set the dirty flag, but
doesn't require that code depend on notebook.js.
2012-05-31 13:29:22 -07:00
Brian Granger
9826a17ae2 Removing cell from execute callbacks in kernel.js. 2012-05-31 13:24:10 -07:00
Brian Granger
e817bfdaeb Update directview.ipynb & allowing no-callbacks in kernel.execute. 2012-05-31 13:08:34 -07:00
Brian Granger
94b24d6ac9 Moving direct view widget to docs/examples. 2012-05-31 13:08:33 -07:00
Brian Granger
9c94c996ae Removing extra call to Kernel.stop_channels. 2012-05-31 13:08:33 -07:00
Takafumi Arakaki
0df931d69a Reduce repeated code regarding restarting events 2012-05-31 13:08:33 -07:00
Takafumi Arakaki
db5393c618 Clear window title when kernel is restarted
When kernel is died and restarted, or restarted while it is in the
busy state, message "(Busy)" on the window title is not updated.  This
problem is fixed by updating document title when restarting.
2012-05-31 13:08:32 -07:00
Matthias BUSSONNIER
9f319f6da9 click on close cancell stick 2012-05-31 13:08:32 -07:00
Matthias BUSSONNIER
366cba5916 retab tab to space 2012-05-31 13:08:32 -07:00
Matthias BUSSONNIER
523ae0c377 fix tooltip keep focus on wrong cell
check that the cell the tooltip is giving focus back is the currently
selected cell
2012-05-31 13:08:31 -07:00
Matthias BUSSONNIER
a083ce93c1 remove less.css 2012-05-31 13:08:31 -07:00
Matthias BUSSONNIER
c06f5b1718 rename show/hide methods to avoid jQuery conflict.
it seem that show and hide methods fron tooltip where collinding with
jquery, sometime blocking the notebook.

Move from css fadeIn/Out to jQuery fade In/Out, and replace
addRemoveClass by fadeIn/fadeOut
2012-05-31 13:08:30 -07:00
Matthias BUSSONNIER
3dc363e1e8 Revert "remove less file"
This reverts commit 8af188d9be201f0dfaea86746705f5ff8b13ab50.
2012-05-31 13:08:30 -07:00
Brian Granger
8bd7e041cf Misc fixes to the code cell and output area. 2012-05-31 13:08:30 -07:00
Brian Granger
32343c5973 Fixed order of notebook loading and kernel starting.
For security reasons, the kernel should not be started until
after the notebook content is completely loaded and on the page.
This prevents people from creating notebooks that run nasty code
on the users machine at load time.

In order to implement this, we had to create a CodeCell.set_kernel
method that allows the kernel attribute of a CodeCell to be set
at a later time.  This also fixes some error messages we were
seeing related to the kernel's channels not being setup properly
when a send was attempted.
2012-05-31 13:08:29 -07:00
Matthias BUSSONNIER
186c995041 rename context-hint to contexthint 2012-05-31 13:08:29 -07:00
Matthias BUSSONNIER
88befeb497 space after function keyword in context-hint 2012-05-31 13:08:29 -07:00
Matthias BUSSONNIER
b1e5e99bcd beautify context-hint.js 2012-05-31 13:08:28 -07:00
Matthias BUSSONNIER
129f114868 Uppercase constant keycode in utils.js 2012-05-31 13:08:28 -07:00
Matthias BUSSONNIER
f3ff31b75a remove CamelCasse methods from completer.js 2012-05-31 13:08:28 -07:00
Matthias BUSSONNIER
b2a04396d8 space before function keyword in js 2012-05-31 13:08:27 -07:00
Matthias BUSSONNIER
ea325c095b beautify completer.js 2012-05-31 13:08:27 -07:00
Matthias BUSSONNIER
0f34ca4346 beautify tooltip.js 2012-05-31 13:08:27 -07:00
Matthias BUSSONNIER
27be46264a remove less file 2012-05-31 13:08:27 -07:00
Matthias BUSSONNIER
8d5d2d2446 shrink less and css, typo in css 2012-05-31 13:08:26 -07:00
Matthias BUSSONNIER
d823325be4 make sticky time configurable 2012-05-31 13:08:26 -07:00
Matthias BUSSONNIER
7d069cd792 Notification + tooltip demo
Use notification to quicky remind use of the tooltip

Use javascript in notebook to make a live demo in
01_notebook_introduction

tooltip docstring is remplaceid for the first use by a live tutorial
2012-05-31 13:08:26 -07:00
Matthias BUSSONNIER
c804c036ec tooltip, pager bring pager
execute xxxx? on behalf of the cell to bring the pager.
2012-05-31 13:08:25 -07:00
Matthias BUSSONNIER
b1a9677cc0 fix less css 2012-05-31 13:08:25 -07:00
Matthias BUSSONNIER
370b723cb6 Revert "remove less CSS"
This reverts commit 185c4ee21a4b658b55d313d1813a5bfeccaa20ef.
2012-05-31 13:08:25 -07:00
Brian Granger
644b1f85ed Fixing bug in prompt_area handling of OutputArea. 2012-05-31 13:08:25 -07:00
Brian Granger
6268e0a4b1 Removing stale code in CodeCell. 2012-05-31 13:08:24 -07:00
Brian Granger
fd4ecebc9d Adding missing var statements in notebook.js. 2012-05-31 13:08:24 -07:00
Brian Granger
b274a86b8c Adding back kernel dead choice for user.
I had removed the choice for the user to not restart a dead kernel
but we are using that elsewhere. Eventually we may not give them
a choice, but for now we will use that model.
2012-05-31 13:08:23 -07:00
Brian Granger
ae2bea23fa Refactored CodeCell to use new OutputArea object for output.
This allows us to have a reusable object for formatting output.
Javascript widgets can now use this to format output as well.
2012-05-31 13:08:23 -07:00
Brian Granger
f306423c7e Adding options to Kernel.execute with a default of silent=true. 2012-05-31 13:08:22 -07:00
Matthias BUSSONNIER
2976d8ea10 fix multiple busy in title bar due to completer 2012-05-31 13:08:22 -07:00
Matthias BUSSONNIER
7301213124 simplify completer logic as we don't exec on behalf of cell
also skip making kernel completion request if kernel is busy
2012-05-31 13:08:22 -07:00
Matthias BUSSONNIER
e8632ff7ee clean code, show clock if tooltip is 'sticky'
- make code more concise
- remove trailing space
- add some animation
- put some function/variable private with leading underscore
2012-05-31 13:08:22 -07:00
Matthias BUSSONNIER
8f33caf0dc make tooltip tabs fonction configurable 2012-05-31 13:08:21 -07:00
Matthias BUSSONNIER
bf5cf0dd3a move some tooltip logic away from codecell.js 2012-05-31 13:08:21 -07:00
Matthias BUSSONNIER
98303f5f7d Clean code, retab and minor fix
remove unused code, convert some tab to space, and correct some
semicolon according to jslint

jlint fixes
2012-05-31 13:08:21 -07:00
Matthias BUSSONNIER
a280495173 remove less CSS 2012-05-31 13:08:21 -07:00
Brian Granger
0d6a698688 Major refactoring of the Notebook, Kernel and CodeCell JavaScript.
* Kernel doesn't depend on Notebook or CodeCell.
* CodeCell doesn't depend on Notebook, only Kernel.
* All of the kernel management logic has been moved out of the
  Notebook into the Kernel.
* Public methods of the Kernel (execute, complete, etc) take
  a callbacks object that registers the callbacks for that msg.

(rebased, cherrypicked, by Bussonnier Matthias <bussonniermatthias@gmail.com>)
(and tabs removed)

Conflicts:

	IPython/frontend/html/notebook/static/js/codecell.js
	IPython/frontend/html/notebook/static/js/completer.js
	IPython/frontend/html/notebook/static/js/tooltip.js
2012-05-31 13:08:20 -07:00
Matthias BUSSONNIER
94d8683400 allow number in tokens 2012-05-31 13:08:20 -07:00
Matthias BUSSONNIER
068a60a8b7 fix print view
construct a completer only if the class exist
otherwise print view won't load.
2012-05-31 13:08:20 -07:00
Matthias BUSSONNIER
507a66235b fix typo that->this 2012-05-31 13:08:20 -07:00
Matthias BUSSONNIER
b6fcb806d6 fix cancel_stick typo 2012-05-31 13:08:20 -07:00
Matthias BUSSONNIER
d7b42270ee remove console.log 2012-05-31 13:08:20 -07:00