##// END OF EJS Templates
Renamed widgets......
Jonathan Frederic -
Show More
@@ -16,7 +16,7 b''
16 16
17 17 define(["notebook/js/widgets/widget"], function(WidgetManager){
18 18
19 var CheckBoxView = IPython.DOMWidgetView.extend({
19 var CheckboxView = IPython.DOMWidgetView.extend({
20 20 render : function(){
21 21 // Called when view is rendered.
22 22 this.$el
@@ -63,11 +63,11 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
63 63 this.$label.show();
64 64 }
65 65 }
66 return CheckBoxView.__super__.update.apply(this);
66 return CheckboxView.__super__.update.apply(this);
67 67 },
68 68
69 69 });
70 WidgetManager.register_widget_view('CheckBoxView', CheckBoxView);
70 WidgetManager.register_widget_view('CheckboxView', CheckboxView);
71 71
72 72
73 73 var ToggleButtonView = IPython.DOMWidgetView.extend({
@@ -292,7 +292,7 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
292 292 WidgetManager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
293 293
294 294
295 var ListBoxView = IPython.DOMWidgetView.extend({
295 var SelectView = IPython.DOMWidgetView.extend({
296 296 render : function(){
297 297 // Called when view is rendered.
298 298 this.$el
@@ -360,7 +360,7 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
360 360 this.$label.show();
361 361 }
362 362 }
363 return ListBoxView.__super__.update.apply(this);
363 return SelectView.__super__.update.apply(this);
364 364 },
365 365
366 366 handle_click: function (e) {
@@ -372,5 +372,5 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
372 372 this.touch();
373 373 },
374 374 });
375 WidgetManager.register_widget_view('ListBoxView', ListBoxView);
375 WidgetManager.register_widget_view('SelectView', SelectView);
376 376 });
@@ -54,7 +54,7 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
54 54 WidgetManager.register_widget_view('LatexView', LatexView);
55 55
56 56
57 var TextAreaView = IPython.DOMWidgetView.extend({
57 var TextareaView = IPython.DOMWidgetView.extend({
58 58 render: function(){
59 59 // Called when view is rendered.
60 60 this.$el
@@ -104,7 +104,7 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
104 104 this.$label.show();
105 105 }
106 106 }
107 return TextAreaView.__super__.update.apply(this);
107 return TextareaView.__super__.update.apply(this);
108 108 },
109 109
110 110 events: {
@@ -123,10 +123,10 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
123 123 this.touch();
124 124 },
125 125 });
126 WidgetManager.register_widget_view('TextAreaView', TextAreaView);
126 WidgetManager.register_widget_view('TextareaView', TextareaView);
127 127
128 128
129 var TextBoxView = IPython.DOMWidgetView.extend({
129 var TextView = IPython.DOMWidgetView.extend({
130 130 render: function(){
131 131 // Called when view is rendered.
132 132 this.$el
@@ -164,7 +164,7 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
164 164 this.$label.show();
165 165 }
166 166 }
167 return TextBoxView.__super__.update.apply(this);
167 return TextView.__super__.update.apply(this);
168 168 },
169 169
170 170 events: {
@@ -218,5 +218,5 b' define(["notebook/js/widgets/widget"], function(WidgetManager){'
218 218 }
219 219 },
220 220 });
221 WidgetManager.register_widget_view('TextBoxView', TextBoxView);
221 WidgetManager.register_widget_view('TextView', TextView);
222 222 });
@@ -27,7 +27,7 b' casper.notebook_test(function () {'
27 27
28 28 throttle_index = this.append_cell(
29 29 'import time\n' +
30 'textbox = widgets.TextBoxWidget()\n' +
30 'textbox = widgets.TextWidget()\n' +
31 31 'display(textbox)\n'+
32 32 'textbox.add_class("my-throttle-textbox")\n' +
33 33 'def handle_change(name, old, new):\n' +
@@ -7,7 +7,7 b' casper.notebook_test(function () {'
7 7 this.execute_cell_then(index);
8 8
9 9 var bool_index = this.append_cell(
10 'bool_widgets = [widgets.CheckBoxWidget(description="Title", value=True),\n' +
10 'bool_widgets = [widgets.CheckboxWidget(description="Title", value=True),\n' +
11 11 ' widgets.ToggleButtonWidget(description="Title", value=True)]\n' +
12 12 'display(bool_widgets[0])\n' +
13 13 'display(bool_widgets[1])\n' +
@@ -10,9 +10,9 b' casper.notebook_test(function () {'
10 10 var multicontainer1_query = '.widget-area .widget-subarea div div.nav-tabs';
11 11 var multicontainer1_index = this.append_cell(
12 12 'multicontainer = widgets.TabWidget()\n' +
13 'page1 = widgets.TextBoxWidget()\n' +
14 'page2 = widgets.TextBoxWidget()\n' +
15 'page3 = widgets.TextBoxWidget()\n' +
13 'page1 = widgets.TextWidget()\n' +
14 'page2 = widgets.TextWidget()\n' +
15 'page3 = widgets.TextWidget()\n' +
16 16 'multicontainer.children = [page1, page2, page3]\n' +
17 17 'display(multicontainer)\n' +
18 18 'multicontainer.selected_index = 0\n' +
@@ -47,7 +47,7 b' casper.notebook_test(function () {'
47 47 'selection = [widgets.DropdownWidget(values=values),\n' +
48 48 ' widgets.ToggleButtonsWidget(values=values),\n' +
49 49 ' widgets.RadioButtonsWidget(values=values),\n' +
50 ' widgets.ListBoxWidget(values=values)]\n' +
50 ' widgets.SelectWidget(values=values)]\n' +
51 51 '[display(selection[i]) for i in range(4)]\n' +
52 52 'for widget in selection:\n' +
53 53 ' def handle_change(name,old,new):\n' +
@@ -7,8 +7,8 b' casper.notebook_test(function () {'
7 7 this.execute_cell_then(index);
8 8
9 9 var string_index = this.append_cell(
10 'string_widget = [widgets.TextBoxWidget(value = "xyz"),\n' +
11 ' widgets.TextAreaWidget(value = "xyz"),\n' +
10 'string_widget = [widgets.TextWidget(value = "xyz"),\n' +
11 ' widgets.TextareaWidget(value = "xyz"),\n' +
12 12 ' widgets.HTMLWidget(value = "xyz"),\n' +
13 13 ' widgets.LatexWidget(value = "$\\\\LaTeX{}$")]\n' +
14 14 '[display(widget) for widget in string_widget]\n'+
@@ -1,11 +1,11 b''
1 1 from .widget import Widget, DOMWidget, CallbackDispatcher
2 2
3 from .widget_bool import CheckBoxWidget, ToggleButtonWidget
3 from .widget_bool import CheckboxWidget, ToggleButtonWidget
4 4 from .widget_button import ButtonWidget
5 5 from .widget_container import ContainerWidget, PopupWidget
6 6 from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget
7 7 from .widget_image import ImageWidget
8 8 from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, IntProgressWidget
9 from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, ListBoxWidget
9 from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, SelectWidget
10 10 from .widget_selectioncontainer import TabWidget, AccordionWidget
11 from .widget_string import HTMLWidget, LatexWidget, TextBoxWidget, TextAreaWidget
11 from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget
@@ -25,8 +25,8 b' class _BoolWidget(DOMWidget):'
25 25 disabled = Bool(False, help="Enable or disable user changes.", sync=True)
26 26
27 27
28 class CheckBoxWidget(_BoolWidget):
29 _view_name = Unicode('CheckBoxView', sync=True)
28 class CheckboxWidget(_BoolWidget):
29 _view_name = Unicode('CheckboxView', sync=True)
30 30
31 31
32 32 class ToggleButtonWidget(_BoolWidget):
@@ -91,5 +91,5 b' class RadioButtonsWidget(_SelectionWidget):'
91 91 _view_name = Unicode('RadioButtonsView', sync=True)
92 92
93 93
94 class ListBoxWidget(_SelectionWidget):
95 _view_name = Unicode('ListBoxView', sync=True)
94 class SelectWidget(_SelectionWidget):
95 _view_name = Unicode('SelectView', sync=True)
@@ -33,18 +33,18 b' class LatexWidget(_StringWidget):'
33 33 _view_name = Unicode('LatexView', sync=True)
34 34
35 35
36 class TextAreaWidget(_StringWidget):
37 _view_name = Unicode('TextAreaView', sync=True)
36 class TextareaWidget(_StringWidget):
37 _view_name = Unicode('TextareaView', sync=True)
38 38
39 39 def scroll_to_bottom(self):
40 40 self.send({"method": "scroll_to_bottom"})
41 41
42 42
43 class TextBoxWidget(_StringWidget):
44 _view_name = Unicode('TextBoxView', sync=True)
43 class TextWidget(_StringWidget):
44 _view_name = Unicode('TextView', sync=True)
45 45
46 46 def __init__(self, **kwargs):
47 super(TextBoxWidget, self).__init__(**kwargs)
47 super(TextWidget, self).__init__(**kwargs)
48 48 self._submission_callbacks = CallbackDispatcher()
49 49 self.on_msg(self._handle_string_msg)
50 50
@@ -30,14 +30,14 b''
30 30 "cell_type": "markdown",
31 31 "metadata": {},
32 32 "source": [
33 "Create a textbox Widget without displaying it. The widget will be used to store the notebook's name which is otherwise only available in the front-end."
33 "Create a text Widget without displaying it. The widget will be used to store the notebook's name which is otherwise only available in the front-end."
34 34 ]
35 35 },
36 36 {
37 37 "cell_type": "code",
38 38 "collapsed": false,
39 39 "input": [
40 "notebook_name = widgets.TextBoxWidget()"
40 "notebook_name = widgets.TextWidget()"
41 41 ],
42 42 "language": "python",
43 43 "metadata": {},
@@ -179,7 +179,7 b''
179 179 "metadata": {},
180 180 "output_type": "display_data",
181 181 "text": [
182 "<IPython.core.display.Javascript at 0x22870d0>"
182 "<IPython.core.display.Javascript at 0x36df2d0>"
183 183 ]
184 184 }
185 185 ],
@@ -136,11 +136,11 b''
136 136 " 'width': '800px',\n",
137 137 "}\n",
138 138 "\n",
139 "output_box = widgets.TextAreaWidget()\n",
139 "output_box = widgets.TextareaWidget()\n",
140 140 "output_box.set_css(console_style)\n",
141 141 "output_box.set_css('height', '400px')\n",
142 142 "\n",
143 "input_box = widgets.TextBoxWidget()\n",
143 "input_box = widgets.TextWidget()\n",
144 144 "input_box.set_css(console_style)\n",
145 145 "\n",
146 146 "console_container.children = [output_box, input_box]"
@@ -203,7 +203,7 b''
203 203 "collapsed": false,
204 204 "input": [
205 205 "toggle_button = widgets.ButtonWidget(description=\"Start Console\")\n",
206 "def toggle_console():\n",
206 "def toggle_console(sender):\n",
207 207 " console_container.visible = not console_container.visible\n",
208 208 " if console_container.visible:\n",
209 209 " toggle_button.description=\"Stop Console\"\n",
@@ -48,7 +48,7 b''
48 48 "source": [
49 49 "IPython comes with basic widgets that represent common interactive controls. These widgets are\n",
50 50 "\n",
51 "- CheckBoxWidget\n",
51 "- CheckboxWidget\n",
52 52 "- ToggleButtonWidget\n",
53 53 "- FloatSliderWidget\n",
54 54 "- BoundedFloatTextWidget\n",
@@ -62,11 +62,11 b''
62 62 "- ToggleButtonsWidget\n",
63 63 "- RadioButtonsWidget\n",
64 64 "- DropdownWidget\n",
65 "- ListBoxWidget\n",
65 "- SelectWidget\n",
66 66 "- HTMLWidget\n",
67 67 "- LatexWidget\n",
68 "- TextAreaWidget\n",
69 "- TextBoxWidget\n",
68 "- TextareaWidget\n",
69 "- TextWidget\n",
70 70 "- ButtonWidget\n",
71 71 "\n",
72 72 "A few special widgets are also included, that can be used to capture events and change how other widgets are displayed. These widgets are\n",
@@ -97,7 +97,7 b''
97 97 " 'BoundedFloatTextWidget',\n",
98 98 " 'BoundedIntTextWidget',\n",
99 99 " 'ButtonWidget',\n",
100 " 'CheckBoxWidget',\n",
100 " 'CheckboxWidget',\n",
101 101 " 'ContainerWidget',\n",
102 102 " 'DOMWidget',\n",
103 103 " 'DropdownWidget',\n",
@@ -110,12 +110,12 b''
110 110 " 'IntSliderWidget',\n",
111 111 " 'IntTextWidget',\n",
112 112 " 'LatexWidget',\n",
113 " 'ListBoxWidget',\n",
114 113 " 'PopupWidget',\n",
115 114 " 'RadioButtonsWidget',\n",
115 " 'SelectWidget',\n",
116 116 " 'TabWidget',\n",
117 " 'TextAreaWidget',\n",
118 " 'TextBoxWidget',\n",
117 " 'TextWidget',\n",
118 " 'TextareaWidget',\n",
119 119 " 'ToggleButtonWidget',\n",
120 120 " 'ToggleButtonsWidget',\n",
121 121 " 'Widget']"
@@ -119,29 +119,7 b''
119 119 ],
120 120 "language": "python",
121 121 "metadata": {},
122 "outputs": [
123 {
124 "output_type": "stream",
125 "stream": "stdout",
126 "text": [
127 "1\n"
128 ]
129 },
130 {
131 "output_type": "stream",
132 "stream": "stdout",
133 "text": [
134 "2\n"
135 ]
136 },
137 {
138 "output_type": "stream",
139 "stream": "stdout",
140 "text": [
141 "3\n"
142 ]
143 }
144 ],
122 "outputs": [],
145 123 "prompt_number": 3
146 124 },
147 125 {
@@ -229,6 +207,13 b''
229 207 "text": [
230 208 "Button clicked.\n"
231 209 ]
210 },
211 {
212 "output_type": "stream",
213 "stream": "stdout",
214 "text": [
215 "Button clicked.\n"
216 ]
232 217 }
233 218 ],
234 219 "prompt_number": 5
@@ -54,7 +54,7 b''
54 54 "collapsed": false,
55 55 "input": [
56 56 "float_range = widgets.FloatSliderWidget()\n",
57 "string = widgets.TextBoxWidget(value='hi')\n",
57 "string = widgets.TextWidget(value='hi')\n",
58 58 "container = widgets.ContainerWidget(children=[float_range, string])\n",
59 59 "\n",
60 60 "display(container) # Displays the `container` and all of it's children."
@@ -148,16 +148,16 b''
148 148 "collapsed": false,
149 149 "input": [
150 150 "form = widgets.ContainerWidget()\n",
151 "first = widgets.TextBoxWidget(description=\"First Name:\")\n",
152 "last = widgets.TextBoxWidget(description=\"Last Name:\")\n",
151 "first = widgets.TextWidget(description=\"First Name:\")\n",
152 "last = widgets.TextWidget(description=\"Last Name:\")\n",
153 153 "\n",
154 "student = widgets.CheckBoxWidget(description=\"Student:\", value=False)\n",
154 "student = widgets.CheckboxWidget(description=\"Student:\", value=False)\n",
155 155 "school_info = widgets.ContainerWidget(visible=False, children=[\n",
156 " widgets.TextBoxWidget(description=\"School:\"),\n",
156 " widgets.TextWidget(description=\"School:\"),\n",
157 157 " widgets.IntTextWidget(description=\"Grade:\", min=0, max=12)\n",
158 158 " ])\n",
159 159 "\n",
160 "pet = widgets.TextBoxWidget(description=\"Pet's Name:\")\n",
160 "pet = widgets.TextWidget(description=\"Pet's Name:\")\n",
161 161 "form.children = [first, last, student, school_info, pet]\n",
162 162 "display(form)\n",
163 163 "\n",
@@ -53,14 +53,14 b''
53 53 "cell_type": "code",
54 54 "collapsed": false,
55 55 "input": [
56 "display(widgets.TextBoxWidget(description=\"a:\"))\n",
57 "display(widgets.TextBoxWidget(description=\"aa:\"))\n",
58 "display(widgets.TextBoxWidget(description=\"aaa:\"))"
56 "display(widgets.TextWidget(description=\"a:\"))\n",
57 "display(widgets.TextWidget(description=\"aa:\"))\n",
58 "display(widgets.TextWidget(description=\"aaa:\"))"
59 59 ],
60 60 "language": "python",
61 61 "metadata": {},
62 62 "outputs": [],
63 "prompt_number": 3
63 "prompt_number": 2
64 64 },
65 65 {
66 66 "cell_type": "markdown",
@@ -73,15 +73,15 b''
73 73 "cell_type": "code",
74 74 "collapsed": false,
75 75 "input": [
76 "display(widgets.TextBoxWidget(description=\"a:\"))\n",
77 "display(widgets.TextBoxWidget(description=\"aa:\"))\n",
78 "display(widgets.TextBoxWidget(description=\"aaa:\"))\n",
79 "display(widgets.TextBoxWidget(description=\"aaaaaaaaaaaaaaaaaa:\"))"
76 "display(widgets.TextWidget(description=\"a:\"))\n",
77 "display(widgets.TextWidget(description=\"aa:\"))\n",
78 "display(widgets.TextWidget(description=\"aaa:\"))\n",
79 "display(widgets.TextWidget(description=\"aaaaaaaaaaaaaaaaaa:\"))"
80 80 ],
81 81 "language": "python",
82 82 "metadata": {},
83 83 "outputs": [],
84 "prompt_number": 4
84 "prompt_number": 3
85 85 },
86 86 {
87 87 "cell_type": "markdown",
@@ -94,15 +94,15 b''
94 94 "cell_type": "code",
95 95 "collapsed": false,
96 96 "input": [
97 "display(widgets.TextBoxWidget(description=\"a:\"))\n",
98 "display(widgets.TextBoxWidget(description=\"aa:\"))\n",
99 "display(widgets.TextBoxWidget(description=\"aaa:\"))\n",
100 "display(widgets.TextBoxWidget())"
97 "display(widgets.TextWidget(description=\"a:\"))\n",
98 "display(widgets.TextWidget(description=\"aa:\"))\n",
99 "display(widgets.TextWidget(description=\"aaa:\"))\n",
100 "display(widgets.TextWidget())"
101 101 ],
102 102 "language": "python",
103 103 "metadata": {},
104 104 "outputs": [],
105 "prompt_number": 5
105 "prompt_number": 4
106 106 },
107 107 {
108 108 "cell_type": "heading",
@@ -164,7 +164,7 b''
164 164 "language": "python",
165 165 "metadata": {},
166 166 "outputs": [],
167 "prompt_number": 6
167 "prompt_number": 5
168 168 },
169 169 {
170 170 "cell_type": "markdown",
@@ -965,8 +965,8 b''
965 965 "collapsed": false,
966 966 "input": [
967 967 "# Add some additional widgets for aesthetic purpose\n",
968 "display(widgets.TextBoxWidget(description=\"First:\"))\n",
969 "display(widgets.TextBoxWidget(description=\"Last:\"))\n",
968 "display(widgets.TextWidget(description=\"First:\"))\n",
969 "display(widgets.TextWidget(description=\"Last:\"))\n",
970 970 "\n",
971 971 "my_widget = DateWidget()\n",
972 972 "display(my_widget)\n",
@@ -54,11 +54,9 b''
54 54 "cell_type": "markdown",
55 55 "metadata": {},
56 56 "source": [
57 "- [Widget Tester](Widget Tester.ipynb) \n",
58 57 "- [Variable Inspector](Variable Inspector.ipynb) \n",
59 58 "- [Export As (nbconvert)](Export As (nbconvert%29.ipynb) \n",
60 59 "- [Nonblocking Console](Nonblocking Console.ipynb) \n",
61 "- [D3](D3.ipynb) \n",
62 60 "- [File Upload Widget](File Upload Widget.ipynb) "
63 61 ]
64 62 }
General Comments 0
You need to be logged in to leave comments. Login now