Show More
@@ -307,14 +307,19 option.introspection { | |||||
307 | } |
|
307 | } | |
308 |
|
308 | |||
309 | /*properties of tooltip before "expand"*/ |
|
309 | /*properties of tooltip before "expand"*/ | |
310 |
.smalltooltip |
|
310 | .smalltooltip{ | |
311 | text-overflow: ellipsis; |
|
311 | text-overflow: ellipsis; | |
312 | overflow: hidden; |
|
312 | overflow: hidden; | |
313 |
height: |
|
313 | height:20px; | |
|
314 | } | |||
|
315 | .tooltip div | |||
|
316 | { | |||
|
317 | height: 200px; | |||
|
318 | overflow : auto; | |||
314 | } |
|
319 | } | |
315 |
|
||||
316 | .tooltip { |
|
320 | .tooltip { | |
317 | /*transition when "expand"ing tooltip */ |
|
321 | /*transition when "expand"ing tooltip */ | |
|
322 | overflow : hidden; | |||
318 | font-size: 14px; |
|
323 | font-size: 14px; | |
319 | -webkit-transition-property: height; |
|
324 | -webkit-transition-property: height; | |
320 | -webkit-transition-duration: 1s; |
|
325 | -webkit-transition-duration: 1s; | |
@@ -355,6 +360,7 option.introspection { | |||||
355 | padding-left:7px; |
|
360 | padding-left:7px; | |
356 | font-family: monospace; |
|
361 | font-family: monospace; | |
357 | min-height:50px; |
|
362 | min-height:50px; | |
|
363 | max-height : 70%; | |||
358 | } |
|
364 | } | |
359 |
|
365 | |||
360 | /*fixed part of the completion*/ |
|
366 | /*fixed part of the completion*/ |
@@ -165,12 +165,14 var IPython = (function (IPython) { | |||||
165 | // get the event. |
|
165 | // get the event. | |
166 | if (this.tooltip_timeout != null){ |
|
166 | if (this.tooltip_timeout != null){ | |
167 | clearTimeout(this.tooltip_timeout); |
|
167 | clearTimeout(this.tooltip_timeout); | |
168 |
$('#tooltip'). |
|
168 | $('#tooltip').addClass('hidden'); | |
169 | this.tooltip_timeout = null; |
|
169 | this.tooltip_timeout = null; | |
170 | } |
|
170 | } | |
171 | } |
|
171 | } | |
172 |
|
172 | |||
173 | CodeCell.prototype.finish_tooltip = function (reply) { |
|
173 | CodeCell.prototype.finish_tooltip = function (reply) { | |
|
174 | IPython.tooltip.show(reply,this.code_mirror.cursorCoords()); | |||
|
175 | return; | |||
174 | // Extract call tip data; the priority is call, init, main. |
|
176 | // Extract call tip data; the priority is call, init, main. | |
175 | defstring = reply.call_def; |
|
177 | defstring = reply.call_def; | |
176 | if (defstring == null) { defstring = reply.init_definition; } |
|
178 | if (defstring == null) { defstring = reply.init_definition; } |
@@ -15,11 +15,64 var IPython = (function (IPython) { | |||||
15 |
|
15 | |||
16 | var Tooltip = function (notebook) { |
|
16 | var Tooltip = function (notebook) { | |
17 | this.tooltip = $('#tooltip'); |
|
17 | this.tooltip = $('#tooltip'); | |
18 |
this.text = $('< |
|
18 | this.text = $('<div/>') | |
19 | this.text.html('something'); |
|
19 | .addClass('smalltooltip'); | |
20 | this.tooltip.css('left',50+'px'); |
|
20 | this.tooltip.css('left',50+'px'); | |
21 | this.tooltip.css('top',50+'px'); |
|
21 | this.tooltip.css('top',50+'px'); | |
22 | this.tooltip.append(this.text); |
|
22 | ||
|
23 | var tooltip = this.tooltip; | |||
|
24 | var text = this.text; | |||
|
25 | ||||
|
26 | var expandspan=$('<span/>').text('Expand') | |||
|
27 | .addClass('ui-icon') | |||
|
28 | .addClass('ui-icon-plus'); | |||
|
29 | var expandlink=$('<a/>').attr('href',"#") | |||
|
30 | .addClass("ui-corner-all") //rounded corner | |||
|
31 | .attr('role',"button") | |||
|
32 | .attr('id','expanbutton') | |||
|
33 | .append(expandspan) | |||
|
34 | .click(function(){ | |||
|
35 | text.removeClass('smalltooltip'); | |||
|
36 | text.addClass('bigtooltip'); | |||
|
37 | $('#expanbutton').remove(); | |||
|
38 | //setTimeout(function(){that.code_mirror.focus();}, 50); | |||
|
39 | }); | |||
|
40 | ||||
|
41 | var morelink=$('<a/>').attr('href',"#"); | |||
|
42 | morelink.attr('role',"button"); | |||
|
43 | morelink.addClass('ui-button'); | |||
|
44 | //morelink.addClass("ui-corner-all"); //rounded corner | |||
|
45 | //morelink.addClass('ui-state-default'); | |||
|
46 | var morespan=$('<span/>').text('Open in Pager'); | |||
|
47 | morespan.addClass('ui-icon'); | |||
|
48 | morespan.addClass('ui-icon-arrowstop-l-n'); | |||
|
49 | morelink.append(morespan); | |||
|
50 | morelink.click(function(){ | |||
|
51 | var msg_id = IPython.notebook.kernel.execute(name+"?"); | |||
|
52 | IPython.notebook.msg_cell_map[msg_id] = IPython.notebook.get_selected_cell().cell_id; | |||
|
53 | that.remove_and_cancel_tooltip(); | |||
|
54 | setTimeout(function(){that.code_mirror.focus();}, 50); | |||
|
55 | }); | |||
|
56 | ||||
|
57 | var closelink=$('<a/>').attr('href',"#"); | |||
|
58 | closelink.attr('role',"button"); | |||
|
59 | closelink.addClass('ui-button'); | |||
|
60 | //closelink.addClass("ui-corner-all"); //rounded corner | |||
|
61 | //closelink.adClass('ui-state-default'); // grey background and blue cross | |||
|
62 | var closespan=$('<span/>').text('Close'); | |||
|
63 | closespan.addClass('ui-icon'); | |||
|
64 | closespan.addClass('ui-icon-close'); | |||
|
65 | closelink.append(closespan); | |||
|
66 | closelink.click(function(){ | |||
|
67 | that.remove_and_cancel_tooltip(); | |||
|
68 | setTimeout(function(){that.code_mirror.focus();}, 50); | |||
|
69 | }); | |||
|
70 | //construct the tooltip | |||
|
71 | tooltip.append(closelink); | |||
|
72 | tooltip.append(expandlink); | |||
|
73 | tooltip.append(morelink); | |||
|
74 | ||||
|
75 | tooltip.append(this.text); | |||
23 | }; |
|
76 | }; | |
24 |
|
77 | |||
25 |
|
78 | |||
@@ -39,9 +92,32 var IPython = (function (IPython) { | |||||
39 | this.tooltip_timeout = null; |
|
92 | this.tooltip_timeout = null; | |
40 | } |
|
93 | } | |
41 | } |
|
94 | } | |
42 | Tooltip.prototype.show = function() |
|
95 | Tooltip.prototype.show = function(reply,pos) | |
43 | { |
|
96 | { | |
44 | this.tooltip.removeClass('hidden'); |
|
97 | this.tooltip.css('left',pos.x+'px'); | |
|
98 | this.tooltip.css('top',pos.yBot+'px'); | |||
|
99 | this.tooltip.removeClass('hidden'); | |||
|
100 | ||||
|
101 | // build docstring | |||
|
102 | defstring = reply.call_def; | |||
|
103 | if (defstring == null) { defstring = reply.init_definition; } | |||
|
104 | if (defstring == null) { defstring = reply.definition; } | |||
|
105 | ||||
|
106 | docstring = reply.call_docstring; | |||
|
107 | if (docstring == null) { docstring = reply.init_docstring; } | |||
|
108 | if (docstring == null) { docstring = reply.docstring; } | |||
|
109 | if (docstring == null) { docstring = "<empty docstring>"; } | |||
|
110 | ||||
|
111 | this.text.children().remove(); | |||
|
112 | ||||
|
113 | var pre=$('<pre/>').html(utils.fixConsole(docstring)); | |||
|
114 | if(defstring){ | |||
|
115 | var defstring_html = $('<pre/>').html(utils.fixConsole(defstring)); | |||
|
116 | this.text.append(defstring_html); | |||
|
117 | } | |||
|
118 | this.text.append(pre) | |||
|
119 | ||||
|
120 | ||||
45 | } |
|
121 | } | |
46 |
|
122 | |||
47 | Tooltip.prototype.showInPager = function(){ |
|
123 | Tooltip.prototype.showInPager = function(){ |
General Comments 0
You need to be logged in to leave comments.
Login now