Show More
@@ -18,7 +18,7 b' define(["notebook/js/widget"], function(widget_manager){' | |||||
18 | var StringWidgetModel = IPython.WidgetModel.extend({}); |
|
18 | var StringWidgetModel = IPython.WidgetModel.extend({}); | |
19 | widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel); |
|
19 | widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel); | |
20 |
|
20 | |||
21 |
var L |
|
21 | var HTMLView = IPython.WidgetView.extend({ | |
22 |
|
22 | |||
23 | // Called when view is rendered. |
|
23 | // Called when view is rendered. | |
24 | render : function(){ |
|
24 | render : function(){ | |
@@ -34,7 +34,7 b' define(["notebook/js/widget"], function(widget_manager){' | |||||
34 |
|
34 | |||
35 | }); |
|
35 | }); | |
36 |
|
36 | |||
37 |
widget_manager.register_widget_view('L |
|
37 | widget_manager.register_widget_view('HTMLView', HTMLView); | |
38 |
|
38 | |||
39 | var TextAreaView = IPython.WidgetView.extend({ |
|
39 | var TextAreaView = IPython.WidgetView.extend({ | |
40 |
|
40 |
@@ -967,7 +967,7 b'' | |||||
967 | "metadata": {}, |
|
967 | "metadata": {}, | |
968 | "output_type": "display_data", |
|
968 | "output_type": "display_data", | |
969 | "text": [ |
|
969 | "text": [ | |
970 |
"<IPython.core.display.Javascript at 0x2 |
|
970 | "<IPython.core.display.Javascript at 0x2281b10>" | |
971 | ] |
|
971 | ] | |
972 | } |
|
972 | } | |
973 | ], |
|
973 | ], |
@@ -49,7 +49,7 b'' | |||||
49 | " dialog = widgets.ContainerWidget(visible=False)\n", |
|
49 | " dialog = widgets.ContainerWidget(visible=False)\n", | |
50 | " dialog_header = widgets.ContainerWidget(parent=dialog)\n", |
|
50 | " dialog_header = widgets.ContainerWidget(parent=dialog)\n", | |
51 | " dialog_header_close = widgets.ButtonWidget(parent=dialog_header, description = '×')\n", |
|
51 | " dialog_header_close = widgets.ButtonWidget(parent=dialog_header, description = '×')\n", | |
52 |
" dialog_header_label = widgets.StringWidget(parent=dialog_header, default_view_name='L |
|
52 | " dialog_header_label = widgets.StringWidget(parent=dialog_header, default_view_name='HTMLView')\n", | |
53 | " dialog_body = widgets.ContainerWidget(parent=dialog)\n", |
|
53 | " dialog_body = widgets.ContainerWidget(parent=dialog)\n", | |
54 | " dialog_footer = widgets.ContainerWidget(parent=dialog)\n", |
|
54 | " dialog_footer = widgets.ContainerWidget(parent=dialog)\n", | |
55 | " \n", |
|
55 | " \n", | |
@@ -116,7 +116,7 b'' | |||||
116 | " yes_button.on_click(handle_yes)\n", |
|
116 | " yes_button.on_click(handle_yes)\n", | |
117 | " no_button = widgets.ButtonWidget(parent=dialog_footer, description='No')\n", |
|
117 | " no_button = widgets.ButtonWidget(parent=dialog_footer, description='No')\n", | |
118 | " no_button.on_click(handle_no)\n", |
|
118 | " no_button.on_click(handle_no)\n", | |
119 |
" prompt_label = widgets.StringWidget(parent=dialog_body, value=scrub_text_html(prompt), default_view_name='L |
|
119 | " prompt_label = widgets.StringWidget(parent=dialog_body, value=scrub_text_html(prompt), default_view_name='HTMLView')\n", | |
120 | " \n", |
|
120 | " \n", | |
121 | " display(yes_button)\n", |
|
121 | " display(yes_button)\n", | |
122 | " display(no_button)\n", |
|
122 | " display(no_button)\n", |
@@ -62,14 +62,14 b'' | |||||
62 | "outputs": [ |
|
62 | "outputs": [ | |
63 | { |
|
63 | { | |
64 | "javascript": [ |
|
64 | "javascript": [ | |
65 |
"var model = IPython.notebook.kernel.comm_manager.comms[' |
|
65 | "var model = IPython.notebook.kernel.comm_manager.comms['af0fadc224134034af6141995abf625a'].model;\n", | |
66 | "model.set('value', IPython.notebook.notebook_name);\n", |
|
66 | "model.set('value', IPython.notebook.notebook_name);\n", | |
67 | "model.save();" |
|
67 | "model.save();" | |
68 | ], |
|
68 | ], | |
69 | "metadata": {}, |
|
69 | "metadata": {}, | |
70 | "output_type": "display_data", |
|
70 | "output_type": "display_data", | |
71 | "text": [ |
|
71 | "text": [ | |
72 |
"<IPython.core.display.Javascript at 0x |
|
72 | "<IPython.core.display.Javascript at 0x3756790>" | |
73 | ] |
|
73 | ] | |
74 | } |
|
74 | } | |
75 | ], |
|
75 | ], | |
@@ -117,7 +117,7 b'' | |||||
117 | "exporter_names = widgets.SelectionWidget(parent=options, values=get_export_names(), value='html')\n", |
|
117 | "exporter_names = widgets.SelectionWidget(parent=options, values=get_export_names(), value='html')\n", | |
118 | "export_button = widgets.ButtonWidget(parent=options, description=\"Export\")\n", |
|
118 | "export_button = widgets.ButtonWidget(parent=options, description=\"Export\")\n", | |
119 | "\n", |
|
119 | "\n", | |
120 |
"download_link = widgets.StringWidget(parent=container, default_view_name=\"L |
|
120 | "download_link = widgets.StringWidget(parent=container, default_view_name=\"HTMLView\", visible=False)" | |
121 | ], |
|
121 | ], | |
122 | "language": "python", |
|
122 | "language": "python", | |
123 | "metadata": {}, |
|
123 | "metadata": {}, |
@@ -19,6 +19,7 b'' | |||||
19 | "input": [ |
|
19 | "input": [ | |
20 | "from __future__ import print_function # py 2.7 compat\n", |
|
20 | "from __future__ import print_function # py 2.7 compat\n", | |
21 | "\n", |
|
21 | "\n", | |
|
22 | "import base64\n", | |||
22 | "from IPython.html import widgets # Widget definitions\n", |
|
23 | "from IPython.html import widgets # Widget definitions\n", | |
23 | "from IPython.display import display # Used to display widgets in the notebook" |
|
24 | "from IPython.display import display # Used to display widgets in the notebook" | |
24 | ], |
|
25 | ], |
@@ -313,7 +313,7 b'' | |||||
313 | "| | RadioButtonsView |\n", |
|
313 | "| | RadioButtonsView |\n", | |
314 | "| | *DropdownView* |\n", |
|
314 | "| | *DropdownView* |\n", | |
315 | "| | ListBoxView |\n", |
|
315 | "| | ListBoxView |\n", | |
316 |
"| StringWidget | L |
|
316 | "| StringWidget | HTMLView |\n", | |
317 | "| | TextAreaView |\n", |
|
317 | "| | TextAreaView |\n", | |
318 | "| | *TextBoxView* |\n" |
|
318 | "| | *TextBoxView* |\n" | |
319 | ] |
|
319 | ] |
@@ -130,7 +130,7 b'' | |||||
130 | "container.set_css({'padding': '6px', # Add padding to the container\n", |
|
130 | "container.set_css({'padding': '6px', # Add padding to the container\n", | |
131 | " 'background': 'yellow'}) # Fill the container yellow\n", |
|
131 | " 'background': 'yellow'}) # Fill the container yellow\n", | |
132 | "\n", |
|
132 | "\n", | |
133 |
"label = widgets.StringWidget(default_view_name=\"L |
|
133 | "label = widgets.StringWidget(default_view_name=\"HTMLView\", parent=container)\n", | |
134 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", |
|
134 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", | |
135 | "\n", |
|
135 | "\n", | |
136 | "display(container)" |
|
136 | "display(container)" | |
@@ -197,10 +197,10 b'' | |||||
197 | "input": [ |
|
197 | "input": [ | |
198 | "container = widgets.ContainerWidget()\n", |
|
198 | "container = widgets.ContainerWidget()\n", | |
199 | "container.set_css({'border': '3px solid black',\n", |
|
199 | "container.set_css({'border': '3px solid black',\n", | |
200 | " 'padding': '6px',\n", |
|
200 | " 'padding': '6px', \n", | |
201 | " 'background': 'yellow'}) \n", |
|
201 | " 'background': 'yellow'}) \n", | |
202 | "\n", |
|
202 | "\n", | |
203 |
"label = widgets.StringWidget(default_view_name=\"L |
|
203 | "label = widgets.StringWidget(default_view_name=\"HTMLView\", parent=container)\n", | |
204 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", |
|
204 | "label.value = \"<strong>ALERT: </strong> Hello World!\"\n", | |
205 | "\n", |
|
205 | "\n", | |
206 | "display(container)\n", |
|
206 | "display(container)\n", | |
@@ -223,7 +223,7 b'' | |||||
223 | "collapsed": false, |
|
223 | "collapsed": false, | |
224 | "input": [ |
|
224 | "input": [ | |
225 | "label = widgets.StringWidget(value = \"<strong>ALERT: </strong> Hello World!\")\n", |
|
225 | "label = widgets.StringWidget(value = \"<strong>ALERT: </strong> Hello World!\")\n", | |
226 |
"display(label, view_name=\"L |
|
226 | "display(label, view_name=\"HTMLView\")\n", | |
227 | "\n", |
|
227 | "\n", | |
228 | "# Apply twitter bootstrap alert class to the label.\n", |
|
228 | "# Apply twitter bootstrap alert class to the label.\n", | |
229 | "label.add_class(\"alert\")" |
|
229 | "label.add_class(\"alert\")" | |
@@ -312,7 +312,7 b'' | |||||
312 | "input": [ |
|
312 | "input": [ | |
313 | "import time\n", |
|
313 | "import time\n", | |
314 | "label = widgets.StringWidget(value = \"<strong>ALERT: </strong> Hello World!\")\n", |
|
314 | "label = widgets.StringWidget(value = \"<strong>ALERT: </strong> Hello World!\")\n", | |
315 |
"display(label, view_name=\"L |
|
315 | "display(label, view_name=\"HTMLView\")\n", | |
316 | "\n", |
|
316 | "\n", | |
317 | "# Apply twitter bootstrap alert class to the label.\n", |
|
317 | "# Apply twitter bootstrap alert class to the label.\n", | |
318 | "label.add_class(\"alert\")\n", |
|
318 | "label.add_class(\"alert\")\n", |
@@ -123,7 +123,7 b'' | |||||
123 | "}\n", |
|
123 | "}\n", | |
124 | "\n", |
|
124 | "\n", | |
125 | "def make_container(title):\n", |
|
125 | "def make_container(title):\n", | |
126 |
" display(widgets.StringWidget(default_view_name='L |
|
126 | " display(widgets.StringWidget(default_view_name='HTMLView', value='<h2><br>' + title + '</h2>'))\n", | |
127 | " container = widgets.ContainerWidget()\n", |
|
127 | " container = widgets.ContainerWidget()\n", | |
128 | " container.set_css('background', '#999999')\n", |
|
128 | " container.set_css('background', '#999999')\n", | |
129 | " display(container)\n", |
|
129 | " display(container)\n", | |
@@ -132,7 +132,7 b'' | |||||
132 | "def fill_container(container):\n", |
|
132 | "def fill_container(container):\n", | |
133 | " components = []\n", |
|
133 | " components = []\n", | |
134 | " for i in range(3):\n", |
|
134 | " for i in range(3):\n", | |
135 |
" components.append(widgets.StringWidget(parent=container, default_view_name='L |
|
135 | " components.append(widgets.StringWidget(parent=container, default_view_name='HTMLView', value=\"ABC\"[i]))\n", | |
136 | " components[i].set_css(child_style)\n", |
|
136 | " components[i].set_css(child_style)\n", | |
137 | " display(components[i])\n", |
|
137 | " display(components[i])\n", | |
138 | " \n", |
|
138 | " \n", | |
@@ -197,7 +197,7 b'' | |||||
197 | " components.append(widgets.ContainerWidget(parent=container))\n", |
|
197 | " components.append(widgets.ContainerWidget(parent=container))\n", | |
198 | " components[i].set_css(child_style)\n", |
|
198 | " components[i].set_css(child_style)\n", | |
199 | " \n", |
|
199 | " \n", | |
200 |
" label = widgets.StringWidget(parent=components[i], default_view_name='L |
|
200 | " label = widgets.StringWidget(parent=components[i], default_view_name='HTMLView', value=str(flexes[i]))\n", | |
201 | " \n", |
|
201 | " \n", | |
202 | " if flexes[i] == 0:\n", |
|
202 | " if flexes[i] == 0:\n", | |
203 | " components[i].flex0()\n", |
|
203 | " components[i].flex0()\n", | |
@@ -250,7 +250,7 b'' | |||||
250 | "def fill_container(container):\n", |
|
250 | "def fill_container(container):\n", | |
251 | " components = []\n", |
|
251 | " components = []\n", | |
252 | " for i in range(3):\n", |
|
252 | " for i in range(3):\n", | |
253 |
" components.append(widgets.StringWidget(parent=container, default_view_name='L |
|
253 | " components.append(widgets.StringWidget(parent=container, default_view_name='HTMLView', value=\"ABC\"[i]))\n", | |
254 | " components[i].set_css(child_style)\n", |
|
254 | " components[i].set_css(child_style)\n", | |
255 | " components[i].set_css('height', str((i+1) * 50) + 'px')\n", |
|
255 | " components[i].set_css('height', str((i+1) * 50) + 'px')\n", | |
256 | " display(components[i])\n", |
|
256 | " display(components[i])\n", |
@@ -45,13 +45,13 b'' | |||||
45 | "_popout.button_text = _popout.description\n", |
|
45 | "_popout.button_text = _popout.description\n", | |
46 | "_popout.vbox()\n", |
|
46 | "_popout.vbox()\n", | |
47 | "\n", |
|
47 | "\n", | |
48 |
"_modal_header_execs_label = widgets.StringWidget(parent=_popout, default_view_name=\"L |
|
48 | "_modal_header_execs_label = widgets.StringWidget(parent=_popout, default_view_name=\"HTMLView\")\n", | |
49 | "_modal_header_execs_label.execs = 0\n", |
|
49 | "_modal_header_execs_label.execs = 0\n", | |
50 | "\n", |
|
50 | "\n", | |
51 | "_modal_body = widgets.ContainerWidget(parent=_popout)\n", |
|
51 | "_modal_body = widgets.ContainerWidget(parent=_popout)\n", | |
52 | "_modal_body.flex1()\n", |
|
52 | "_modal_body.flex1()\n", | |
53 | "_modal_body.set_css('overflow-y', 'scroll')\n", |
|
53 | "_modal_body.set_css('overflow-y', 'scroll')\n", | |
54 |
"_modal_body_label = widgets.StringWidget(parent=_modal_body, default_view_name=\"L |
|
54 | "_modal_body_label = widgets.StringWidget(parent=_modal_body, default_view_name=\"HTMLView\")\n", | |
55 | "_modal_body_label.value = 'Not hooked'\n", |
|
55 | "_modal_body_label.value = 'Not hooked'\n", | |
56 | "\n", |
|
56 | "\n", | |
57 | "_modal_footer = widgets.ContainerWidget(parent=_popout)\n", |
|
57 | "_modal_footer = widgets.ContainerWidget(parent=_popout)\n", |
@@ -122,15 +122,15 b'' | |||||
122 | " except:\n", |
|
122 | " except:\n", | |
123 | " pass\n", |
|
123 | " pass\n", | |
124 | " \n", |
|
124 | " \n", | |
125 |
" doc_label = widgets.StringWidget(parent=new_modal,default_view_name='L |
|
125 | " doc_label = widgets.StringWidget(parent=new_modal,default_view_name='HTMLView', value=doc_str)\n", | |
126 | " doc_label.set_css('color', 'blue')\n", |
|
126 | " doc_label.set_css('color', 'blue')\n", | |
127 | " exec_box = widgets.ContainerWidget(parent=new_modal)\n", |
|
127 | " exec_box = widgets.ContainerWidget(parent=new_modal)\n", | |
128 | " exec_box.hbox()\n", |
|
128 | " exec_box.hbox()\n", | |
129 | " exec_box.pack_center()\n", |
|
129 | " exec_box.pack_center()\n", | |
130 | " exec_box.align_center()\n", |
|
130 | " exec_box.align_center()\n", | |
131 |
" open_label = widgets.StringWidget(parent=exec_box,default_view_name='L |
|
131 | " open_label = widgets.StringWidget(parent=exec_box,default_view_name='HTMLView', value=method_name+'( ')\n", | |
132 | " exec_str = widgets.StringWidget(parent=exec_box)\n", |
|
132 | " exec_str = widgets.StringWidget(parent=exec_box)\n", | |
133 |
" close_label = widgets.StringWidget(parent=exec_box,default_view_name='L |
|
133 | " close_label = widgets.StringWidget(parent=exec_box,default_view_name='HTMLView', value=' )')\n", | |
134 | " button_row = widgets.ContainerWidget(parent=new_modal)\n", |
|
134 | " button_row = widgets.ContainerWidget(parent=new_modal)\n", | |
135 | " button_row.hbox()\n", |
|
135 | " button_row.hbox()\n", | |
136 | " button_row.pack_end()\n", |
|
136 | " button_row.pack_end()\n", |
General Comments 0
You need to be logged in to leave comments.
Login now