Skip to content

New Tooltip, New Completer and JS Refactor #1711

Merged
merged 84 commits into from Jun 1, 2012

7 participants

@Carreau
IPython member
Carreau commented May 7, 2012

On request of @ellisonbg, I pushed a branch that regroups 2 others PR : #1509 (New tooltip and Completer) #1697 (JS refactor) that were conflicting and both changing some logic.

This makes the 2 compatible and working... It still need some spring cleaning to be sure there is no orphan methods, useless code or simplification possible due to new JS refactoring.

@ellisonbg
IPython member

OK thanks for creating this branch. I am going to be working in it directly over the next few days.

@Carreau Carreau referenced this pull request May 8, 2012
Closed

New tooltip for notebook #1509

@ellisonbg
IPython member

@Carreau how do you want to work on this branch so we don't step on each other. I could spend a day or so working on my parts and reviewing your and then you could work on yours. How does that sound?

@Carreau
IPython member
Carreau commented May 8, 2012

@ellisonbg, I can also push on my repository and send you PRs.
Eventually rebasing before pushing on ipython.
In any case I push some commit in a few minutes, and after I'm almost done (for now) on my part.
And if you need I'm syncin my computers through https://github.com/Carreau/ipython/tree/tooltipCompleterJSRefactor

@ellisonbg
IPython member
@Carreau
IPython member
Carreau commented May 8, 2012

Pushed 2h ago. Sorry, it starting to be late here, won't work on it for at least 18h.
I'll make my next change by PR.

@ellisonbg
IPython member
@Carreau
IPython member
Carreau commented May 8, 2012

Thanks to you for the new JS interface to communicate with the kernel, it's great, and for all the notebook in general.
When I'll have time later I'll try to comment/document more what I've done.

@ellisonbg
IPython member

@minrk, OK I have added the options to Kernel.execute with silent=true the default. I have tested your callbacks notebook and it no longer increments the prompt number so it is working properly. Oh and BTW, I love the callbacks notebook!

@Carreau Carreau commented on the diff May 9, 2012
IPython/frontend/html/notebook/static/js/kernel.js
return msg.header.msg_id;
};
- Kernel.prototype.complete = function (line, cursor_pos) {
+ Kernel.prototype.complete = function (line, cursor_pos, callbacks) {
+ // When calling this method pass a callbacks structure of the form:
+ //
+ // callbacks = {
+ // 'complete_reply': complete_reply_callback
+ // }
+ //
@Carreau
IPython member
Carreau added a note May 9, 2012

I was wondering, as there is only one argument for the callbacks, could we not directly build it ourself and use complete_reply_callback as an argument of the function ? We can even support both by looking at wether the third argument given to the function has a complete_reply key or not...

Same for object_info_request I think

@ellisonbg
IPython member
ellisonbg added a note May 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg
IPython member

@Carreau some feedback on the tooltip:

First, some related to the visual consistency:

  • I think the tooltip needs to have a solid (non-gradient) background. Reading text on a gradient bg is visually distracting. We should find a neutral solid color that matches our theming.
  • The amount of corner rounding on the tooltip popup is too much given how other elements have their corners rounded. We should use something closer to what the rest of our page has.
  • The shadow of the tooltip should more closely match that used by the menus in the menu bar.
  • The small icons in the upper right corner have a right padding of 15 px. This should be reduced a small amount.

Some related to the different modes:

  • I don't understand what the third mode is when the clock/watch appears. It doesn't look any different from the 2nd mode. Can you clarify.
  • You used to be able to open the help in the pager by pressing tab another time. That seems to have gone away.
  • I think having a simpler model with only 3 modes might make sense: 1) default small mode 2) expanded mode 3) pager mode.
@Carreau
IPython member
Carreau commented May 9, 2012

First, some related to the visual consistency:

I think the tooltip needs to have a solid (non-gradient) background. Reading text on a gradient bg is visually distracting. We should find a neutral solid color that matches our theming.
The amount of corner rounding on the tooltip popup is too much given how other elements have their corners rounded. We should use something closer to what the rest of our page has.
The shadow of the tooltip should more closely match that used by the menus in the menu bar.

Changed, cf screenshot

The small icons in the upper right corner have a right padding of 15 px. This should be reduced a small amount.
Some related to the different modes:

Tested on Chrome or safari osx I guess... on firefox and other OS you get a scrollbar in those 15 pixels if the text is longer than the pager
15px and scrollbar

The scroll bar is hidden when tooltip is not expanded so I can remove those 15px then, but I have to add them it is expanded, otherwise it overlaps and clicking on the 'cross+scrollbar' get weird and have unexpected behaviour. I havent found any good ways to 'detect' the scrollbar.

I don't understand what the third mode is when the clock/watch appears. It doesn't look any different from the 2nd mode. Can you clarify.

Sure, when the clock is there you can continue typing and the pager don't dismiss for 10s (I call it sticky mode)

plot(<tab><tab><tab> I can continue typing and plot docstring stays for 10s

Unless of course, I ask for tooltip on another function.

You used to be able to open the help in the pager by pressing tab another time. That seems to have gone away.
That's strange indead, i'll fix it, it should be 4 tab press...

I think having a simpler model with only 3 modes might make sense: 1) default small mode 2) expanded mode 3) pager mode.

So do I keep "sticky mode" and "15px" ?

@Carreau
IPython member
Carreau commented May 9, 2012

Pager problem updated on my branch with same name as this one.

@ellisonbg
IPython member
@ellisonbg
IPython member

OK I tested out your branch and the tooltip looks pretty good. The behavior is pretty smooth and intuitive and the visual look is clean. When you are ready, can you submit a PR against this branch and I will merge it in. I will have further comments coming though.

@ellisonbg ellisonbg and 1 other commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/css/tooltip.css
@@ -0,0 +1,139 @@
+/**
+ * Primary styles
+ *
+ * Author: IPython Development Team
+ *
+ * We'll try to get something prety, so we
+ * have some strange ccs to have the scroll bar on
+ * the left of the left with fix button on the top right of the tooltip
+ */
+@-moz-keyframes fadeOut {
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

jQuery/jQueryUI have the ability to animate css properties, can we use that instead of this css? I think it will give us better cross browser coverage. If you don't think it makes sense that is fine, but at least look at it.

@Carreau
IPython member
Carreau added a note May 10, 2012

Well when supported css3 is native, so much faster and less load on JS VM. And as tooltip fading is not that important I thought it was a good trade not o have it if not supported... I can try with jquery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on the diff May 10, 2012
IPython/frontend/html/notebook/static/css/tooltip.css
@@ -0,0 +1,139 @@
+/**
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

I like the idea of each widget having its own css file. Can you put a blank line between each css class?

@Carreau
IPython member
Carreau added a note May 10, 2012

About CSS, I'm using less, so this css is a compiled version I can put blanc line by hand, but i'll have to do it at every compile time.

Do you think using less ore something similar could be an good idea as you can use variable in CSS for color, or properties and anything ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on the diff May 10, 2012
IPython/frontend/html/notebook/static/js/utils.js
@@ -91,11 +91,31 @@ IPython.utils = (function (IPython) {
}
};
+ // some keycodes that seem to be platform/browser independant
+ var keycodes ={
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

Can we follow PEP8 style names like left_arrow, right_arrow, etc. Even though this is JS, I have been following PEP8 in the Javascript as much as possible. Or maybe for these things it would make sense to use all caps: BACKSPACE, TAB, ENTER to emphasize that these are constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg and 1 other commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/css/tooltip.css
+ -webkit-animation: fadeOut 800ms;
+ -moz-animation: fadeOut 800ms;
+ animation: fadeOut 800ms;
+ -webkit-animation: fadeIn 800ms;
+ -moz-animation: fadeIn 800ms;
+ animation: fadeIn 800ms;
+ vertical-align: middle;
+ background-color: #f7f7f7;
+ background-image: -webkit-linear-gradient(center bottom, #d7d7d7 13%, #d2d2d2 39%, #e3e3e3 56%, #f7f7f7 91%);
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(13%, #d7d7d7), color-stop(39%, #d2d2d2), color-stop(56%, #e3e3e3), color-stop(91%, #f7f7f7));
+ background-image: -moz-linear-gradient(center bottom, #d7d7d7 13%, #d2d2d2 39%, #e3e3e3 56%, #f7f7f7 91%);
+ background-image: -ms-linear-gradient(center bottom, #d7d7d7 13%, #d2d2d2 39%, #e3e3e3 56%, #f7f7f7 91%);
+ background-image: -o-linear-gradient(center bottom, #d7d7d7 13%, #d2d2d2 39%, #e3e3e3 56%, #f7f7f7 91%);
+ background-image: linear-gradient(center bottom, #d7d7d7 13%, #d2d2d2 39%, #e3e3e3 56%, #f7f7f7 91%);
+ overflow: visible;
+ color: #000000;
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

My only concern about this type of styling is that if we change our jQuery UI styling, it won't update. Is is possible to use some of the jquery ui css classes to get some of the basic styling done?

@Carreau
IPython member
Carreau added a note May 10, 2012

After some test, I alway get into trouble at some point... either because i'm using some before/after css properties for the arrow, or because the background for jquery ui element is not ment to be heigher than xxx-pixels.

@ellisonbg
IPython member
ellisonbg added a note May 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
@@ -0,0 +1,238 @@
+// function completer.
+//
+// completer should be a class that take an cell instance
+
+var IPython = (function(IPython ) {
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

Please try to follow the coding style that we have been using in the JavaScript. In this case it would look like:

var IPython = (function (IPython) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
@@ -0,0 +1,238 @@
+// function completer.
+//
+// completer should be a class that take an cell instance
+
+var IPython = (function(IPython ) {
+ // that will prevent us from misspelling
+ "use strict";
+
+ // easyier key mapping
+ var key = IPython.utils.keycodes;
+
+ // what is the common start of all completions
+ function sharedStart(B){
+ if(B.length == 1){return B[0];}
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

Space after and before the if statement's ().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+// function completer.
+//
+// completer should be a class that take an cell instance
+
+var IPython = (function(IPython ) {
+ // that will prevent us from misspelling
+ "use strict";
+
+ // easyier key mapping
+ var key = IPython.utils.keycodes;
+
+ // what is the common start of all completions
+ function sharedStart(B){
+ if(B.length == 1){return B[0];}
+ var A = new Array();
+ for(var i=0; i< B.length; i++)
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

for (...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+var IPython = (function(IPython ) {
+ // that will prevent us from misspelling
+ "use strict";
+
+ // easyier key mapping
+ var key = IPython.utils.keycodes;
+
+ // what is the common start of all completions
+ function sharedStart(B){
+ if(B.length == 1){return B[0];}
+ var A = new Array();
+ for(var i=0; i< B.length; i++)
+ {
+ A.push(B[i].str);
+ }
+ if(A.length > 1 ){
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

There are other code style things throughout the code. The main ones I see are:

  • Spaces after if/while/for: if (...), for (...), while (...)
  • Spaces before code an opening {

Can you fix these throughout this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg and 1 other commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
@@ -0,0 +1,238 @@
+// function completer.
+//
+// completer should be a class that take an cell instance
+
+var IPython = (function(IPython ) {
+ // that will prevent us from misspelling
+ "use strict";
+
+ // easyier key mapping
+ var key = IPython.utils.keycodes;
+
+ // what is the common start of all completions
+ function sharedStart(B){
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

Please don't use names like sharedStart. Even in JavaScript we are trying to use the PEP8 style shared_start. Please fix names throughout.

@Carreau
IPython member
Carreau added a note May 10, 2012

I'll do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+ }
+ if (tem1 == "" || tem2.indexOf(tem1) != 0){return null;}
+ return { str : tem1,
+ type : "computed",
+ from : B[0].from,
+ to : B[0].to
+ };
+ }
+ return null;
+ }
+
+
+ var Completer = function(cell) {
+ this.editor = cell.code_mirror;
+ var that = this;
+ $([IPython.events]).on('status_busy.Kernel',function () {
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

I really like your usage of these events here. Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+ }
+
+
+ var Completer = function(cell) {
+ this.editor = cell.code_mirror;
+ var that = this;
+ $([IPython.events]).on('status_busy.Kernel',function () {
+ that.skip_kernel_completion = true;
+ });
+ $([IPython.events]).on('status_idle.Kernel',function () {
+ that.skip_kernel_completion = false;
+ });
+
+
+ };
+
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

Two blank lines is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+ var Completer = function(cell) {
+ this.editor = cell.code_mirror;
+ var that = this;
+ $([IPython.events]).on('status_busy.Kernel',function () {
+ that.skip_kernel_completion = true;
+ });
+ $([IPython.events]).on('status_idle.Kernel',function () {
+ that.skip_kernel_completion = false;
+ });
+
+
+ };
+
+
+
+ Completer.prototype.startCompletion = function()
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

start_completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+ };
+
+
+
+ Completer.prototype.startCompletion = function()
+ {
+ // call for a 'first' completion, that will set the editor and do some
+ // special behaviour like autopicking if only one completion availlable
+ //
+ if (this.editor.somethingSelected()) return;
+ this.done = false;
+ // use to get focus back on opera
+ this.carryOnCompletion(true);
+ };
+
+ Completer.prototype.carryOnCompletion = function(ff) {
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

carry_on_completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jasongrout jasongrout and 1 other commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/css/tooltip.css
@@ -0,0 +1,139 @@
+/**
+ * Primary styles
+ *
+ * Author: IPython Development Team
+ *
+ * We'll try to get something prety, so we
@jasongrout
IPython member
jasongrout added a note May 10, 2012

really minor, but that should be "pretty". And the line below should be "css".

@Carreau
IPython member
Carreau added a note May 10, 2012

fixed, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg and 2 others commented on an outdated diff May 10, 2012
IPython/frontend/html/notebook/static/js/completer.js
+ };
+
+ Completer.prototype.finish_completing =function (content) {
+ // let's build a function that wrap all that stuff into what is needed
+ // for the new completer:
+ var matched_text = content.matched_text;
+ var matches = content.matches;
+
+ var cur = this.editor.getCursor();
+ var results = CodeMirror.contextHint(this.editor);
+
+ // append the introspection result, in order, at at the beginning of
+ // the table and compute the replacement range from current cursor
+ // positon and matched_text length.
+ for(var i= matches.length-1; i>=0 ;--i)
+ {
@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

For the most part we are putting the { at the end of the previous line with a space after the (. Please fix throughout.

@jasongrout
IPython member
jasongrout added a note May 10, 2012

Do you happen to have a favorite javascript "beautifier" tool, like indent is for C? For example, http://jsbeautifier.org/.

@ellisonbg
IPython member
ellisonbg added a note May 10, 2012
@Carreau
IPython member
Carreau added a note May 10, 2012

cool, i used jsbeautifier in command line and fixed the rest through sed.

@ellisonbg
IPython member
ellisonbg added a note May 10, 2012

Just curious, how well did jsbeautifier do and what did you have to do with sed?

@Carreau
IPython member
Carreau added a note May 10, 2012

really good,
I just sed spaces after function I think.
The only problem is with jQuery chain methods where it put everything on a single line. (need to find a good regexp for that)
I have to try putting // on line end to see if it stops, or try to configure it.
it also always put dictionnary with one key/pair by line for small dict as function argument is useless/less readable.

@ellisonbg
IPython member
ellisonbg added a note May 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg
IPython member

@Carreau OK I have merged your PR. I have also fixed the error messages that were showing up in the console related to not being able to call method send of null. It was related to how CodeCell's deal with kernels upon creation. I will continue to test and code review all of this and get back to you. It would be great if other's (@fperez, @minrk, @takluyver) could test this branch as well as the changes are significant.

@jasongrout
IPython member

I have two students that will be experimenting over the next week or so with using this (the big refactor and callbacks) to implement the next generation of the Sage cell server. So we'll be testing it as well...

@ellisonbg
IPython member
@minrk
IPython member
minrk commented May 10, 2012

I've found the huge barf of totally useless style output from tools like pylint, jslint, pep8, etc. for anything other than correctness obscures the actually helpful messges. But perhaps it makes sense on javascript, where we are less experienced.

@jasongrout
IPython member

The nice thing about jslint is that you can turn off a lot of the style warnings to get the "informative" warnings. But since a lot of Brian's comments were style comments anyway, that's important output too in this case.

@fperez
IPython member
@ellisonbg
IPython member

@Carreau, @minrk, @fperez: I am running into a nasty bug in this branch now. It is difficult to reproduce, but when it does show up, it renders the notebook useless. Here is a description of what I am seeing. In the course of using the notebook for "regular work" I occasionally end up using the mouse to click on different cells. One in a while, I will try to click on a cell and nothing will happen. Usually a click should select the cell (outline appears) and focus should be given to the CodeMirror editor. When this bug shows up nothing happens - it is like I didn't click at all. At this point, everything about that cell becomes wedged. You often can't even navigate to the cell using the keyboard.

I have a vague feeling that this shows up after you have used tab completion or the tooltip in a cell. Almost like when those widgets are closing, they are not cleaning up their state and they are capturing/blocking events.

Part of what is wierd about this is that if the wedged cell has an output area, if you click on that, you can select it.

The frequency with which this shows up is really low - I have only observed it maybe 3-4 times of working full time with this branch for the last week. We will need lots of people using this branch to try and profile the bug. @Carreau, can you look at the tooltip and completer to see if there is anything that would cause this.

@jenshnielsen

@ellisonbg I believe that I have seen the same issue, where I cant select a cell, on master. It is quite rare and I do not have any idea about how to trigger it. I have seen the problem on ubuntu 11.10 with unity and firefox and perhaps ubuntu 12.04 as well. I have until now attributed the issue to a unity bug since unity has severe issues with focus in maximized windows, especially after using ctrl+alt arrow keys to navigate virtual screens which breaks context menus among other things (I stopped using unity for that and other reasons). Is it possible that the issue also exists on master but is just very difficult to trigger? I don't remember seeing the issue lately on master but if I can trigger it I will post it here.

@Carreau
IPython member
Carreau commented May 14, 2012

Hum, I'll investigate, but I won't have much time this week.
If I had to bet on something, that would be le differents code_mirror focus that lies in tooltip.js.
I've already seen something similar once when only top half of cell were active through mouse, and I had to use keyboard to edit the bottom half....

@Carreau
IPython member
Carreau commented May 14, 2012

Ok, I find a way to partially block in an almost reproductible manner the notebook :

#-------------
#code cell
range(
#-------------
#codecell (empty)

#-------------

press tab 4 times after (, pager appear, you can't select the second cell...
is this reproductible for you ?

This seem to be due to some prototype methods of the tooltip that are called show and hide. Do they conflict with jQuery maybe ? It seem to work again if I also disable the css animations...I'm not sure I really understand why.
PR coming that fixes this at least.

@ellisonbg
IPython member
@ellisonbg
IPython member

@Carreau OK I have merged your branch and it does fix the previous problem of not being able to mouse click on the following cell. But it creates a new problem. To reproduce, do the same setup as before (two cells, type range( and 4 tabs in the first cell). Then try to use the down arrow key to navigate to the second cell. The second cell will temporarily be selected for a fraction of a second, but then the first cell will be auto-reselected. I added some debugging code and you can see that Notebook.select is being called twice in series.

I have also found that L353 of tooltip.py often gives the following error in the JS console:

353Uncaught TypeError: Cannot call method 'focus' of undefined.

This is the Tooltip._cmfocus method that focuses the code mirror editor of a given cell. I think this method is being triggered at the wrong time when the tooltips active cell is not the actual selected active cell on the notebook. Calling code_mirror.focus on a cell is dangerous in general because of this risk. Can you modify this code to make sure focus is only called on the selected cell?

Overall though, I think the underlying issue is that there are problems with how the tooltip in managing focus. It almost looks like the tooltip is capturing events, even when it is not open.

@ellisonbg
IPython member

I should mention that I think the reason that removing the css animation sort of helped is that it is partially a timing issue. In your _cmfocus method, code_mirror.focus is not called immediately, but after 50 ms. An animation could easily take place at that time scale, causing it to appear that the animation was the problem.

@ellisonbg
IPython member

It is even worse than I thought. While you can mouse click on the second cell, if you try to type in it, the previous cell is selected immediately. I think I am remove this commit from this branch as it completely breaks the notebook.

@ellisonbg
IPython member

OK I have rebased to remove your recent commits that appeared to fix the problem, but only made it worse. But I think we have a much better idea of what is going on.

@Carreau
IPython member
Carreau commented May 16, 2012

I made a mistake, I forgot that when you type the codecell 'cancel' the tooltip it give back the focus to the cell that have invoked it... I wasn't setting the cell back to null, and checking that the cell is the current selected cell works.
I have a fixed version that I've to rebased on the last change to have a clean merge.

@ellisonbg
IPython member
@tkf
tkf commented May 22, 2012

Hi, I posted a PR #1753 on top of this branch, to fix a minor bug.

@fperez
IPython member
fperez commented May 29, 2012

This looks great, regarding widget as per skype review: when moving it to examples, I still think it would be a good idea to give it echoing of the input typed by the user. At least it will make staring at the result a bit better, since you'll be able to see what you typed that produced that input.

@ellisonbg
IPython member
@ak3n ak3n referenced this pull request May 30, 2012
Closed

Commenting function. #1790

Carreau and others added some commits Feb 1, 2012
@Carreau Carreau implement the completer in a separate class
more feature like
-completion based on 2 sources :
    * introspection in kernel
    * context of current cell (complete with matching words)
    * each source has its color in the completer
4b889ad
@Carreau Carreau use strict and clean a little.
    adding 'use strict' in some place to be more agressive on the
    delaration of the variables.

    clean name and details here and there
51f85c6
@Carreau Carreau fix and retab javascript 675ad96
@Carreau Carreau comment more d52c6a4
@Carreau Carreau fix replace range bug
    pylab.l<tab><tab> would be replace by .l because of a bug in common
    start finding .l on the fifth position of pylab.start.
b144998
@Carreau Carreau add a keycodes structure to utils
    this structure (IPython.utils.keycodes)
    add some common keycodes like tab...etc

    and start modifying codecell.js to use it for better readability
3072ce9
@Carreau Carreau import Utils keycodes into the completer 9d65fa3
@Carreau Carreau Removing some code that seem not to be usefull anymore
    if having problem with Tab Completion try to revese this commit
c4ea669
@Carreau Carreau add ctrlKey.which to utils
and modifies some file to use it
26492bf
@Carreau Carreau be smarter for context completion
Completion source based on context is smarter and use codemirror token
mecanisme to propose completions, instead of just plitting text at
whitespace and before dots.
5731aaa
@Carreau Carreau move more code into the completer itself 217335c
@Carreau Carreau clean code, remove duplicate unused lines ca691ed
@Carreau Carreau more cleaning b076ce2
Matthias Bussonnier tooltip to mac 6da1372
Matthias Bussonnier tooltip to mac 4b19711
@Carreau Carreau new tooltip style b56874c
@Carreau Carreau improve new tooltip b18752c
@Carreau Carreau change new tooltip appearence
    temporarly (or maybe not) use less css to produce the css for the
    tooltip.
3a1677c
Matthias Bussonnier comment a little c9bcb1f
Matthias Bussonnier play with tooltip growing css
don't forget to reenqble keyframe with a more
recent less compiler
ad2e319
Matthias Bussonnier fix scrolltop 024e746
Matthias Bussonnier animate tooltip position 0e6a712
@Carreau Carreau animation if already shown 78cd4e1
@Carreau Carreau shorten prearrow 8cfadd3
@Carreau Carreau move arow with tooltip positoin 8a6fb03
@Carreau Carreau call tooltip by cell reference f448da1
@Carreau Carreau call tooltip after time 3ae5d20
@Carreau Carreau almost all logic in tooltip.js, padding right button edff13c
@Carreau Carreau remove global 4c8cd78
@Carreau Carreau multiple tooltip action
consecutives tab pressing with tooltip does :
    - fisrt : show it
    - second :  expand it
    - third : make it sticky for 10s (typing wont dismiss it)
    - forth : send the content into the Pager
df01649
@Carreau Carreau should fix click on close works when sticky a66d497
@Carreau Carreau clean and comment tooltip file 575409f
@Carreau Carreau remove console.log d8639dd
@Carreau Carreau fix cancel_stick typo 5740ce2
@Carreau Carreau fix typo that->this 12a3888
@Carreau Carreau fix print view
construct a completer only if the class exist
otherwise print view won't load.
7880db6
@Carreau Carreau allow number in tokens 329a808
@ellisonbg ellisonbg 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
cf83122
@Carreau Carreau remove less CSS 605f021
@Carreau Carreau Clean code, retab and minor fix
remove unused code, convert some tab to space, and correct some
semicolon according to jslint

jlint fixes
e0eb36b
@Carreau Carreau move some tooltip logic away from codecell.js ac4ce32
@Carreau Carreau make tooltip tabs fonction configurable 0bd4c42
@ellisonbg ellisonbg Adding options to Kernel.execute with a default of silent=true. 72ff133
@Carreau Carreau 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
cf54aa1
@Carreau Carreau simplify completer logic as we don't exec on behalf of cell
also skip making kernel completion request if kernel is busy
4297ebc
@Carreau Carreau fix multiple busy in title bar due to completer 304d72a
@ellisonbg ellisonbg 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.
83c2b0a
@ellisonbg ellisonbg 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.
b9a7cde
@ellisonbg ellisonbg Adding missing var statements in notebook.js. 9db61cb
@ellisonbg ellisonbg Removing stale code in CodeCell. 5729f8c
@Carreau Carreau Revert "remove less CSS"
This reverts commit 185c4ee.
3cc042a
@ellisonbg ellisonbg Fixing bug in prompt_area handling of OutputArea. 4ca81ce
@Carreau Carreau fix less css 98f5aee
@Carreau Carreau tooltip, pager bring pager
execute xxxx? on behalf of the cell to bring the pager.
be800ec
@Carreau Carreau shrink less and css, typo in css 7d6e6b8
@Carreau Carreau 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
a5bcda2
@Carreau Carreau make sticky time configurable d3e946d
@Carreau Carreau beautify tooltip.js 6f7a85f
@Carreau Carreau beautify completer.js 2d138c0
@Carreau Carreau space before function keyword in js ae1b06f
@Carreau Carreau remove less file 8de56f9
@Carreau Carreau remove CamelCasse methods from completer.js 3270d16
@Carreau Carreau Uppercase constant keycode in utils.js 2ea1b48
@Carreau Carreau beautify context-hint.js 5a08794
@ellisonbg ellisonbg 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.
ec9293e
@Carreau Carreau space after function keyword in context-hint df2f7fe
@Carreau Carreau rename context-hint to contexthint b0be2d0
@ellisonbg ellisonbg Adding new widgets subpackage with base widget and example. 60af860
@Carreau Carreau 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
f229c42
@Carreau Carreau Revert "remove less file"
This reverts commit 8af188d.
f862341
@ellisonbg ellisonbg Misc fixes to the code cell and output area. 02c0cea
@ellisonbg ellisonbg Adding engine selection UI control to DirectViewWidget. 3f49408
@Carreau Carreau remove less.css 076a0fa
@Carreau Carreau fix tooltip keep focus on wrong cell
check that the cell the tooltip is giving focus back is the currently
selected cell
563ee35
@Carreau Carreau retab tab to space e8cf72e
@Carreau Carreau click on close cancell stick a915480
@tkf tkf 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.
28f7c80
@ellisonbg ellisonbg Removing extra call to Kernel.stop_channels. fb02a67
@tkf tkf Reduce repeated code regarding restarting events 600ce65
@ellisonbg ellisonbg Finishing the DirectView widget and adding an example notebook. 2ab8717
@ellisonbg ellisonbg Moving direct view widget to docs/examples. 49a9eba
@ellisonbg ellisonbg Update directview.ipynb & allowing no-callbacks in kernel.execute. c5f6833
@ellisonbg ellisonbg Removing cell from execute callbacks in kernel.js. 4ea7e91
@ellisonbg ellisonbg 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.
f79e65f
@ellisonbg
IPython member

OK, I have done everything talked about in this review. I think it is ready for merging - this a huge, long-lived branch that should get merged sooner rather than later. Please let me know if you see anything else that needs work.

@fperez
IPython member
fperez commented Jun 1, 2012

OK, I'm merging this: at this point, delaying it any further only increases the risk of nasty conflicts, and we're hitting the point of diminishing returns. We can always (and we will) keep improving after it's merged.

A huge thank you and kudos to @Carreau and @ellisonbg for the amount of effort you guys put into this, and for the great teamwork here. Thanks also to @tkf and everyone else who pitched in with code, feedback, etc. It's a real pleasure to work on a project with a team like this.

On to the widgets!!!!!!!!!!

@fperez fperez merged commit 3d3a488 into master Jun 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.