Show More
@@ -53,7 +53,7 b' var IPython = (function (IPython) {' | |||||
53 | // otherwise no print view |
|
53 | // otherwise no print view | |
54 | if (IPython.Completer != undefined ) |
|
54 | if (IPython.Completer != undefined ) | |
55 | { |
|
55 | { | |
56 | this.completer = new IPython.Completer(this); |
|
56 | this.completer = new IPython.Completer(this); | |
57 | } |
|
57 | } | |
58 | }; |
|
58 | }; | |
59 |
|
59 | |||
@@ -143,10 +143,6 b' var IPython = (function (IPython) {' | |||||
143 | return false; |
|
143 | return false; | |
144 | }; |
|
144 | }; | |
145 |
|
145 | |||
146 | CodeCell.prototype.finish_tooltip = function (reply) { |
|
|||
147 | IPython.tooltip.show(reply, this); |
|
|||
148 | }; |
|
|||
149 |
|
||||
150 | // Kernel related calls. |
|
146 | // Kernel related calls. | |
151 |
|
147 | |||
152 | CodeCell.prototype.execute = function () { |
|
148 | CodeCell.prototype.execute = function () { | |
@@ -170,31 +166,6 b' var IPython = (function (IPython) {' | |||||
170 | // this.dirty = true; |
|
166 | // this.dirty = true; | |
171 | } |
|
167 | } | |
172 |
|
168 | |||
173 |
|
||||
174 | CodeCell.prototype.request_tooltip = function (func) { |
|
|||
175 | // Feel free to shorten this logic if you are better |
|
|||
176 | // than me in regEx |
|
|||
177 | // basicaly you shoul be able to get xxx.xxx.xxx from |
|
|||
178 | // something(range(10), kwarg=smth) ; xxx.xxx.xxx( firstarg, rand(234,23), kwarg1=2, |
|
|||
179 | // remove everything between matchin bracket (need to iterate) |
|
|||
180 | var matchBracket = /\([^\(\)]+\)/g; |
|
|||
181 | var endBracket = /\([^\(]*$/g; |
|
|||
182 | var oldfunc = func; |
|
|||
183 |
|
||||
184 | func = func.replace(matchBracket,""); |
|
|||
185 | while( oldfunc != func ) |
|
|||
186 | { |
|
|||
187 | oldfunc = func; |
|
|||
188 | func = func.replace(matchBracket,""); |
|
|||
189 | } |
|
|||
190 | // remove everythin after last open bracket |
|
|||
191 | func = func.replace(endBracket,""); |
|
|||
192 | var re = /[a-z_][0-9a-z._]+$/gi; // casse insensitive |
|
|||
193 | var callbacks = {'object_info_reply': $.proxy(this.finish_tooltip,this)} |
|
|||
194 | var msg_id = this.kernel.object_info_request(re.exec(func), callbacks); |
|
|||
195 | }; |
|
|||
196 |
|
||||
197 |
|
||||
198 | // Basic cell manipulation. |
|
169 | // Basic cell manipulation. | |
199 |
|
170 | |||
200 | CodeCell.prototype.select = function () { |
|
171 | CodeCell.prototype.select = function () { |
@@ -154,6 +154,30 b' var IPython = (function (IPython) {' | |||||
154 | var that = this; |
|
154 | var that = this; | |
155 | this.tooltip_timeout = setTimeout(function(){that.request(cell)} , that.time_before_tooltip); |
|
155 | this.tooltip_timeout = setTimeout(function(){that.request(cell)} , that.time_before_tooltip); | |
156 | } |
|
156 | } | |
|
157 | ||||
|
158 | Tooltip.prototype._request_tooltip = function(func) | |||
|
159 | { | |||
|
160 | // Feel free to shorten this logic if you are better | |||
|
161 | // than me in regEx | |||
|
162 | // basicaly you shoul be able to get xxx.xxx.xxx from | |||
|
163 | // something(range(10), kwarg=smth) ; xxx.xxx.xxx( firstarg, rand(234,23), kwarg1=2, | |||
|
164 | // remove everything between matchin bracket (need to iterate) | |||
|
165 | var matchBracket = /\([^\(\)]+\)/g; | |||
|
166 | var endBracket = /\([^\(]*$/g; | |||
|
167 | var oldfunc = func; | |||
|
168 | ||||
|
169 | func = func.replace(matchBracket,""); | |||
|
170 | while( oldfunc != func ) | |||
|
171 | { | |||
|
172 | oldfunc = func; | |||
|
173 | func = func.replace(matchBracket,""); | |||
|
174 | } | |||
|
175 | // remove everythin after last open bracket | |||
|
176 | func = func.replace(endBracket,""); | |||
|
177 | var re = /[a-z_][0-9a-z._]+$/gi; // casse insensitive | |||
|
178 | var callbacks = {'object_info_reply': $.proxy(this.show,this)} | |||
|
179 | var msg_id = IPython.notebook.kernel.object_info_request(re.exec(func), callbacks); | |||
|
180 | } | |||
157 |
|
181 | |||
158 | // make an imediate completion request |
|
182 | // make an imediate completion request | |
159 | Tooltip.prototype.request = function(cell) |
|
183 | Tooltip.prototype.request = function(cell) | |
@@ -203,7 +227,7 b' var IPython = (function (IPython) {' | |||||
203 | return; |
|
227 | return; | |
204 | // don't do anything if line beggin with '(' or is empty |
|
228 | // don't do anything if line beggin with '(' or is empty | |
205 | } |
|
229 | } | |
206 |
|
|
230 | this._request_tooltip(text); | |
207 | } |
|
231 | } | |
208 |
|
232 | |||
209 | // cancel the option of having the tooltip to stick |
|
233 | // cancel the option of having the tooltip to stick | |
@@ -228,13 +252,11 b' var IPython = (function (IPython) {' | |||||
228 | } |
|
252 | } | |
229 |
|
253 | |||
230 | // should be called with the kernel reply to actually show the tooltip |
|
254 | // should be called with the kernel reply to actually show the tooltip | |
231 |
Tooltip.prototype.show = function(reply |
|
255 | Tooltip.prototype.show = function(reply) | |
232 | { |
|
256 | { | |
233 | // move the bubble if it is not hidden |
|
257 | // move the bubble if it is not hidden | |
234 | // otherwise fade it |
|
258 | // otherwise fade it | |
235 |
var editor = |
|
259 | var editor = this.code_mirror; | |
236 | this.name = reply.name; |
|
|||
237 | this.code_mirror = editor; |
|
|||
238 |
|
260 | |||
239 | // do some math to have the tooltip arrow on more or less on left or right |
|
261 | // do some math to have the tooltip arrow on more or less on left or right | |
240 | // width of the editor |
|
262 | // width of the editor |
General Comments 0
You need to be logged in to leave comments.
Login now