From 75b148d40b6439301c51dff8d102e2761910cbfc Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 28 Jan 2014 12:51:24 -0800 Subject: [PATCH] Renamed widgets... TextWidget, TextareaWidget, CheckboxWidget, and SelectWidget --- .../static/notebook/js/widgets/widget_bool.js | 6 ++-- .../notebook/js/widgets/widget_selection.js | 6 ++-- .../notebook/js/widgets/widget_string.js | 12 +++---- .../html/tests/casperjs/test_cases/widgets.js | 2 +- .../tests/casperjs/test_cases/widgets_bool.js | 2 +- .../test_cases/widgets_multicontainer.js | 6 ++-- .../casperjs/test_cases/widgets_selection.js | 2 +- .../casperjs/test_cases/widgets_string.js | 4 +-- IPython/html/widgets/__init__.py | 6 ++-- IPython/html/widgets/widget_bool.py | 4 +-- IPython/html/widgets/widget_selection.py | 4 +-- IPython/html/widgets/widget_string.py | 10 +++--- examples/widgets/Export As (nbconvert).ipynb | 4 +-- examples/widgets/File Upload Widget.ipynb | 2 +- examples/widgets/Nonblocking Console.ipynb | 6 ++-- examples/widgets/Part 1 - Basics.ipynb | 16 +++++----- examples/widgets/Part 2 - Events.ipynb | 31 +++++-------------- examples/widgets/Part 6 - Custom Widget.ipynb | 4 +-- examples/widgets/index.ipynb | 2 -- 19 files changed, 56 insertions(+), 73 deletions(-) diff --git a/IPython/html/static/notebook/js/widgets/widget_bool.js b/IPython/html/static/notebook/js/widgets/widget_bool.js index 050306d53..22be10651 100644 --- a/IPython/html/static/notebook/js/widgets/widget_bool.js +++ b/IPython/html/static/notebook/js/widgets/widget_bool.js @@ -16,7 +16,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ - var CheckBoxView = IPython.DOMWidgetView.extend({ + var CheckboxView = IPython.DOMWidgetView.extend({ render : function(){ // Called when view is rendered. this.$el @@ -63,11 +63,11 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.$label.show(); } } - return CheckBoxView.__super__.update.apply(this); + return CheckboxView.__super__.update.apply(this); }, }); - WidgetManager.register_widget_view('CheckBoxView', CheckBoxView); + WidgetManager.register_widget_view('CheckboxView', CheckboxView); var ToggleButtonView = IPython.DOMWidgetView.extend({ diff --git a/IPython/html/static/notebook/js/widgets/widget_selection.js b/IPython/html/static/notebook/js/widgets/widget_selection.js index 8895198c7..5d9791c37 100644 --- a/IPython/html/static/notebook/js/widgets/widget_selection.js +++ b/IPython/html/static/notebook/js/widgets/widget_selection.js @@ -292,7 +292,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ WidgetManager.register_widget_view('ToggleButtonsView', ToggleButtonsView); - var ListBoxView = IPython.DOMWidgetView.extend({ + var SelectView = IPython.DOMWidgetView.extend({ render : function(){ // Called when view is rendered. this.$el @@ -360,7 +360,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.$label.show(); } } - return ListBoxView.__super__.update.apply(this); + return SelectView.__super__.update.apply(this); }, handle_click: function (e) { @@ -372,5 +372,5 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.touch(); }, }); - WidgetManager.register_widget_view('ListBoxView', ListBoxView); + WidgetManager.register_widget_view('SelectView', SelectView); }); diff --git a/IPython/html/static/notebook/js/widgets/widget_string.js b/IPython/html/static/notebook/js/widgets/widget_string.js index d4fd3d899..92bfc997e 100644 --- a/IPython/html/static/notebook/js/widgets/widget_string.js +++ b/IPython/html/static/notebook/js/widgets/widget_string.js @@ -54,7 +54,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ WidgetManager.register_widget_view('LatexView', LatexView); - var TextAreaView = IPython.DOMWidgetView.extend({ + var TextareaView = IPython.DOMWidgetView.extend({ render: function(){ // Called when view is rendered. this.$el @@ -104,7 +104,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.$label.show(); } } - return TextAreaView.__super__.update.apply(this); + return TextareaView.__super__.update.apply(this); }, events: { @@ -123,10 +123,10 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.touch(); }, }); - WidgetManager.register_widget_view('TextAreaView', TextAreaView); + WidgetManager.register_widget_view('TextareaView', TextareaView); - var TextBoxView = IPython.DOMWidgetView.extend({ + var TextView = IPython.DOMWidgetView.extend({ render: function(){ // Called when view is rendered. this.$el @@ -164,7 +164,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.$label.show(); } } - return TextBoxView.__super__.update.apply(this); + return TextView.__super__.update.apply(this); }, events: { @@ -218,5 +218,5 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ } }, }); - WidgetManager.register_widget_view('TextBoxView', TextBoxView); + WidgetManager.register_widget_view('TextView', TextView); }); diff --git a/IPython/html/tests/casperjs/test_cases/widgets.js b/IPython/html/tests/casperjs/test_cases/widgets.js index f8b34f4a6..115e467c6 100644 --- a/IPython/html/tests/casperjs/test_cases/widgets.js +++ b/IPython/html/tests/casperjs/test_cases/widgets.js @@ -27,7 +27,7 @@ casper.notebook_test(function () { throttle_index = this.append_cell( 'import time\n' + - 'textbox = widgets.TextBoxWidget()\n' + + 'textbox = widgets.TextWidget()\n' + 'display(textbox)\n'+ 'textbox.add_class("my-throttle-textbox")\n' + 'def handle_change(name, old, new):\n' + diff --git a/IPython/html/tests/casperjs/test_cases/widgets_bool.js b/IPython/html/tests/casperjs/test_cases/widgets_bool.js index ad7aedb83..4fd10076e 100644 --- a/IPython/html/tests/casperjs/test_cases/widgets_bool.js +++ b/IPython/html/tests/casperjs/test_cases/widgets_bool.js @@ -7,7 +7,7 @@ casper.notebook_test(function () { this.execute_cell_then(index); var bool_index = this.append_cell( - 'bool_widgets = [widgets.CheckBoxWidget(description="Title", value=True),\n' + + 'bool_widgets = [widgets.CheckboxWidget(description="Title", value=True),\n' + ' widgets.ToggleButtonWidget(description="Title", value=True)]\n' + 'display(bool_widgets[0])\n' + 'display(bool_widgets[1])\n' + diff --git a/IPython/html/tests/casperjs/test_cases/widgets_multicontainer.js b/IPython/html/tests/casperjs/test_cases/widgets_multicontainer.js index d3b8cea6c..32c9263b0 100644 --- a/IPython/html/tests/casperjs/test_cases/widgets_multicontainer.js +++ b/IPython/html/tests/casperjs/test_cases/widgets_multicontainer.js @@ -10,9 +10,9 @@ casper.notebook_test(function () { var multicontainer1_query = '.widget-area .widget-subarea div div.nav-tabs'; var multicontainer1_index = this.append_cell( 'multicontainer = widgets.TabWidget()\n' + - 'page1 = widgets.TextBoxWidget()\n' + - 'page2 = widgets.TextBoxWidget()\n' + - 'page3 = widgets.TextBoxWidget()\n' + + 'page1 = widgets.TextWidget()\n' + + 'page2 = widgets.TextWidget()\n' + + 'page3 = widgets.TextWidget()\n' + 'multicontainer.children = [page1, page2, page3]\n' + 'display(multicontainer)\n' + 'multicontainer.selected_index = 0\n' + diff --git a/IPython/html/tests/casperjs/test_cases/widgets_selection.js b/IPython/html/tests/casperjs/test_cases/widgets_selection.js index 334853d3e..abf68a7d8 100644 --- a/IPython/html/tests/casperjs/test_cases/widgets_selection.js +++ b/IPython/html/tests/casperjs/test_cases/widgets_selection.js @@ -47,7 +47,7 @@ casper.notebook_test(function () { 'selection = [widgets.DropdownWidget(values=values),\n' + ' widgets.ToggleButtonsWidget(values=values),\n' + ' widgets.RadioButtonsWidget(values=values),\n' + - ' widgets.ListBoxWidget(values=values)]\n' + + ' widgets.SelectWidget(values=values)]\n' + '[display(selection[i]) for i in range(4)]\n' + 'for widget in selection:\n' + ' def handle_change(name,old,new):\n' + diff --git a/IPython/html/tests/casperjs/test_cases/widgets_string.js b/IPython/html/tests/casperjs/test_cases/widgets_string.js index cae3c1beb..a59c0a3c4 100644 --- a/IPython/html/tests/casperjs/test_cases/widgets_string.js +++ b/IPython/html/tests/casperjs/test_cases/widgets_string.js @@ -7,8 +7,8 @@ casper.notebook_test(function () { this.execute_cell_then(index); var string_index = this.append_cell( - 'string_widget = [widgets.TextBoxWidget(value = "xyz"),\n' + - ' widgets.TextAreaWidget(value = "xyz"),\n' + + 'string_widget = [widgets.TextWidget(value = "xyz"),\n' + + ' widgets.TextareaWidget(value = "xyz"),\n' + ' widgets.HTMLWidget(value = "xyz"),\n' + ' widgets.LatexWidget(value = "$\\\\LaTeX{}$")]\n' + '[display(widget) for widget in string_widget]\n'+ diff --git a/IPython/html/widgets/__init__.py b/IPython/html/widgets/__init__.py index f52328b0e..250df705b 100644 --- a/IPython/html/widgets/__init__.py +++ b/IPython/html/widgets/__init__.py @@ -1,11 +1,11 @@ from .widget import Widget, DOMWidget, CallbackDispatcher -from .widget_bool import CheckBoxWidget, ToggleButtonWidget +from .widget_bool import CheckboxWidget, ToggleButtonWidget from .widget_button import ButtonWidget from .widget_container import ContainerWidget, PopupWidget from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget from .widget_image import ImageWidget from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, IntProgressWidget -from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, ListBoxWidget +from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, SelectWidget from .widget_selectioncontainer import TabWidget, AccordionWidget -from .widget_string import HTMLWidget, LatexWidget, TextBoxWidget, TextAreaWidget +from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget diff --git a/IPython/html/widgets/widget_bool.py b/IPython/html/widgets/widget_bool.py index 91b3f903f..cce6b9811 100644 --- a/IPython/html/widgets/widget_bool.py +++ b/IPython/html/widgets/widget_bool.py @@ -25,8 +25,8 @@ class _BoolWidget(DOMWidget): disabled = Bool(False, help="Enable or disable user changes.", sync=True) -class CheckBoxWidget(_BoolWidget): - _view_name = Unicode('CheckBoxView', sync=True) +class CheckboxWidget(_BoolWidget): + _view_name = Unicode('CheckboxView', sync=True) class ToggleButtonWidget(_BoolWidget): diff --git a/IPython/html/widgets/widget_selection.py b/IPython/html/widgets/widget_selection.py index 2d79e243d..b16702784 100644 --- a/IPython/html/widgets/widget_selection.py +++ b/IPython/html/widgets/widget_selection.py @@ -91,5 +91,5 @@ class RadioButtonsWidget(_SelectionWidget): _view_name = Unicode('RadioButtonsView', sync=True) -class ListBoxWidget(_SelectionWidget): - _view_name = Unicode('ListBoxView', sync=True) +class SelectWidget(_SelectionWidget): + _view_name = Unicode('SelectView', sync=True) diff --git a/IPython/html/widgets/widget_string.py b/IPython/html/widgets/widget_string.py index d0a2812ab..e3633365d 100644 --- a/IPython/html/widgets/widget_string.py +++ b/IPython/html/widgets/widget_string.py @@ -33,18 +33,18 @@ class LatexWidget(_StringWidget): _view_name = Unicode('LatexView', sync=True) -class TextAreaWidget(_StringWidget): - _view_name = Unicode('TextAreaView', sync=True) +class TextareaWidget(_StringWidget): + _view_name = Unicode('TextareaView', sync=True) def scroll_to_bottom(self): self.send({"method": "scroll_to_bottom"}) -class TextBoxWidget(_StringWidget): - _view_name = Unicode('TextBoxView', sync=True) +class TextWidget(_StringWidget): + _view_name = Unicode('TextView', sync=True) def __init__(self, **kwargs): - super(TextBoxWidget, self).__init__(**kwargs) + super(TextWidget, self).__init__(**kwargs) self._submission_callbacks = CallbackDispatcher() self.on_msg(self._handle_string_msg) diff --git a/examples/widgets/Export As (nbconvert).ipynb b/examples/widgets/Export As (nbconvert).ipynb index 561a00208..714b48aaa 100644 --- a/examples/widgets/Export As (nbconvert).ipynb +++ b/examples/widgets/Export As (nbconvert).ipynb @@ -30,14 +30,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "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." + "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." ] }, { "cell_type": "code", "collapsed": false, "input": [ - "notebook_name = widgets.TextBoxWidget()" + "notebook_name = widgets.TextWidget()" ], "language": "python", "metadata": {}, diff --git a/examples/widgets/File Upload Widget.ipynb b/examples/widgets/File Upload Widget.ipynb index f78302e87..ecce88db0 100644 --- a/examples/widgets/File Upload Widget.ipynb +++ b/examples/widgets/File Upload Widget.ipynb @@ -179,7 +179,7 @@ "metadata": {}, "output_type": "display_data", "text": [ - "" + "" ] } ], diff --git a/examples/widgets/Nonblocking Console.ipynb b/examples/widgets/Nonblocking Console.ipynb index 2cc211d61..444b66deb 100644 --- a/examples/widgets/Nonblocking Console.ipynb +++ b/examples/widgets/Nonblocking Console.ipynb @@ -136,11 +136,11 @@ " 'width': '800px',\n", "}\n", "\n", - "output_box = widgets.TextAreaWidget()\n", + "output_box = widgets.TextareaWidget()\n", "output_box.set_css(console_style)\n", "output_box.set_css('height', '400px')\n", "\n", - "input_box = widgets.TextBoxWidget()\n", + "input_box = widgets.TextWidget()\n", "input_box.set_css(console_style)\n", "\n", "console_container.children = [output_box, input_box]" @@ -203,7 +203,7 @@ "collapsed": false, "input": [ "toggle_button = widgets.ButtonWidget(description=\"Start Console\")\n", - "def toggle_console():\n", + "def toggle_console(sender):\n", " console_container.visible = not console_container.visible\n", " if console_container.visible:\n", " toggle_button.description=\"Stop Console\"\n", diff --git a/examples/widgets/Part 1 - Basics.ipynb b/examples/widgets/Part 1 - Basics.ipynb index de68a0652..f675a9904 100644 --- a/examples/widgets/Part 1 - Basics.ipynb +++ b/examples/widgets/Part 1 - Basics.ipynb @@ -48,7 +48,7 @@ "source": [ "IPython comes with basic widgets that represent common interactive controls. These widgets are\n", "\n", - "- CheckBoxWidget\n", + "- CheckboxWidget\n", "- ToggleButtonWidget\n", "- FloatSliderWidget\n", "- BoundedFloatTextWidget\n", @@ -62,11 +62,11 @@ "- ToggleButtonsWidget\n", "- RadioButtonsWidget\n", "- DropdownWidget\n", - "- ListBoxWidget\n", + "- SelectWidget\n", "- HTMLWidget\n", "- LatexWidget\n", - "- TextAreaWidget\n", - "- TextBoxWidget\n", + "- TextareaWidget\n", + "- TextWidget\n", "- ButtonWidget\n", "\n", "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 @@ " 'BoundedFloatTextWidget',\n", " 'BoundedIntTextWidget',\n", " 'ButtonWidget',\n", - " 'CheckBoxWidget',\n", + " 'CheckboxWidget',\n", " 'ContainerWidget',\n", " 'DOMWidget',\n", " 'DropdownWidget',\n", @@ -110,12 +110,12 @@ " 'IntSliderWidget',\n", " 'IntTextWidget',\n", " 'LatexWidget',\n", - " 'ListBoxWidget',\n", " 'PopupWidget',\n", " 'RadioButtonsWidget',\n", + " 'SelectWidget',\n", " 'TabWidget',\n", - " 'TextAreaWidget',\n", - " 'TextBoxWidget',\n", + " 'TextWidget',\n", + " 'TextareaWidget',\n", " 'ToggleButtonWidget',\n", " 'ToggleButtonsWidget',\n", " 'Widget']" diff --git a/examples/widgets/Part 2 - Events.ipynb b/examples/widgets/Part 2 - Events.ipynb index ee16258b3..d0bc60f42 100644 --- a/examples/widgets/Part 2 - Events.ipynb +++ b/examples/widgets/Part 2 - Events.ipynb @@ -119,29 +119,7 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - } - ], + "outputs": [], "prompt_number": 3 }, { @@ -223,6 +201,13 @@ "Button clicked.\n" ] }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Button clicked.\n" + ] + }, { "output_type": "stream", "stream": "stdout", diff --git a/examples/widgets/Part 6 - Custom Widget.ipynb b/examples/widgets/Part 6 - Custom Widget.ipynb index 898ab0f94..b07b42894 100644 --- a/examples/widgets/Part 6 - Custom Widget.ipynb +++ b/examples/widgets/Part 6 - Custom Widget.ipynb @@ -965,8 +965,8 @@ "collapsed": false, "input": [ "# Add some additional widgets for aesthetic purpose\n", - "display(widgets.TextBoxWidget(description=\"First:\"))\n", - "display(widgets.TextBoxWidget(description=\"Last:\"))\n", + "display(widgets.TextWidget(description=\"First:\"))\n", + "display(widgets.TextWidget(description=\"Last:\"))\n", "\n", "my_widget = DateWidget()\n", "display(my_widget)\n", diff --git a/examples/widgets/index.ipynb b/examples/widgets/index.ipynb index 2a8a487e6..95822af5c 100644 --- a/examples/widgets/index.ipynb +++ b/examples/widgets/index.ipynb @@ -54,11 +54,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "- [Widget Tester](Widget Tester.ipynb) \n", "- [Variable Inspector](Variable Inspector.ipynb) \n", "- [Export As (nbconvert)](Export As (nbconvert%29.ipynb) \n", "- [Nonblocking Console](Nonblocking Console.ipynb) \n", - "- [D3](D3.ipynb) \n", "- [File Upload Widget](File Upload Widget.ipynb) " ] }