Renamed widgets...

TextWidget, TextareaWidget, CheckboxWidget, and SelectWidget
This commit is contained in:
Jonathan Frederic 2014-01-28 12:51:24 -08:00
parent 5ed3a0ebc5
commit 75b148d40b
19 changed files with 56 additions and 73 deletions

View File

@ -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({

View File

@ -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);
});

View File

@ -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);
});

View File

@ -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' +

View File

@ -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' +

View File

@ -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' +

View File

@ -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' +

View File

@ -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'+

View File

@ -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

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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": {},

View File

@ -179,7 +179,7 @@
"metadata": {},
"output_type": "display_data",
"text": [
"<IPython.core.display.Javascript at 0x22870d0>"
"<IPython.core.display.Javascript at 0x36df2d0>"
]
}
],

View File

@ -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",

View File

@ -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']"

View File

@ -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",

View File

@ -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",

View File

@ -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) "
]
}