Show More
@@ -17,6 +17,8 b'' | |||||
17 | "cell_type": "code", |
|
17 | "cell_type": "code", | |
18 | "collapsed": false, |
|
18 | "collapsed": false, | |
19 | "input": [ |
|
19 | "input": [ | |
|
20 | "from __future__ import print_function # py 2.7 compat\n", | |||
|
21 | "\n", | |||
20 | "from IPython.html import widgets # Widget definitions\n", |
|
22 | "from IPython.html import widgets # Widget definitions\n", | |
21 | "from IPython.display import display # Used to display widgets in the notebook" |
|
23 | "from IPython.display import display # Used to display widgets in the notebook" | |
22 | ], |
|
24 | ], | |
@@ -156,7 +158,7 b'' | |||||
156 | "metadata": {}, |
|
158 | "metadata": {}, | |
157 | "output_type": "display_data", |
|
159 | "output_type": "display_data", | |
158 | "text": [ |
|
160 | "text": [ | |
159 |
"<IPython.core.display.Javascript at 0x |
|
161 | "<IPython.core.display.Javascript at 0x7f14f1c78cd0>" | |
160 | ] |
|
162 | ] | |
161 | } |
|
163 | } | |
162 | ], |
|
164 | ], | |
@@ -178,14 +180,14 b'' | |||||
178 | "display(file_widget)\n", |
|
180 | "display(file_widget)\n", | |
179 | "\n", |
|
181 | "\n", | |
180 | "def file_loading():\n", |
|
182 | "def file_loading():\n", | |
181 |
" print |
|
183 | " print(\"Loading %s\" % file_widget.filename)\n", | |
182 | "\n", |
|
184 | "\n", | |
183 | "def file_loaded():\n", |
|
185 | "def file_loaded():\n", | |
184 |
" print |
|
186 | " print(\"Loaded, file contents: %s\" % file_widget.value)\n", | |
185 | "\n", |
|
187 | "\n", | |
186 | "def file_failed(name, old_value, new_value):\n", |
|
188 | "def file_failed(name, old_value, new_value):\n", | |
187 | " if new_value > old_value:\n", |
|
189 | " if new_value > old_value:\n", | |
188 |
" print |
|
190 | " print(\"Could not load file contents of %s\" % file_widget.filename)\n", | |
189 | "\n", |
|
191 | "\n", | |
190 | "\n", |
|
192 | "\n", | |
191 | "file_widget.on_trait_change(file_loading, 'filename')\n", |
|
193 | "file_widget.on_trait_change(file_loading, 'filename')\n", | |
@@ -206,8 +208,8 b'' | |||||
206 | "output_type": "stream", |
|
208 | "output_type": "stream", | |
207 | "stream": "stdout", |
|
209 | "stream": "stdout", | |
208 | "text": [ |
|
210 | "text": [ | |
209 | "Loaded, file contents: \n", |
|
211 | "Loaded, file contents: Hello World!\n", | |
210 |
" |
|
212 | "\n" | |
211 | ] |
|
213 | ] | |
212 | } |
|
214 | } | |
213 | ], |
|
215 | ], |
@@ -16,7 +16,8 b'' | |||||
16 | "import os\n", |
|
16 | "import os\n", | |
17 | "\n", |
|
17 | "\n", | |
18 | "from IPython.html import widgets\n", |
|
18 | "from IPython.html import widgets\n", | |
19 | "from IPython.display import display" |
|
19 | "from IPython.display import display\n", | |
|
20 | "from IPython.utils.py3compat import bytes_to_str, string_types" | |||
20 | ], |
|
21 | ], | |
21 | "language": "python", |
|
22 | "language": "python", | |
22 | "metadata": {}, |
|
23 | "metadata": {}, | |
@@ -91,7 +92,7 b'' | |||||
91 | " try:\n", |
|
92 | " try:\n", | |
92 | " stdout = process.stdout.read()\n", |
|
93 | " stdout = process.stdout.read()\n", | |
93 | " if stdout is not None and len(stdout) > 0:\n", |
|
94 | " if stdout is not None and len(stdout) > 0:\n", | |
94 | " append_output(stdout)\n", |
|
95 | " append_output(stdout, prefix=' ')\n", | |
95 | " except:\n", |
|
96 | " except:\n", | |
96 | " pass\n", |
|
97 | " pass\n", | |
97 | " \n", |
|
98 | " \n", | |
@@ -166,8 +167,13 b'' | |||||
166 | "cell_type": "code", |
|
167 | "cell_type": "code", | |
167 | "collapsed": false, |
|
168 | "collapsed": false, | |
168 | "input": [ |
|
169 | "input": [ | |
169 | "def append_output(output, prefix=' '):\n", |
|
170 | "\n", | |
170 | " output_lines = output.split('\\n')\n", |
|
171 | "def append_output(output, prefix):\n", | |
|
172 | " if isinstance(output, string_types):\n", | |||
|
173 | " output_str = output\n", | |||
|
174 | " else:\n", | |||
|
175 | " output_str = bytes_to_str(output)\n", | |||
|
176 | " output_lines = output_str.split('\\n')\n", | |||
171 | " formatted_output = '\\n'.join([prefix + line for line in output_lines if len(line) > 0]) + '\\n'\n", |
|
177 | " formatted_output = '\\n'.join([prefix + line for line in output_lines if len(line) > 0]) + '\\n'\n", | |
172 | " output_box.value += formatted_output\n", |
|
178 | " output_box.value += formatted_output\n", | |
173 | " output_box.scroll_to_bottom()\n", |
|
179 | " output_box.scroll_to_bottom()\n", |
@@ -17,6 +17,8 b'' | |||||
17 | "cell_type": "code", |
|
17 | "cell_type": "code", | |
18 | "collapsed": false, |
|
18 | "collapsed": false, | |
19 | "input": [ |
|
19 | "input": [ | |
|
20 | "from __future__ import print_function # 2.7 compatability\n", | |||
|
21 | "\n", | |||
20 | "from IPython.html import widgets # Widget definitions\n", |
|
22 | "from IPython.html import widgets # Widget definitions\n", | |
21 | "from IPython.display import display # Used to display widgets in the notebook" |
|
23 | "from IPython.display import display # Used to display widgets in the notebook" | |
22 | ], |
|
24 | ], | |
@@ -104,7 +106,7 b'' | |||||
104 | "display(intrange)\n", |
|
106 | "display(intrange)\n", | |
105 | "\n", |
|
107 | "\n", | |
106 | "def on_value_change(name, value):\n", |
|
108 | "def on_value_change(name, value):\n", | |
107 |
" print |
|
109 | " print(value)\n", | |
108 | "\n", |
|
110 | "\n", | |
109 | "intrange.on_trait_change(on_value_change, 'value')" |
|
111 | "intrange.on_trait_change(on_value_change, 'value')" | |
110 | ], |
|
112 | ], | |
@@ -115,21 +117,21 b'' | |||||
115 | "output_type": "stream", |
|
117 | "output_type": "stream", | |
116 | "stream": "stdout", |
|
118 | "stream": "stdout", | |
117 | "text": [ |
|
119 | "text": [ | |
118 |
"2 |
|
120 | "28\n" | |
119 | ] |
|
121 | ] | |
120 | }, |
|
122 | }, | |
121 | { |
|
123 | { | |
122 | "output_type": "stream", |
|
124 | "output_type": "stream", | |
123 | "stream": "stdout", |
|
125 | "stream": "stdout", | |
124 | "text": [ |
|
126 | "text": [ | |
125 |
" |
|
127 | "55\n" | |
126 | ] |
|
128 | ] | |
127 | }, |
|
129 | }, | |
128 | { |
|
130 | { | |
129 | "output_type": "stream", |
|
131 | "output_type": "stream", | |
130 | "stream": "stdout", |
|
132 | "stream": "stdout", | |
131 | "text": [ |
|
133 | "text": [ | |
132 |
"9 |
|
134 | "94\n" | |
133 | ] |
|
135 | ] | |
134 | } |
|
136 | } | |
135 | ], |
|
137 | ], |
@@ -29,6 +29,8 b'' | |||||
29 | "cell_type": "code", |
|
29 | "cell_type": "code", | |
30 | "collapsed": false, |
|
30 | "collapsed": false, | |
31 | "input": [ |
|
31 | "input": [ | |
|
32 | "from __future__ import print_function # For py 2.7 compat\n", | |||
|
33 | "\n", | |||
32 | "from IPython.html import widgets # Widget definitions\n", |
|
34 | "from IPython.html import widgets # Widget definitions\n", | |
33 | "from IPython.display import display # Used to display widgets in the notebook" |
|
35 | "from IPython.display import display # Used to display widgets in the notebook" | |
34 | ], |
|
36 | ], | |
@@ -38,6 +40,25 b'' | |||||
38 | "prompt_number": 1 |
|
40 | "prompt_number": 1 | |
39 | }, |
|
41 | }, | |
40 | { |
|
42 | { | |
|
43 | "cell_type": "markdown", | |||
|
44 | "metadata": {}, | |||
|
45 | "source": [ | |||
|
46 | "The 3 part of this tutorial requires the 3rd party `dateutil` library. https://pypi.python.org/pypi/python-dateutil" | |||
|
47 | ] | |||
|
48 | }, | |||
|
49 | { | |||
|
50 | "cell_type": "code", | |||
|
51 | "collapsed": false, | |||
|
52 | "input": [ | |||
|
53 | "# Import the dateutil library to parse date strings.\n", | |||
|
54 | "from dateutil import parser" | |||
|
55 | ], | |||
|
56 | "language": "python", | |||
|
57 | "metadata": {}, | |||
|
58 | "outputs": [], | |||
|
59 | "prompt_number": 2 | |||
|
60 | }, | |||
|
61 | { | |||
41 | "cell_type": "heading", |
|
62 | "cell_type": "heading", | |
42 | "level": 1, |
|
63 | "level": 1, | |
43 | "metadata": {}, |
|
64 | "metadata": {}, | |
@@ -91,7 +112,7 b'' | |||||
91 | "language": "python", |
|
112 | "language": "python", | |
92 | "metadata": {}, |
|
113 | "metadata": {}, | |
93 | "outputs": [], |
|
114 | "outputs": [], | |
94 |
"prompt_number": |
|
115 | "prompt_number": 3 | |
95 | }, |
|
116 | }, | |
96 | { |
|
117 | { | |
97 | "cell_type": "markdown", |
|
118 | "cell_type": "markdown", | |
@@ -139,11 +160,11 b'' | |||||
139 | "metadata": {}, |
|
160 | "metadata": {}, | |
140 | "output_type": "display_data", |
|
161 | "output_type": "display_data", | |
141 | "text": [ |
|
162 | "text": [ | |
142 |
"<IPython.core.display.Javascript at 0x |
|
163 | "<IPython.core.display.Javascript at 0x7f8c679289d0>" | |
143 | ] |
|
164 | ] | |
144 | } |
|
165 | } | |
145 | ], |
|
166 | ], | |
146 |
"prompt_number": |
|
167 | "prompt_number": 4 | |
147 | }, |
|
168 | }, | |
148 | { |
|
169 | { | |
149 | "cell_type": "markdown", |
|
170 | "cell_type": "markdown", | |
@@ -181,11 +202,11 b'' | |||||
181 | "metadata": {}, |
|
202 | "metadata": {}, | |
182 | "output_type": "display_data", |
|
203 | "output_type": "display_data", | |
183 | "text": [ |
|
204 | "text": [ | |
184 |
"<IPython.core.display.Javascript at 0x |
|
205 | "<IPython.core.display.Javascript at 0x7f8c67928510>" | |
185 | ] |
|
206 | ] | |
186 | } |
|
207 | } | |
187 | ], |
|
208 | ], | |
188 |
"prompt_number": |
|
209 | "prompt_number": 5 | |
189 | }, |
|
210 | }, | |
190 | { |
|
211 | { | |
191 | "cell_type": "markdown", |
|
212 | "cell_type": "markdown", | |
@@ -249,11 +270,11 b'' | |||||
249 | "metadata": {}, |
|
270 | "metadata": {}, | |
250 | "output_type": "display_data", |
|
271 | "output_type": "display_data", | |
251 | "text": [ |
|
272 | "text": [ | |
252 |
"<IPython.core.display.Javascript at 0x |
|
273 | "<IPython.core.display.Javascript at 0x7f8c67928a10>" | |
253 | ] |
|
274 | ] | |
254 | } |
|
275 | } | |
255 | ], |
|
276 | ], | |
256 |
"prompt_number": |
|
277 | "prompt_number": 6 | |
257 | }, |
|
278 | }, | |
258 | { |
|
279 | { | |
259 | "cell_type": "heading", |
|
280 | "cell_type": "heading", | |
@@ -280,7 +301,7 b'' | |||||
280 | "language": "python", |
|
301 | "language": "python", | |
281 | "metadata": {}, |
|
302 | "metadata": {}, | |
282 | "outputs": [], |
|
303 | "outputs": [], | |
283 |
"prompt_number": |
|
304 | "prompt_number": 7 | |
284 | }, |
|
305 | }, | |
285 | { |
|
306 | { | |
286 | "cell_type": "heading", |
|
307 | "cell_type": "heading", | |
@@ -325,7 +346,7 b'' | |||||
325 | "language": "python", |
|
346 | "language": "python", | |
326 | "metadata": {}, |
|
347 | "metadata": {}, | |
327 | "outputs": [], |
|
348 | "outputs": [], | |
328 |
"prompt_number": |
|
349 | "prompt_number": 8 | |
329 | }, |
|
350 | }, | |
330 | { |
|
351 | { | |
331 | "cell_type": "heading", |
|
352 | "cell_type": "heading", | |
@@ -405,11 +426,11 b'' | |||||
405 | "metadata": {}, |
|
426 | "metadata": {}, | |
406 | "output_type": "display_data", |
|
427 | "output_type": "display_data", | |
407 | "text": [ |
|
428 | "text": [ | |
408 |
"<IPython.core.display.Javascript at 0x |
|
429 | "<IPython.core.display.Javascript at 0x7f8c67928590>" | |
409 | ] |
|
430 | ] | |
410 | } |
|
431 | } | |
411 | ], |
|
432 | ], | |
412 |
"prompt_number": |
|
433 | "prompt_number": 9 | |
413 | }, |
|
434 | }, | |
414 | { |
|
435 | { | |
415 | "cell_type": "markdown", |
|
436 | "cell_type": "markdown", | |
@@ -495,11 +516,11 b'' | |||||
495 | "metadata": {}, |
|
516 | "metadata": {}, | |
496 | "output_type": "display_data", |
|
517 | "output_type": "display_data", | |
497 | "text": [ |
|
518 | "text": [ | |
498 |
"<IPython.core.display.Javascript at 0x |
|
519 | "<IPython.core.display.Javascript at 0x7f8c648ce8d0>" | |
499 | ] |
|
520 | ] | |
500 | } |
|
521 | } | |
501 | ], |
|
522 | ], | |
502 |
"prompt_number": |
|
523 | "prompt_number": 10 | |
503 | }, |
|
524 | }, | |
504 | { |
|
525 | { | |
505 | "cell_type": "markdown", |
|
526 | "cell_type": "markdown", | |
@@ -613,11 +634,11 b'' | |||||
613 | "metadata": {}, |
|
634 | "metadata": {}, | |
614 | "output_type": "display_data", |
|
635 | "output_type": "display_data", | |
615 | "text": [ |
|
636 | "text": [ | |
616 |
"<IPython.core.display.Javascript at 0x |
|
637 | "<IPython.core.display.Javascript at 0x7f8c648ce150>" | |
617 | ] |
|
638 | ] | |
618 | } |
|
639 | } | |
619 | ], |
|
640 | ], | |
620 |
"prompt_number": 1 |
|
641 | "prompt_number": 11 | |
621 | }, |
|
642 | }, | |
622 | { |
|
643 | { | |
623 | "cell_type": "heading", |
|
644 | "cell_type": "heading", | |
@@ -644,7 +665,7 b'' | |||||
644 | "language": "python", |
|
665 | "language": "python", | |
645 | "metadata": {}, |
|
666 | "metadata": {}, | |
646 | "outputs": [], |
|
667 | "outputs": [], | |
647 |
"prompt_number": 1 |
|
668 | "prompt_number": 12 | |
648 | }, |
|
669 | }, | |
649 | { |
|
670 | { | |
650 | "cell_type": "markdown", |
|
671 | "cell_type": "markdown", | |
@@ -662,7 +683,7 b'' | |||||
662 | "language": "python", |
|
683 | "language": "python", | |
663 | "metadata": {}, |
|
684 | "metadata": {}, | |
664 | "outputs": [], |
|
685 | "outputs": [], | |
665 |
"prompt_number": 1 |
|
686 | "prompt_number": 13 | |
666 | }, |
|
687 | }, | |
667 | { |
|
688 | { | |
668 | "cell_type": "markdown", |
|
689 | "cell_type": "markdown", | |
@@ -683,13 +704,13 b'' | |||||
683 | { |
|
704 | { | |
684 | "metadata": {}, |
|
705 | "metadata": {}, | |
685 | "output_type": "pyout", |
|
706 | "output_type": "pyout", | |
686 |
"prompt_number": 1 |
|
707 | "prompt_number": 14, | |
687 | "text": [ |
|
708 | "text": [ | |
688 |
" |
|
709 | "'2013-11-28'" | |
689 | ] |
|
710 | ] | |
690 | } |
|
711 | } | |
691 | ], |
|
712 | ], | |
692 |
"prompt_number": 1 |
|
713 | "prompt_number": 14 | |
693 | }, |
|
714 | }, | |
694 | { |
|
715 | { | |
695 | "cell_type": "markdown", |
|
716 | "cell_type": "markdown", | |
@@ -707,7 +728,7 b'' | |||||
707 | "language": "python", |
|
728 | "language": "python", | |
708 | "metadata": {}, |
|
729 | "metadata": {}, | |
709 | "outputs": [], |
|
730 | "outputs": [], | |
710 |
"prompt_number": 1 |
|
731 | "prompt_number": 15 | |
711 | }, |
|
732 | }, | |
712 | { |
|
733 | { | |
713 | "cell_type": "heading", |
|
734 | "cell_type": "heading", | |
@@ -765,7 +786,7 b'' | |||||
765 | "language": "python", |
|
786 | "language": "python", | |
766 | "metadata": {}, |
|
787 | "metadata": {}, | |
767 | "outputs": [], |
|
788 | "outputs": [], | |
768 |
"prompt_number": 1 |
|
789 | "prompt_number": 16 | |
769 | }, |
|
790 | }, | |
770 | { |
|
791 | { | |
771 | "cell_type": "markdown", |
|
792 | "cell_type": "markdown", | |
@@ -778,8 +799,6 b'' | |||||
778 | "cell_type": "code", |
|
799 | "cell_type": "code", | |
779 | "collapsed": false, |
|
800 | "collapsed": false, | |
780 | "input": [ |
|
801 | "input": [ | |
781 | "# Import the dateutil library to parse date strings.\n", |
|
|||
782 | "from dateutil import parser\n", |
|
|||
783 | "\n", |
|
802 | "\n", | |
784 | "# Import the base Widget class and the traitlets Unicode class.\n", |
|
803 | "# Import the base Widget class and the traitlets Unicode class.\n", | |
785 | "from IPython.html.widgets import Widget\n", |
|
804 | "from IPython.html.widgets import Widget\n", | |
@@ -812,7 +831,7 b'' | |||||
812 | "language": "python", |
|
831 | "language": "python", | |
813 | "metadata": {}, |
|
832 | "metadata": {}, | |
814 | "outputs": [], |
|
833 | "outputs": [], | |
815 |
"prompt_number": 1 |
|
834 | "prompt_number": 17 | |
816 | }, |
|
835 | }, | |
817 | { |
|
836 | { | |
818 | "cell_type": "markdown", |
|
837 | "cell_type": "markdown", | |
@@ -860,7 +879,7 b'' | |||||
860 | "language": "python", |
|
879 | "language": "python", | |
861 | "metadata": {}, |
|
880 | "metadata": {}, | |
862 | "outputs": [], |
|
881 | "outputs": [], | |
863 |
"prompt_number": 1 |
|
882 | "prompt_number": 18 | |
864 | }, |
|
883 | }, | |
865 | { |
|
884 | { | |
866 | "cell_type": "markdown", |
|
885 | "cell_type": "markdown", | |
@@ -938,7 +957,7 b'' | |||||
938 | "language": "python", |
|
957 | "language": "python", | |
939 | "metadata": {}, |
|
958 | "metadata": {}, | |
940 | "outputs": [], |
|
959 | "outputs": [], | |
941 |
"prompt_number": 1 |
|
960 | "prompt_number": 19 | |
942 | }, |
|
961 | }, | |
943 | { |
|
962 | { | |
944 | "cell_type": "heading", |
|
963 | "cell_type": "heading", | |
@@ -1094,11 +1113,11 b'' | |||||
1094 | "metadata": {}, |
|
1113 | "metadata": {}, | |
1095 | "output_type": "display_data", |
|
1114 | "output_type": "display_data", | |
1096 | "text": [ |
|
1115 | "text": [ | |
1097 |
"<IPython.core.display.Javascript at 0x |
|
1116 | "<IPython.core.display.Javascript at 0x7f8c679134d0>" | |
1098 | ] |
|
1117 | ] | |
1099 | } |
|
1118 | } | |
1100 | ], |
|
1119 | ], | |
1101 |
"prompt_number": |
|
1120 | "prompt_number": 20 | |
1102 | }, |
|
1121 | }, | |
1103 | { |
|
1122 | { | |
1104 | "cell_type": "heading", |
|
1123 | "cell_type": "heading", | |
@@ -1129,7 +1148,7 b'' | |||||
1129 | "language": "python", |
|
1148 | "language": "python", | |
1130 | "metadata": {}, |
|
1149 | "metadata": {}, | |
1131 | "outputs": [], |
|
1150 | "outputs": [], | |
1132 |
"prompt_number": 2 |
|
1151 | "prompt_number": 21 | |
1133 | }, |
|
1152 | }, | |
1134 | { |
|
1153 | { | |
1135 | "cell_type": "markdown", |
|
1154 | "cell_type": "markdown", | |
@@ -1147,7 +1166,7 b'' | |||||
1147 | "language": "python", |
|
1166 | "language": "python", | |
1148 | "metadata": {}, |
|
1167 | "metadata": {}, | |
1149 | "outputs": [], |
|
1168 | "outputs": [], | |
1150 |
"prompt_number": 2 |
|
1169 | "prompt_number": 22 | |
1151 | }, |
|
1170 | }, | |
1152 | { |
|
1171 | { | |
1153 | "cell_type": "markdown", |
|
1172 | "cell_type": "markdown", | |
@@ -1170,7 +1189,7 b'' | |||||
1170 | "language": "python", |
|
1189 | "language": "python", | |
1171 | "metadata": {}, |
|
1190 | "metadata": {}, | |
1172 | "outputs": [], |
|
1191 | "outputs": [], | |
1173 |
"prompt_number": 2 |
|
1192 | "prompt_number": 23 | |
1174 | }, |
|
1193 | }, | |
1175 | { |
|
1194 | { | |
1176 | "cell_type": "code", |
|
1195 | "cell_type": "code", | |
@@ -1182,7 +1201,7 b'' | |||||
1182 | "language": "python", |
|
1201 | "language": "python", | |
1183 | "metadata": {}, |
|
1202 | "metadata": {}, | |
1184 | "outputs": [], |
|
1203 | "outputs": [], | |
1185 |
"prompt_number": 2 |
|
1204 | "prompt_number": 24 | |
1186 | }, |
|
1205 | }, | |
1187 | { |
|
1206 | { | |
1188 | "cell_type": "code", |
|
1207 | "cell_type": "code", | |
@@ -1194,7 +1213,7 b'' | |||||
1194 | "language": "python", |
|
1213 | "language": "python", | |
1195 | "metadata": {}, |
|
1214 | "metadata": {}, | |
1196 | "outputs": [], |
|
1215 | "outputs": [], | |
1197 |
"prompt_number": 2 |
|
1216 | "prompt_number": 25 | |
1198 | } |
|
1217 | } | |
1199 | ], |
|
1218 | ], | |
1200 | "metadata": {} |
|
1219 | "metadata": {} |
@@ -33,103 +33,6 b'' | |||||
33 | "level": 3, |
|
33 | "level": 3, | |
34 | "metadata": {}, |
|
34 | "metadata": {}, | |
35 | "source": [ |
|
35 | "source": [ | |
36 | "Custom SidePanel View" |
|
|||
37 | ] |
|
|||
38 | }, |
|
|||
39 | { |
|
|||
40 | "cell_type": "code", |
|
|||
41 | "collapsed": false, |
|
|||
42 | "input": [ |
|
|||
43 | "%%javascript\n", |
|
|||
44 | "\n", |
|
|||
45 | "require([\"notebook/js/widget\"], function(){\n", |
|
|||
46 | "\n", |
|
|||
47 | " // Define the FilePickerView\n", |
|
|||
48 | " var SidePanelView = IPython.WidgetView.extend({\n", |
|
|||
49 | " \n", |
|
|||
50 | " render: function(){ \n", |
|
|||
51 | " var table_div = $('<div />', {id: 'var_inspect'})\n", |
|
|||
52 | " .addClass('hbox');\n", |
|
|||
53 | " var body_div = $('<div />')\n", |
|
|||
54 | " .css('width', '80%')\n", |
|
|||
55 | " .css('height', '100%')\n", |
|
|||
56 | " .appendTo(table_div);\n", |
|
|||
57 | " this.panel_div = $('<div />')\n", |
|
|||
58 | " .css('width', '20%')\n", |
|
|||
59 | " .css('height', '100%')\n", |
|
|||
60 | " .appendTo(table_div);\n", |
|
|||
61 | " \n", |
|
|||
62 | " var body = $('body');\n", |
|
|||
63 | " var site = body.find('#site');\n", |
|
|||
64 | " site.detach();\n", |
|
|||
65 | " body.find('#var_inspect').remove();\n", |
|
|||
66 | " body.append(table_div);\n", |
|
|||
67 | " site.appendTo(body_div);\n", |
|
|||
68 | " },\n", |
|
|||
69 | "\n", |
|
|||
70 | " display_child: function(view) {\n", |
|
|||
71 | " this.panel_div.append(view.$el);\n", |
|
|||
72 | " },\n", |
|
|||
73 | " });\n", |
|
|||
74 | " \n", |
|
|||
75 | " // Register the DatePickerView with the widget manager.\n", |
|
|||
76 | " IPython.widget_manager.register_widget_view('SidePanelView', SidePanelView);\n", |
|
|||
77 | "});" |
|
|||
78 | ], |
|
|||
79 | "language": "python", |
|
|||
80 | "metadata": {}, |
|
|||
81 | "outputs": [ |
|
|||
82 | { |
|
|||
83 | "javascript": [ |
|
|||
84 | "\n", |
|
|||
85 | "require([\"notebook/js/widget\"], function(){\n", |
|
|||
86 | "\n", |
|
|||
87 | " // Define the FilePickerView\n", |
|
|||
88 | " var SidePanelView = IPython.WidgetView.extend({\n", |
|
|||
89 | " \n", |
|
|||
90 | " render: function(){ \n", |
|
|||
91 | " var table_div = $('<div />', {id: 'var_inspect'})\n", |
|
|||
92 | " .addClass('hbox');\n", |
|
|||
93 | " var body_div = $('<div />')\n", |
|
|||
94 | " .css('width', '80%')\n", |
|
|||
95 | " .css('height', '100%')\n", |
|
|||
96 | " .appendTo(table_div);\n", |
|
|||
97 | " this.panel_div = $('<div />')\n", |
|
|||
98 | " .css('width', '20%')\n", |
|
|||
99 | " .css('height', '100%')\n", |
|
|||
100 | " .appendTo(table_div);\n", |
|
|||
101 | " \n", |
|
|||
102 | " var body = $('body');\n", |
|
|||
103 | " var site = body.find('#site');\n", |
|
|||
104 | " site.detach();\n", |
|
|||
105 | " body.find('#var_inspect').remove();\n", |
|
|||
106 | " body.append(table_div);\n", |
|
|||
107 | " site.appendTo(body_div);\n", |
|
|||
108 | " },\n", |
|
|||
109 | "\n", |
|
|||
110 | " display_child: function(view) {\n", |
|
|||
111 | " this.panel_div.append(view.$el);\n", |
|
|||
112 | " },\n", |
|
|||
113 | " });\n", |
|
|||
114 | " \n", |
|
|||
115 | " // Register the DatePickerView with the widget manager.\n", |
|
|||
116 | " IPython.widget_manager.register_widget_view('SidePanelView', SidePanelView);\n", |
|
|||
117 | "});" |
|
|||
118 | ], |
|
|||
119 | "metadata": {}, |
|
|||
120 | "output_type": "display_data", |
|
|||
121 | "text": [ |
|
|||
122 | "<IPython.core.display.Javascript at 0x7f4e70015050>" |
|
|||
123 | ] |
|
|||
124 | } |
|
|||
125 | ], |
|
|||
126 | "prompt_number": 2 |
|
|||
127 | }, |
|
|||
128 | { |
|
|||
129 | "cell_type": "heading", |
|
|||
130 | "level": 3, |
|
|||
131 | "metadata": {}, |
|
|||
132 | "source": [ |
|
|||
133 | "Create Variable Inspector Controls" |
|
36 | "Create Variable Inspector Controls" | |
134 | ] |
|
37 | ] | |
135 | }, |
|
38 | }, | |
@@ -137,39 +40,31 b'' | |||||
137 | "cell_type": "code", |
|
40 | "cell_type": "code", | |
138 | "collapsed": false, |
|
41 | "collapsed": false, | |
139 | "input": [ |
|
42 | "input": [ | |
140 |
"_ |
|
43 | "_popout = widgets.ContainerWidget(default_view_name=\"ModalView\")\n", | |
|
44 | "_popout.description = \"Variable Inspector\"\n", | |||
|
45 | "_popout.button_text = _popout.description\n", | |||
|
46 | "_popout.vbox()\n", | |||
141 | "\n", |
|
47 | "\n", | |
142 |
"_modal_ |
|
48 | "_modal_header_execs_label = widgets.StringWidget(parent=_popout, default_view_name=\"LabelView\")\n", | |
143 | "_modal_div.set_css({'padding-top': '60px',\n", |
|
|||
144 | " 'padding-right': '40px',\n", |
|
|||
145 | " 'padding-left': '10px',})\n", |
|
|||
146 | "\n", |
|
|||
147 | "_modal_header = widgets.ContainerWidget(parent=_modal_div)\n", |
|
|||
148 | "_modal_header_label = widgets.StringWidget(parent=_modal_header, default_view_name=\"LabelView\")\n", |
|
|||
149 | "_modal_header_label.value = '<h3>Variable Inspector</h3>'\n", |
|
|||
150 | "_modal_header_execs_label = widgets.StringWidget(parent=_modal_header, default_view_name=\"LabelView\")\n", |
|
|||
151 | "_modal_header_execs_label.execs = 0\n", |
|
49 | "_modal_header_execs_label.execs = 0\n", | |
152 | "\n", |
|
50 | "\n", | |
153 |
"_modal_body = widgets.ContainerWidget(parent=_ |
|
51 | "_modal_body = widgets.ContainerWidget(parent=_popout)\n", | |
154 |
"_modal_body. |
|
52 | "_modal_body.flex1()\n", | |
155 | "\n", |
|
53 | "_modal_body.set_css('overflow-y', 'scroll')\n", | |
156 | "_modal_body_label = widgets.StringWidget(parent=_modal_body, default_view_name=\"LabelView\")\n", |
|
54 | "_modal_body_label = widgets.StringWidget(parent=_modal_body, default_view_name=\"LabelView\")\n", | |
157 | "_modal_body_label.value = 'Not hooked'\n", |
|
55 | "_modal_body_label.value = 'Not hooked'\n", | |
158 | "\n", |
|
56 | "\n", | |
159 |
"_modal_footer = widgets.ContainerWidget(parent=_ |
|
57 | "_modal_footer = widgets.ContainerWidget(parent=_popout)\n", | |
160 | "_modal_footer.vbox()\n", |
|
|||
161 | "_var_filter = widgets.SelectionWidget(values=['Public', 'Private', 'IPython'], parent=_modal_footer, value='Public', default_view_name='ToggleButtonsView')\n", |
|
58 | "_var_filter = widgets.SelectionWidget(values=['Public', 'Private', 'IPython'], parent=_modal_footer, value='Public', default_view_name='ToggleButtonsView')\n", | |
162 | "\n", |
|
59 | "\n", | |
163 |
"display(_ |
|
60 | "display(_popout)\n", | |
164 | "\n", |
|
61 | "\n", | |
165 | "_modal_header.add_class('modal-header')\n", |
|
|||
166 | "_modal_body.add_class('modal-body')\n", |
|
|||
167 | "_modal_footer.add_class('modal-footer')\n" |
|
62 | "_modal_footer.add_class('modal-footer')\n" | |
168 | ], |
|
63 | ], | |
169 | "language": "python", |
|
64 | "language": "python", | |
170 | "metadata": {}, |
|
65 | "metadata": {}, | |
171 | "outputs": [], |
|
66 | "outputs": [], | |
172 |
"prompt_number": |
|
67 | "prompt_number": 2 | |
173 | }, |
|
68 | }, | |
174 | { |
|
69 | { | |
175 | "cell_type": "heading", |
|
70 | "cell_type": "heading", | |
@@ -248,7 +143,7 b'' | |||||
248 | "language": "python", |
|
143 | "language": "python", | |
249 | "metadata": {}, |
|
144 | "metadata": {}, | |
250 | "outputs": [], |
|
145 | "outputs": [], | |
251 |
"prompt_number": |
|
146 | "prompt_number": 3 | |
252 | }, |
|
147 | }, | |
253 | { |
|
148 | { | |
254 | "cell_type": "heading", |
|
149 | "cell_type": "heading", | |
@@ -282,7 +177,7 b'' | |||||
282 | "language": "python", |
|
177 | "language": "python", | |
283 | "metadata": {}, |
|
178 | "metadata": {}, | |
284 | "outputs": [], |
|
179 | "outputs": [], | |
285 |
"prompt_number": |
|
180 | "prompt_number": 4 | |
286 | }, |
|
181 | }, | |
287 | { |
|
182 | { | |
288 | "cell_type": "heading", |
|
183 | "cell_type": "heading", | |
@@ -301,7 +196,7 b'' | |||||
301 | "language": "python", |
|
196 | "language": "python", | |
302 | "metadata": {}, |
|
197 | "metadata": {}, | |
303 | "outputs": [], |
|
198 | "outputs": [], | |
304 |
"prompt_number": |
|
199 | "prompt_number": 5 | |
305 | }, |
|
200 | }, | |
306 | { |
|
201 | { | |
307 | "cell_type": "code", |
|
202 | "cell_type": "code", | |
@@ -312,7 +207,7 b'' | |||||
312 | "language": "python", |
|
207 | "language": "python", | |
313 | "metadata": {}, |
|
208 | "metadata": {}, | |
314 | "outputs": [], |
|
209 | "outputs": [], | |
315 |
"prompt_number": |
|
210 | "prompt_number": 6 | |
316 | }, |
|
211 | }, | |
317 | { |
|
212 | { | |
318 | "cell_type": "code", |
|
213 | "cell_type": "code", | |
@@ -323,7 +218,7 b'' | |||||
323 | "language": "python", |
|
218 | "language": "python", | |
324 | "metadata": {}, |
|
219 | "metadata": {}, | |
325 | "outputs": [], |
|
220 | "outputs": [], | |
326 |
"prompt_number": |
|
221 | "prompt_number": 7 | |
327 | }, |
|
222 | }, | |
328 | { |
|
223 | { | |
329 | "cell_type": "code", |
|
224 | "cell_type": "code", | |
@@ -334,7 +229,7 b'' | |||||
334 | "language": "python", |
|
229 | "language": "python", | |
335 | "metadata": {}, |
|
230 | "metadata": {}, | |
336 | "outputs": [], |
|
231 | "outputs": [], | |
337 |
"prompt_number": |
|
232 | "prompt_number": 8 | |
338 | }, |
|
233 | }, | |
339 | { |
|
234 | { | |
340 | "cell_type": "code", |
|
235 | "cell_type": "code", | |
@@ -345,7 +240,7 b'' | |||||
345 | "language": "python", |
|
240 | "language": "python", | |
346 | "metadata": {}, |
|
241 | "metadata": {}, | |
347 | "outputs": [], |
|
242 | "outputs": [], | |
348 |
"prompt_number": |
|
243 | "prompt_number": 9 | |
349 | } |
|
244 | } | |
350 | ], |
|
245 | ], | |
351 | "metadata": {} |
|
246 | "metadata": {} |
General Comments 0
You need to be logged in to leave comments.
Login now