Following @fperez advice, change the completer apparence to avoid user confusion.
- Append what the user type in the completer in code-miror, (Almost) as if
codemirror still have focus
- distinguish between "fixed" completion part, which was sent to the kernel
(now written in bold) and filtering one,handled only in JS,that the user
can errase without dismissing the completer
I changed the action of <Space> to dismiss the completer with what have
already been typed and inserting a space instead of "picking" the currently
hilighted option
<Escape> will still dissmiss the completer and remove everything the user as
typed since the completer invocation
Note that while the completer is shown, code-mirror does not show any
blinking cursor
- dissmiss the completer, append what alredy type, **Plus** one caracter in
some cases
List of special caracter that are handle are in a given list `()[]./\-+`
for the moment. usefull for exaple when typing :
>>> np.s<tab>in(
and not having to type '(' twice.
they are handle separately has the [a-zA-Z] ones because otherwise they
will screw up the regexp, and are opt-in to avoid bugs with invisible
caracters send because some browser have 'keypress' event for meta keys
close#1080
Note to this commit :
list of test for the completer across browser with --pylab=inline flag
#test direct one completion
plt.an<tab> -> plt.annotate
#test filter,tab, only one completion
plt.a<tab>n<tab> -> plt.annotate
# test partial common beggining
# test dismmised if user erase
plt.a<tab>nn<backspace><backspace>u<tab> -> completer to `aut`
........................................<tab><tab><tab> -> nothing should append
.......................................................<backspace><backspace<backspace> -> completer cancelled
#test dismiss if no more completion
plt.s<tab>c -> completer 3 choices
...........u -> dismissed whith what user have typed. `plt.scu`
# test dismiss in no completion, special symbol
# opt-in list of caracters +-/\()[].
np<tab>.s -> a 'dot' sould dismiss the completer and be appended
.........<tab>in( -> np.sin(
np.s<tab>in[ -> np.sin[
allow the notebook to run without MathJax
adds --no-mathjax flag for disabling mathjax, and moves the mathjax URL decision to the server from the browser.
closes#1071
prototype functions were actually called which should not happen, and
resulted in objects and their attributes being passed to their own methods
as arguments.
* use jQuery syntax to construct dialog
* server determines where MathJax comes from via mathjax_url configurable (default local/CDN priority unchanged)
* add `--no-mathjax` flag for disabling mathjax in the notebook server
* A jQuery dialog with our 'no mathjax' message will appear if mathjax is unavailable, but the notebook will be fully functional after dismissal.
* Various calls to MathJax.Hub.typeset moved to Cell.typeset, which checks for MathJax existence and is a no-op without it.
closes#1071
when invoking the completer, instead of having to chose/dismiss, you can
continue typing, it will filter the result "as you type" and dismiss itself
if ther is no match left.
As it is now, it's only works with lowercase letters, I need to find a workaroud
for this.
for example
if you type :
* P-y-<tab>-S-o-m-e-t-h-i-n-g
* it will propose PySide, but will dismiss when 'o' is pressed and pasting Pyso with a lower case 's'
if completer get only one match back and the user press tab n time,
it fallbacks on showing a tooltip
n=2 , hard coded for know, and completer verbose on the command line
put "close" and "more..." button in upper right corner,
rename "more..." to "open in pager", add expand button.
tooltip don't have scroll bar an are 'small' until pressing "Expand"
they then change their height and add scrollbars.
Horizontal scrollbar behaviour seem to depend on the browser
>>> plot(<tab> and then click on "expand" :
Firefox : no horizontal scrollbar (wrap line ?)
Chrome : horizontal scrollbar
beware that don't limitting tooltip height or width through css will sometime give
tooltip that are too heigh and will overflow below the bottom of the screen
animation are broken with max-height and/or min-height
change order of completion element so that the ones ending with '='
will be at the beginning of the list. When you complete inside a
fonction call, you then have kwargs first add configuration in the left
pannel
add a section in the left pannel of the notebook to make the time before
triggering a tooltip when pressign "(" configurable. Negative values will
disable the tooltip (comparaison at each keypress for now, but can be
improved) The syle of the <input> field should be a little improve, why not
a slider with jquerry
As until now, when pressing tab and a white space was preceding the cursor
The completion was triggerd with the whole namespace in it. Now if a
whitespace or an opening bracket is just befor the cursor it will try to
display a tooltip. The logic to find what object_info_request is send have
been sightly changed to try to match the expression just before the last
unmached openig bracket before the cursor (without considering what is
after the cursor).
example (_|_ represent the cursor):
>>> his_|_<tab> # completion
>>> hist(_|_<tab> # tooltip on hist
>>> hist(rand(20),bins=range(_|_ <tab> #tooltip on range
>>> hist(rand(20),bins=range(10), _|_ <tab> # tooltip on hist (whitespace before cursor)
>>> hist(rand(20),bins=range(10),_|_ <tab> # completion
as we dont care of what is after the cursor:
>>> hist(rand(5000), bins=50, _|_orientaion='horizontal') # and tab, equivalent to
>>> hist(rand(5000), bins=50, _|_<tab> # onte the space again
>>> hist(_|_rand(5000), bins=50, orientaion='horizontal') # and tab, equivalent to
>>> hist(_|_
the 4 give tooltip on hist
note that you can get tooltip on things that aren't function by appending a
'(' like
>>> matplotlib(<tab>
Which is kinda weird... so we might want to bound another shortcut for
tooltip, but which matches without bracket...
additionnaly I have added a "Config" pannel in the left pannel with a checkbox
bind to wether or not activate this functionnality
Note, (rebase and edited commit, might not work perfetly xwithout the following ones)
When user press '(' and nothing for 1200ms, 'object_info_request' sent to
the kernel. Then tooltip with 'definition' and beggining of 'docstring'
shown to the user if non empty response.
Unlike Completion <select> , <div> is not focusable so event handled in main
cell event handeling function
Add some CSS3 that most browser with websocket should support.
ZMQStream is the right object to use for event-driven handling of messages, but instead we chose to rewrite half of it in KernelManager.
This removes most of the duplicate code, in favor of using ZMQStream.
also use the pyzmq install() function for using pyzmq with tornado, instead of manually pasting its contents in notebook app.
An error would previously be raised whenever iopub traffic arrived that
did not originate with the notebook (e.g. pylab welcome, or qtconsole output).
This error was not in a block that would actually cause problems, so actual
functionality was not affected.
Most int traits are now Integers
Integer differs from Long only in that small `long`s are cast to `int`, rather than
all `int`s being cast to `long`:
Integer(4L) => 4
Long(4) => 4L
closes gh-942, closes gh-996.
Rebased to avoid recursive merge for just one commit.
Websocket fixes:
1. alert client on failed and lost web socket connections
A long message is given if the connection fails within 1s, which assumes the connection did not succeed. Otherwise, it is a short 'connection closed unexpectedly'.
This also means that clients are notified on server termination (for better or worse).
2. remove superfluous ws-hostname parameter from notebook
This made the notebook server artificially and unnecessarily brittle against tunneling and explicit hostname resolution. Now, the ws_url is defined based on the Origin of the request for the url, so it always matches the http[s] url. This means that it will follow the same tunnel, and the hostname will be already resolved. Resolving the hostname twice makes no sense at all unless the websockets are going to a different server than the http requests.
Implemented as a property, so it should still be easy to change for future cases where it might behave differently (e.g. websockets on a different host, or at a non-root url).
A long message is given if the connection fails within 1s. Otherwise, it is a short 'connection closed unexpectedly'.
This also means that clients are notified on server termination.
This made the notebook server artificially and unnecessarily brittle to tunneling, and non-local hostname resolution. The ws_url is now defined based on the Origin of the request. This allows tunneled hosts and ports to preserve connections, as the ws_url always matches the one in use by the client.
Implemented as a property, to facilitate future cases where it might behave differently.
The notebook now supports a `--read-only` flag, which allows users to view all notebooks being served but not to edit them or execute any code. These actions are not allowed and the buttons, shortcuts, etc. are removed, but the requests will raise authentication errors if they manage to send the events anyway. Save/print functions remain available.
This flag can be used in two modes:
1. When running an unauthenticated server, one can run a *second* read-only server in the same directory on a public IP address. This will let users connect to the read-only view without having to worry about configuring passwords and certificates for the execution server.
2. When running a server configured with authentication (and hopefully an SSL certificate), starting it with `--read-only` allows unauthenticated users read-only access to notebooks. This means that the same server on a single port can be both used by authenticated users for execution and by the public for viewing the available notebooks.
Show invalid config message on TraitErrors during initialization.
implemented via `@catch_config` decorator
Now, the event that was triggered by invalid app config (see `--log-level 5`) is triggered by bad config at any point during initialization.
This *will* catch TraitError-raising bugs in IPython itself, but only during initialization.
Also, deregister crash handler on use to avoid it being triggered recursively/repeatedly.
If a user has Chrome set as their default browser (system-wide or via
the `BROWSER` environment variable), opening the notebook hangs
because the chrome call doesn't return immediately. This solves the
issue by opening the browser in a thread.
Note that there remains an issue where killing the notebook will kill
Chrome if the Chrome session was started by us. I haven't found a way
to work around that despite attempts by making the webbrowser.open()
call in a subprocess.
When using a password, read-only mode allows unauthenticated users
read-only access to notebooks. Editing, execution, etc. are not
allowed in read-only mode, but save/print functions are available.
No kernels are started until an authenticated user opens a notebook.
implemented via @catch_config decorator
Now, the event that was triggered by invalid app config (see `--log-level 5`) is triggered by bad config at any point during initialization.
This *will* catch TraitError bugs in IPython itself, but only during initialization.
closes gh-908
The History will always appear empty, so history magics, etc. don't do anything. Readline history for a single session works fine.
Test suite should now pass without sqlite
Adding clear_output to kernel and HTML notebook.
This enables the clearing of output during the execution of a cell. It can be used for simple forms of animation in the notebook.
All buttons, show/hide clickable areas, etc. should have some tooltip describing
what they do. There are jQuery plugins for enhanced tooltips, but this gets
the lightest version working.
closes#436
Various Notebook usability fixes:
- add kernel restart dialog confirmation (it destroys the user session)
- add missing keybindings
- change language from 'terminal mode' to 'in-place execution' which is more descriptive
- adjust spacing/padding and colors slightly for readability and better use of space in small screens.
- add line numbering toggle to code cells. Triggered with C-m-l.
- show keybindings in monospaced font.
- add QuickHelp button that is always visible and at the top.
- add missing keybindings for kernel interrupt/restart from the kbd.
Now multiple calls no longer show multiple instances of the shortcut dialog. Rather, clicking the quick help, or invoking `C-m h` will hide
the dialog if shown.
Update codemirror to 2.15 and make the code internally more version-agnostic.
Added our own README file with information about what changes we carry to upstream CodeMirror and what version we currently use.
This is separate from previous, because it is more likely to be rejected.
It requires the the Session objects in Handlers get a reference all the way back up to the IPython App that started the environment.
stdin requests are now directed to the frontend that made the execution
request that called raw_input.
allow_stdin flag added to execution_request to indicate whether stdin_requests are allowed.
StdInNotImplementedError exception class added to IPython.core.error, and is raised if raw_input is called from execute requests where allow_input is undefined.
closes gh-673
Simply call it 'codemirror', so we don't have explicit version numbers
inside a bunch of files.
A file called ipython-version-N.NN will be kept to easily let us know
which version we're shipping with IPython.
Several improvements to stdout/stderr handling and visual layout of cells.
Now stdout and stderr are kept contiguous (in a single div) if they are being written to continuously, and stderr is shown with a light red background to help distinguish from stdout.
Further, input cells now have a light gray background to help distinguish them from plain stdout areas.
* add think border around input area
* change background instead of foreground on stderr
* only stderr/stdout are output_stream, general text (including streams) is output_text
* reduce vertical padding on stream output, per @fperez
Consecutive messages to stdout or stderr will not be split
into separate divs, until a new message to different stream
arrives.
Appending will only occur when the latest output is the same
as the new one. Interleaving messages will still result in
multiple divs.
* test_for uses import_item, instead of __import__
* test_for now allows a callback, for processing the result of import_item prior to comparison with min_zmq
* callback is only called when min_zmq is defined
* callback's default is to just return mod.__version__
* use this to check tornado version, and zmq as a version tuple
* fix pexpect check to use external.pexpect
These messages are not returned to the browser, but are printed
to the server logs and will help the code readability.
I have also used a more specific code in some cases.
We were having problems with notebook renaming when using uuid5,
as there are many places in the code where we assume that the
notebook id is unique and unchanging as long as the notebook
server runs.
* It seems that our old setting of visible was causing scroll bars
to appear if font sizes change in Chrome.
* Also changed json -> xml in Download UI.
* I have added page-break-inside logic to div.input and
div.output_area.
* Fixed a bug in CodeCell that was putting the output_area class
on the wrong div.
I had removed a text area focus event earlier today and that
broke the . key. We are still having problems with CodeMirror
elements gaining focus, but this seems to fix the issue.
* Favicon.ico is served.
* Test suit now passes.
* Help links work for for me.
* Other changes made to address inline comments.
* The printing of long lines is an extremely subtle issue and I will open an issue for it.
* zmqws.py is completely gone so the naked print is not an issue.
* ipython-notebook removed from scripts.
* Updated copyright and authors of files.
* Fixed missing docstrings in IPython.nbformat.
IPDoctest replaces the normal doctest plugin. Previously we did this by
initializing the builtin plugins but skipping the doctest plugin.
However, if the user has a noserc file with 'with-doctest=1' or the
environment variable 'NOSE_WITH_DOCTEST', then nose will try and
initialize the doctest plugin when it isn't there, and barf. This
commit defers the removal of the doctest plugin to the configuration
stage, so doctest can be enabled before it is thrown away by us.
* Previously, when a kernel died due to an external cause, the
notebook/kernel mapping was not removed, so the kernel would
be resused even though it was dead.
* The heartbeat now properly removes the notebook/kernel mapping.