Show More
@@ -61,9 +61,12 b'' | |||||
61 | " self.namespace = NamespaceMagics()\n", |
|
61 | " self.namespace = NamespaceMagics()\n", | |
62 | " self.namespace.shell = ipython.kernel.shell\n", |
|
62 | " self.namespace.shell = ipython.kernel.shell\n", | |
63 | " \n", |
|
63 | " \n", | |
64 |
" self._ |
|
64 | " self._box = widgets.Box()\n", | |
65 |
" self._ |
|
65 | " self._box._dom_classes = ['inspector']\n", | |
66 | " self._popout.button_text = self._popout.description\n", |
|
66 | " self._box.background_color = '#fff'\n", | |
|
67 | " self._box.border_color = '#ccc'\n", | |||
|
68 | " self._box.border_width = 1\n", | |||
|
69 | " self._box.border_radius = 5\n", | |||
67 | "\n", |
|
70 | "\n", | |
68 | " self._modal_body = widgets.VBox()\n", |
|
71 | " self._modal_body = widgets.VBox()\n", | |
69 | " self._modal_body.overflow_y = 'scroll'\n", |
|
72 | " self._modal_body.overflow_y = 'scroll'\n", | |
@@ -71,7 +74,7 b'' | |||||
71 | " self._modal_body_label = widgets.HTML(value = 'Not hooked')\n", |
|
74 | " self._modal_body_label = widgets.HTML(value = 'Not hooked')\n", | |
72 | " self._modal_body.children = [self._modal_body_label]\n", |
|
75 | " self._modal_body.children = [self._modal_body_label]\n", | |
73 | "\n", |
|
76 | "\n", | |
74 |
" self._ |
|
77 | " self._box.children = [\n", | |
75 | " self._modal_body, \n", |
|
78 | " self._modal_body, \n", | |
76 | " ]\n", |
|
79 | " ]\n", | |
77 | " \n", |
|
80 | " \n", | |
@@ -82,7 +85,7 b'' | |||||
82 | " \"\"\"Close and remove hooks.\"\"\"\n", |
|
85 | " \"\"\"Close and remove hooks.\"\"\"\n", | |
83 | " if not self.closed:\n", |
|
86 | " if not self.closed:\n", | |
84 | " self._ipython.events.unregister('post_run_cell', self._fill)\n", |
|
87 | " self._ipython.events.unregister('post_run_cell', self._fill)\n", | |
85 |
" self._ |
|
88 | " self._box.close()\n", | |
86 | " self.closed = True\n", |
|
89 | " self.closed = True\n", | |
87 | " VariableInspectorWindow.instance = None\n", |
|
90 | " VariableInspectorWindow.instance = None\n", | |
88 | "\n", |
|
91 | "\n", | |
@@ -96,7 +99,7 b'' | |||||
96 | " def _ipython_display_(self):\n", |
|
99 | " def _ipython_display_(self):\n", | |
97 | " \"\"\"Called when display() or pyout is used to display the Variable \n", |
|
100 | " \"\"\"Called when display() or pyout is used to display the Variable \n", | |
98 | " Inspector.\"\"\"\n", |
|
101 | " Inspector.\"\"\"\n", | |
99 |
" self._ |
|
102 | " self._box._ipython_display_()\n" | |
100 | ] |
|
103 | ] | |
101 | }, |
|
104 | }, | |
102 | { |
|
105 | { | |
@@ -115,6 +118,34 b'' | |||||
115 | "cell_type": "markdown", |
|
118 | "cell_type": "markdown", | |
116 | "metadata": {}, |
|
119 | "metadata": {}, | |
117 | "source": [ |
|
120 | "source": [ | |
|
121 | "Pop the inspector out of the widget area using Javascript. To close the inspector, click the close button on the widget area that it was spawned from." | |||
|
122 | ] | |||
|
123 | }, | |||
|
124 | { | |||
|
125 | "cell_type": "code", | |||
|
126 | "execution_count": null, | |||
|
127 | "metadata": { | |||
|
128 | "collapsed": false | |||
|
129 | }, | |||
|
130 | "outputs": [], | |||
|
131 | "source": [ | |||
|
132 | "%%javascript\n", | |||
|
133 | "$('div.inspector')\n", | |||
|
134 | " .detach()\n", | |||
|
135 | " .prependTo($('body'))\n", | |||
|
136 | " .css({\n", | |||
|
137 | " 'z-index': 999, \n", | |||
|
138 | " position: 'fixed',\n", | |||
|
139 | " 'box-shadow': '5px 5px 12px -3px black',\n", | |||
|
140 | " opacity: 0.9\n", | |||
|
141 | " })\n", | |||
|
142 | " .draggable();" | |||
|
143 | ] | |||
|
144 | }, | |||
|
145 | { | |||
|
146 | "cell_type": "markdown", | |||
|
147 | "metadata": {}, | |||
|
148 | "source": [ | |||
118 | "# Test" |
|
149 | "# Test" | |
119 | ] |
|
150 | ] | |
120 | }, |
|
151 | }, | |
@@ -187,15 +218,21 b'' | |||||
187 | ], |
|
218 | ], | |
188 | "metadata": { |
|
219 | "metadata": { | |
189 | "kernelspec": { |
|
220 | "kernelspec": { | |
|
221 | "display_name": "IPython (Python 2)", | |||
|
222 | "name": "python2" | |||
|
223 | }, | |||
|
224 | "language_info": { | |||
190 | "codemirror_mode": { |
|
225 | "codemirror_mode": { | |
191 | "name": "python", |
|
226 | "name": "ipython", | |
192 | "version": 2 |
|
227 | "version": 2 | |
193 | }, |
|
228 | }, | |
194 | "display_name": "Python 2", |
|
229 | "file_extension": ".py", | |
195 |
" |
|
230 | "mimetype": "text/x-python", | |
196 |
"name": "python |
|
231 | "name": "python", | |
197 | }, |
|
232 | "nbconvert_exporter": "python", | |
198 | "signature": "sha256:474731659fb14b86672d1dafb2b497fa280082ab40a8a82fe2cde1b6d9b88a6e" |
|
233 | "pygments_lexer": "ipython2", | |
|
234 | "version": "2.7.6" | |||
|
235 | } | |||
199 | }, |
|
236 | }, | |
200 | "nbformat": 4, |
|
237 | "nbformat": 4, | |
201 | "nbformat_minor": 0 |
|
238 | "nbformat_minor": 0 |
@@ -258,196 +258,6 b'' | |||||
258 | } |
|
258 | } | |
259 | }, |
|
259 | }, | |
260 | "source": [ |
|
260 | "source": [ | |
261 | "### Popup" |
|
|||
262 | ] |
|
|||
263 | }, |
|
|||
264 | { |
|
|||
265 | "cell_type": "markdown", |
|
|||
266 | "metadata": {}, |
|
|||
267 | "source": [ |
|
|||
268 | "Unlike the other two special containers, the `Popup` is only **designed to display one set of widgets**. The `Popup` can be used to **display widgets outside of the widget area**. " |
|
|||
269 | ] |
|
|||
270 | }, |
|
|||
271 | { |
|
|||
272 | "cell_type": "code", |
|
|||
273 | "execution_count": null, |
|
|||
274 | "metadata": { |
|
|||
275 | "collapsed": false |
|
|||
276 | }, |
|
|||
277 | "outputs": [], |
|
|||
278 | "source": [ |
|
|||
279 | "counter = widgets.IntText(description='Counter:')\n", |
|
|||
280 | "popup = widgets.Popup(children=[counter], description='Popup Demo', button_text='Popup Button')\n", |
|
|||
281 | "display(popup)" |
|
|||
282 | ] |
|
|||
283 | }, |
|
|||
284 | { |
|
|||
285 | "cell_type": "code", |
|
|||
286 | "execution_count": null, |
|
|||
287 | "metadata": { |
|
|||
288 | "collapsed": false |
|
|||
289 | }, |
|
|||
290 | "outputs": [], |
|
|||
291 | "source": [ |
|
|||
292 | "counter.value += 1" |
|
|||
293 | ] |
|
|||
294 | }, |
|
|||
295 | { |
|
|||
296 | "cell_type": "code", |
|
|||
297 | "execution_count": null, |
|
|||
298 | "metadata": { |
|
|||
299 | "collapsed": false |
|
|||
300 | }, |
|
|||
301 | "outputs": [], |
|
|||
302 | "source": [] |
|
|||
303 | }, |
|
|||
304 | { |
|
|||
305 | "cell_type": "code", |
|
|||
306 | "execution_count": null, |
|
|||
307 | "metadata": { |
|
|||
308 | "collapsed": false |
|
|||
309 | }, |
|
|||
310 | "outputs": [], |
|
|||
311 | "source": [] |
|
|||
312 | }, |
|
|||
313 | { |
|
|||
314 | "cell_type": "code", |
|
|||
315 | "execution_count": null, |
|
|||
316 | "metadata": { |
|
|||
317 | "collapsed": false |
|
|||
318 | }, |
|
|||
319 | "outputs": [], |
|
|||
320 | "source": [] |
|
|||
321 | }, |
|
|||
322 | { |
|
|||
323 | "cell_type": "code", |
|
|||
324 | "execution_count": null, |
|
|||
325 | "metadata": { |
|
|||
326 | "collapsed": false |
|
|||
327 | }, |
|
|||
328 | "outputs": [], |
|
|||
329 | "source": [] |
|
|||
330 | }, |
|
|||
331 | { |
|
|||
332 | "cell_type": "code", |
|
|||
333 | "execution_count": null, |
|
|||
334 | "metadata": { |
|
|||
335 | "collapsed": false |
|
|||
336 | }, |
|
|||
337 | "outputs": [], |
|
|||
338 | "source": [] |
|
|||
339 | }, |
|
|||
340 | { |
|
|||
341 | "cell_type": "code", |
|
|||
342 | "execution_count": null, |
|
|||
343 | "metadata": { |
|
|||
344 | "collapsed": false |
|
|||
345 | }, |
|
|||
346 | "outputs": [], |
|
|||
347 | "source": [] |
|
|||
348 | }, |
|
|||
349 | { |
|
|||
350 | "cell_type": "code", |
|
|||
351 | "execution_count": null, |
|
|||
352 | "metadata": { |
|
|||
353 | "collapsed": false |
|
|||
354 | }, |
|
|||
355 | "outputs": [], |
|
|||
356 | "source": [] |
|
|||
357 | }, |
|
|||
358 | { |
|
|||
359 | "cell_type": "code", |
|
|||
360 | "execution_count": null, |
|
|||
361 | "metadata": { |
|
|||
362 | "collapsed": false |
|
|||
363 | }, |
|
|||
364 | "outputs": [], |
|
|||
365 | "source": [] |
|
|||
366 | }, |
|
|||
367 | { |
|
|||
368 | "cell_type": "code", |
|
|||
369 | "execution_count": null, |
|
|||
370 | "metadata": { |
|
|||
371 | "collapsed": false |
|
|||
372 | }, |
|
|||
373 | "outputs": [], |
|
|||
374 | "source": [] |
|
|||
375 | }, |
|
|||
376 | { |
|
|||
377 | "cell_type": "code", |
|
|||
378 | "execution_count": null, |
|
|||
379 | "metadata": { |
|
|||
380 | "collapsed": false |
|
|||
381 | }, |
|
|||
382 | "outputs": [], |
|
|||
383 | "source": [] |
|
|||
384 | }, |
|
|||
385 | { |
|
|||
386 | "cell_type": "code", |
|
|||
387 | "execution_count": null, |
|
|||
388 | "metadata": { |
|
|||
389 | "collapsed": false |
|
|||
390 | }, |
|
|||
391 | "outputs": [], |
|
|||
392 | "source": [] |
|
|||
393 | }, |
|
|||
394 | { |
|
|||
395 | "cell_type": "code", |
|
|||
396 | "execution_count": null, |
|
|||
397 | "metadata": { |
|
|||
398 | "collapsed": false |
|
|||
399 | }, |
|
|||
400 | "outputs": [], |
|
|||
401 | "source": [] |
|
|||
402 | }, |
|
|||
403 | { |
|
|||
404 | "cell_type": "code", |
|
|||
405 | "execution_count": null, |
|
|||
406 | "metadata": { |
|
|||
407 | "collapsed": false |
|
|||
408 | }, |
|
|||
409 | "outputs": [], |
|
|||
410 | "source": [] |
|
|||
411 | }, |
|
|||
412 | { |
|
|||
413 | "cell_type": "code", |
|
|||
414 | "execution_count": null, |
|
|||
415 | "metadata": { |
|
|||
416 | "collapsed": false |
|
|||
417 | }, |
|
|||
418 | "outputs": [], |
|
|||
419 | "source": [] |
|
|||
420 | }, |
|
|||
421 | { |
|
|||
422 | "cell_type": "code", |
|
|||
423 | "execution_count": null, |
|
|||
424 | "metadata": { |
|
|||
425 | "collapsed": false |
|
|||
426 | }, |
|
|||
427 | "outputs": [], |
|
|||
428 | "source": [ |
|
|||
429 | "counter.value += 1" |
|
|||
430 | ] |
|
|||
431 | }, |
|
|||
432 | { |
|
|||
433 | "cell_type": "code", |
|
|||
434 | "execution_count": null, |
|
|||
435 | "metadata": { |
|
|||
436 | "collapsed": false |
|
|||
437 | }, |
|
|||
438 | "outputs": [], |
|
|||
439 | "source": [ |
|
|||
440 | "popup.close()" |
|
|||
441 | ] |
|
|||
442 | }, |
|
|||
443 | { |
|
|||
444 | "cell_type": "markdown", |
|
|||
445 | "metadata": { |
|
|||
446 | "slideshow": { |
|
|||
447 | "slide_type": "slide" |
|
|||
448 | } |
|
|||
449 | }, |
|
|||
450 | "source": [ |
|
|||
451 | "# Alignment" |
|
261 | "# Alignment" | |
452 | ] |
|
262 | ] | |
453 | }, |
|
263 | }, | |
@@ -753,7 +563,7 b'' | |||||
753 | ] |
|
563 | ] | |
754 | ], |
|
564 | ], | |
755 | "kernelspec": { |
|
565 | "kernelspec": { | |
756 | "display_name": "Python 2", |
|
566 | "display_name": "IPython (Python 2)", | |
757 | "name": "python2" |
|
567 | "name": "python2" | |
758 | }, |
|
568 | }, | |
759 | "language_info": { |
|
569 | "language_info": { | |
@@ -766,9 +576,8 b'' | |||||
766 | "name": "python", |
|
576 | "name": "python", | |
767 | "nbconvert_exporter": "python", |
|
577 | "nbconvert_exporter": "python", | |
768 | "pygments_lexer": "ipython2", |
|
578 | "pygments_lexer": "ipython2", | |
769 |
"version": "2.7. |
|
579 | "version": "2.7.6" | |
770 |
} |
|
580 | } | |
771 | "signature": "sha256:198630bf2c2eb00401b60a395ebc75049099864b62f0faaf416da02f9808c40b" |
|
|||
772 | }, |
|
581 | }, | |
773 | "nbformat": 4, |
|
582 | "nbformat": 4, | |
774 | "nbformat_minor": 0 |
|
583 | "nbformat_minor": 0 |
General Comments 0
You need to be logged in to leave comments.
Login now