Renamed *Widget to *,

depracted old names.
Jonathan Frederic 12 years ago committed by Jonathan Frederic
parent 37f00f73d7
commit ba3033971e

@ -147,7 +147,7 @@ casper.notebook_test(function () {
var textbox = {};
throttle_index = this.append_cell(
'import time\n' +
'textbox = widgets.TextWidget()\n' +
'textbox = widgets.Text()\n' +
'display(textbox)\n' +
'textbox.add_class("my-throttle-textbox", selector="input")\n' +
'def handle_change(name, old, new):\n' +

@ -7,8 +7,8 @@ casper.notebook_test(function () {
this.execute_cell_then(index);
var bool_index = this.append_cell(
'bool_widgets = [widgets.CheckboxWidget(description="Title", value=True),\n' +
' widgets.ToggleButtonWidget(description="Title", value=True)]\n' +
'bool_widgets = [widgets.Checkbox(description="Title", value=True),\n' +
' widgets.ToggleButton(description="Title", value=True)]\n' +
'display(bool_widgets[0])\n' +
'display(bool_widgets[1])\n' +
'print("Success")');

@ -7,7 +7,7 @@ casper.notebook_test(function () {
this.execute_cell_then(index);
var button_index = this.append_cell(
'button = widgets.ButtonWidget(description="Title")\n' +
'button = widgets.Button(description="Title")\n' +
'display(button)\n' +
'print("Success")\n' +
'def handle_click(sender):\n' +

@ -7,8 +7,8 @@ casper.notebook_test(function () {
this.execute_cell_then(index);
var container_index = this.append_cell(
'container = widgets.ContainerWidget()\n' +
'button = widgets.ButtonWidget()\n'+
'container = widgets.Container()\n' +
'button = widgets.Button()\n'+
'container.children = [button]\n'+
'display(container)\n'+
'container.add_class("my-test-class")\n'+

@ -9,7 +9,7 @@ casper.notebook_test(function () {
var float_text = {};
float_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-float-text';
float_text.index = this.append_cell(
'float_widget = widgets.FloatTextWidget()\n' +
'float_widget = widgets.FloatText()\n' +
'display(float_widget)\n' +
'float_widget.add_class("my-second-float-text", selector="input")\n' +
'print(float_widget.model_id)\n');
@ -59,8 +59,8 @@ casper.notebook_test(function () {
var slider = {};
slider.query = '.widget-area .widget-subarea .widget-hbox-single .slider';
slider.index = this.append_cell(
'floatrange = [widgets.BoundedFloatTextWidget(), \n' +
' widgets.FloatSliderWidget()]\n' +
'floatrange = [widgets.BoundedFloatText(), \n' +
' widgets.FloatSlider()]\n' +
'[display(floatrange[i]) for i in range(2)]\n' +
'print("Success")\n');
this.execute_cell_then(slider.index, function(index){

@ -18,7 +18,7 @@ casper.notebook_test(function () {
var image_index = this.append_cell(
'import base64\n' +
'data = base64.b64decode("' + test_jpg + '")\n' +
'image = widgets.ImageWidget()\n' +
'image = widgets.Image()\n' +
'image.format = "jpeg"\n' +
'image.value = data\n' +
'image.width = "50px"\n' +

@ -9,7 +9,7 @@ casper.notebook_test(function () {
var int_text = {};
int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text';
int_text.index = this.append_cell(
'int_widget = widgets.IntTextWidget()\n' +
'int_widget = widgets.IntText()\n' +
'display(int_widget)\n' +
'int_widget.add_class("my-second-int-text", selector="input")\n' +
'print(int_widget.model_id)\n');

@ -44,10 +44,10 @@ casper.notebook_test(function () {
//values=["' + selection_values + '"[i] for i in range(4)]
selection_index = this.append_cell(
'values=["' + selection_values + '"[i] for i in range(4)]\n' +
'selection = [widgets.DropdownWidget(values=values),\n' +
' widgets.ToggleButtonsWidget(values=values),\n' +
' widgets.RadioButtonsWidget(values=values),\n' +
' widgets.SelectWidget(values=values)]\n' +
'selection = [widgets.Dropdown(values=values),\n' +
' widgets.ToggleButtons(values=values),\n' +
' widgets.RadioButtons(values=values),\n' +
' widgets.Select(values=values)]\n' +
'[display(selection[i]) for i in range(4)]\n' +
'for widget in selection:\n' +
' def handle_change(name,old,new):\n' +

@ -9,10 +9,10 @@ casper.notebook_test(function () {
// Test tab view
var multicontainer1_query = '.widget-area .widget-subarea div div.nav-tabs';
var multicontainer1_index = this.append_cell(
'multicontainer = widgets.TabWidget()\n' +
'page1 = widgets.TextWidget()\n' +
'page2 = widgets.TextWidget()\n' +
'page3 = widgets.TextWidget()\n' +
'multicontainer = widgets.Tab()\n' +
'page1 = widgets.Text()\n' +
'page2 = widgets.Text()\n' +
'page3 = widgets.Text()\n' +
'multicontainer.children = [page1, page2, page3]\n' +
'display(multicontainer)\n' +
'multicontainer.selected_index = 0\n' +
@ -64,10 +64,10 @@ casper.notebook_test(function () {
// Test accordion view
var multicontainer2_query = '.widget-area .widget-subarea .panel-group';
var multicontainer2_index = this.append_cell(
'multicontainer = widgets.AccordionWidget()\n' +
'page1 = widgets.TextWidget()\n' +
'page2 = widgets.TextWidget()\n' +
'page3 = widgets.TextWidget()\n' +
'multicontainer = widgets.Accordion()\n' +
'page1 = widgets.Text()\n' +
'page2 = widgets.Text()\n' +
'page3 = widgets.Text()\n' +
'multicontainer.children = [page1, page2, page3]\n' +
'multicontainer.set_title(2, "good")\n' +
'display(multicontainer)\n' +

@ -7,10 +7,10 @@ casper.notebook_test(function () {
this.execute_cell_then(index);
var string_index = this.append_cell(
'string_widget = [widgets.TextWidget(value = "xyz", placeholder = "abc"),\n' +
' widgets.TextareaWidget(value = "xyz", placeholder = "def"),\n' +
' widgets.HTMLWidget(value = "xyz"),\n' +
' widgets.LatexWidget(value = "$\\\\LaTeX{}$")]\n' +
'string_widget = [widgets.Text(value = "xyz", placeholder = "abc"),\n' +
' widgets.Textarea(value = "xyz", placeholder = "def"),\n' +
' widgets.HTML(value = "xyz"),\n' +
' widgets.Latex(value = "$\\\\LaTeX{}$")]\n' +
'[display(widget) for widget in string_widget]\n'+
'print("Success")');
this.execute_cell_then(string_index, function(index){

@ -1,8 +1,20 @@
from .widget import Widget, DOMWidget, CallbackDispatcher
from .widget_bool import Checkbox, ToggleButton
from .widget_button import Button
from .widget_container import Container, Popup, FlexContainer, HBox, VBox
from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress
from .widget_image import Image
from .widget_int import IntText, BoundedIntText, IntSlider, IntProgress
from .widget_selection import RadioButtons, ToggleButtons, Dropdown, Select
from .widget_selectioncontainer import Tab, Accordion
from .widget_string import HTML, Latex, Text, Textarea
from .interaction import interact, interactive, fixed
# Deprecated classes
from .widget_bool import CheckboxWidget, ToggleButtonWidget
from .widget_button import ButtonWidget
from .widget_container import ContainerWidget, PopupWidget, FlexContainerWidget, HBoxWidget, VBoxWidget
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

@ -21,9 +21,9 @@ except ImportError:
from inspect import getcallargs
from IPython.core.getipython import get_ipython
from IPython.html.widgets import (Widget, TextWidget,
FloatSliderWidget, IntSliderWidget, CheckboxWidget, DropdownWidget,
ContainerWidget, DOMWidget)
from IPython.html.widgets import (Widget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
Container, DOMWidget)
from IPython.display import display, clear_output
from IPython.utils.py3compat import string_types, unicode_type
from IPython.utils.traitlets import HasTraits, Any, Unicode
@ -70,17 +70,17 @@ def _get_min_max_value(min, max, value=None, step=None):
def _widget_abbrev_single_value(o):
"""Make widgets from single values, which can be used as parameter defaults."""
if isinstance(o, string_types):
return TextWidget(value=unicode_type(o))
return Text(value=unicode_type(o))
elif isinstance(o, dict):
return DropdownWidget(values=o)
return Dropdown(values=o)
elif isinstance(o, bool):
return CheckboxWidget(value=o)
return Checkbox(value=o)
elif isinstance(o, float):
min, max, value = _get_min_max_value(None, None, o)
return FloatSliderWidget(value=o, min=min, max=max)
return FloatSlider(value=o, min=min, max=max)
elif isinstance(o, int):
min, max, value = _get_min_max_value(None, None, o)
return IntSliderWidget(value=o, min=min, max=max)
return IntSlider(value=o, min=min, max=max)
else:
return None
@ -89,13 +89,13 @@ def _widget_abbrev(o):
float_or_int = (float, int)
if isinstance(o, (list, tuple)):
if o and all(isinstance(x, string_types) for x in o):
return DropdownWidget(values=[unicode_type(k) for k in o])
return Dropdown(values=[unicode_type(k) for k in o])
elif _matches(o, (float_or_int, float_or_int)):
min, max, value = _get_min_max_value(o[0], o[1])
if all(isinstance(_, int) for _ in o):
cls = IntSliderWidget
cls = IntSlider
else:
cls = FloatSliderWidget
cls = FloatSlider
return cls(value=value, min=min, max=max)
elif _matches(o, (float_or_int, float_or_int, float_or_int)):
step = o[2]
@ -103,9 +103,9 @@ def _widget_abbrev(o):
raise ValueError("step must be >= 0, not %r" % step)
min, max, value = _get_min_max_value(o[0], o[1], step=step)
if all(isinstance(_, int) for _ in o):
cls = IntSliderWidget
cls = IntSlider
else:
cls = FloatSliderWidget
cls = FloatSlider
return cls(value=value, min=min, max=max, step=step)
else:
return _widget_abbrev_single_value(o)
@ -176,7 +176,7 @@ def interactive(__interact_f, **kwargs):
f = __interact_f
co = kwargs.pop('clear_output', True)
kwargs_widgets = []
container = ContainerWidget()
container = Container()
container.result = None
container.args = []
container.kwargs = dict()

@ -1,4 +1,4 @@
"""BoolWidget class.
"""Bool class.
Represents a boolean using a widget.
"""
@ -15,20 +15,23 @@ Represents a boolean using a widget.
#-----------------------------------------------------------------------------
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Bool
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class _BoolWidget(DOMWidget):
class _Bool(DOMWidget):
value = Bool(False, help="Bool value", sync=True)
description = Unicode('', help="Description of the boolean (label).", sync=True)
disabled = Bool(False, help="Enable or disable user changes.", sync=True)
class CheckboxWidget(_BoolWidget):
class Checkbox(_Bool):
_view_name = Unicode('CheckboxView', sync=True)
class ToggleButtonWidget(_BoolWidget):
class ToggleButton(_Bool):
_view_name = Unicode('ToggleButtonView', sync=True)
CheckboxWidget = DeprecatedClass(Checkbox, 'CheckboxWidget')
ToggleButtonWidget = DeprecatedClass(ToggleButton, 'ToggleButtonWidget')

@ -1,4 +1,4 @@
"""ButtonWidget class.
"""Button class.
Represents a button in the frontend using a widget. Allows user to listen for
click events on the button and trigger backend code when the clicks are fired.
@ -16,11 +16,12 @@ click events on the button and trigger backend code when the clicks are fired.
#-----------------------------------------------------------------------------
from .widget import DOMWidget, CallbackDispatcher
from IPython.utils.traitlets import Unicode, Bool
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class ButtonWidget(DOMWidget):
class Button(DOMWidget):
_view_name = Unicode('ButtonView', sync=True)
# Keys
@ -29,7 +30,7 @@ class ButtonWidget(DOMWidget):
def __init__(self, **kwargs):
"""Constructor"""
super(ButtonWidget, self).__init__(**kwargs)
super(Button, self).__init__(**kwargs)
self._click_handlers = CallbackDispatcher()
self.on_msg(self._handle_button_msg)
@ -54,3 +55,6 @@ class ButtonWidget(DOMWidget):
Content of the msg."""
if content.get('event', '') == 'click':
self._click_handlers(self)
ButtonWidget = DeprecatedClass(Button, 'ButtonWidget')

@ -1,4 +1,4 @@
"""ContainerWidget class.
"""Container class.
Represents a container that can be used to group other widgets.
"""
@ -8,8 +8,9 @@ Represents a container that can be used to group other widgets.
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Tuple, TraitError, Int, CaselessStrEnum
from IPython.utils.warn import DeprecatedClass
class ContainerWidget(DOMWidget):
class Container(DOMWidget):
_view_name = Unicode('ContainerView', sync=True)
# Child widgets in the container.
@ -19,22 +20,22 @@ class ContainerWidget(DOMWidget):
def __init__(self, children = (), **kwargs):
kwargs['children'] = children
super(ContainerWidget, self).__init__(**kwargs)
self.on_displayed(ContainerWidget._fire_children_displayed)
super(Container, self).__init__(**kwargs)
self.on_displayed(Container._fire_children_displayed)
def _fire_children_displayed(self):
for child in self.children:
child._handle_displayed()
class PopupWidget(ContainerWidget):
class Popup(Container):
_view_name = Unicode('PopupView', sync=True)
description = Unicode(sync=True)
button_text = Unicode(sync=True)
class FlexContainerWidget(ContainerWidget):
class FlexContainer(Container):
_view_name = Unicode('FlexContainerView', sync=True)
flex = Int(0, sync=True, help="""Specify the flexible-ness of the model.""")
def _flex_changed(self, name, old, new):
@ -51,9 +52,13 @@ class FlexContainerWidget(ContainerWidget):
default_value='start', allow_none=False, sync=True)
class VBoxWidget(FlexContainerWidget):
class VBox(FlexContainer):
_view_name = Unicode('VBoxContainerView', sync=True)
class HBoxWidget(FlexContainerWidget):
class HBox(FlexContainer):
_view_name = Unicode('HBoxContainerView', sync=True)
ContainerWidget = DeprecatedClass(Container, 'ContainerWidget')
PopupWidget = DeprecatedClass(Popup, 'PopupWidget')

@ -1,4 +1,4 @@
"""FloatWidget class.
"""Float class.
Represents an unbounded float using a widget.
"""
@ -15,17 +15,18 @@ Represents an unbounded float using a widget.
#-----------------------------------------------------------------------------
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, CFloat, Bool, Enum
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class _FloatWidget(DOMWidget):
class _Float(DOMWidget):
value = CFloat(0.0, help="Float value", sync=True)
disabled = Bool(False, help="Enable or disable user changes", sync=True)
description = Unicode(help="Description of the value this widget represents", sync=True)
class _BoundedFloatWidget(_FloatWidget):
class _BoundedFloat(_Float):
max = CFloat(100.0, help="Max value", sync=True)
min = CFloat(0.0, help="Min value", sync=True)
step = CFloat(0.1, help="Minimum step that the value can take (ignored by some views)", sync=True)
@ -42,20 +43,27 @@ class _BoundedFloatWidget(_FloatWidget):
self.value = min(max(new, self.min), self.max)
class FloatTextWidget(_FloatWidget):
class FloatText(_Float):
_view_name = Unicode('FloatTextView', sync=True)
class BoundedFloatTextWidget(_BoundedFloatWidget):
class BoundedFloatText(_BoundedFloat):
_view_name = Unicode('FloatTextView', sync=True)
class FloatSliderWidget(_BoundedFloatWidget):
class FloatSlider(_BoundedFloat):
_view_name = Unicode('FloatSliderView', sync=True)
orientation = Enum([u'horizontal', u'vertical'], u'horizontal',
help="Vertical or horizontal.", sync=True)
readout = Bool(True, help="Display the current value of the slider next to it.", sync=True)
class FloatProgressWidget(_BoundedFloatWidget):
class FloatProgress(_BoundedFloat):
_view_name = Unicode('ProgressView', sync=True)
_FloatWidget = DeprecatedClass(_Float, '_FloatWidget')
_BoundedFloatWidget = DeprecatedClass(_BoundedFloat, '_BoundedFloatWidget')
FloatTextWidget = DeprecatedClass(FloatText, 'FloatTextWidget')
BoundedFloatTextWidget = DeprecatedClass(BoundedFloatText, 'BoundedFloatTextWidget')
FloatSliderWidget = DeprecatedClass(FloatSlider, 'FloatSliderWidget')
FloatProgressWidget = DeprecatedClass(FloatProgress, 'FloatProgressWidget')

@ -1,4 +1,4 @@
"""ImageWidget class.
"""Image class.
Represents an image in the frontend using a widget.
"""
@ -17,11 +17,12 @@ import base64
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, CUnicode, Bytes
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class ImageWidget(DOMWidget):
class Image(DOMWidget):
_view_name = Unicode('ImageView', sync=True)
# Define the custom state properties to sync with the front-end
@ -33,3 +34,5 @@ class ImageWidget(DOMWidget):
value = Bytes()
def _value_changed(self, name, old, new):
self._b64value = base64.b64encode(new)
ImageWidget = DeprecatedClass(Image, 'ImageWidget')

@ -1,4 +1,4 @@
"""IntWidget class.
"""Int class.
Represents an unbounded int using a widget.
"""
@ -15,17 +15,18 @@ Represents an unbounded int using a widget.
#-----------------------------------------------------------------------------
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, CInt, Bool, Enum
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class _IntWidget(DOMWidget):
class _Int(DOMWidget):
value = CInt(0, help="Int value", sync=True)
disabled = Bool(False, help="Enable or disable user changes", sync=True)
description = Unicode(help="Description of the value this widget represents", sync=True)
class _BoundedIntWidget(_IntWidget):
class _BoundedInt(_Int):
step = CInt(1, help="Minimum step that the value can take (ignored by some views)", sync=True)
max = CInt(100, help="Max value", sync=True)
min = CInt(0, help="Min value", sync=True)
@ -41,20 +42,27 @@ class _BoundedIntWidget(_IntWidget):
self.value = min(max(new, self.min), self.max)
class IntTextWidget(_IntWidget):
class IntText(_Int):
_view_name = Unicode('IntTextView', sync=True)
class BoundedIntTextWidget(_BoundedIntWidget):
class BoundedIntText(_BoundedInt):
_view_name = Unicode('IntTextView', sync=True)
class IntSliderWidget(_BoundedIntWidget):
class IntSlider(_BoundedInt):
_view_name = Unicode('IntSliderView', sync=True)
orientation = Enum([u'horizontal', u'vertical'], u'horizontal',
help="Vertical or horizontal.", sync=True)
readout = Bool(True, help="Display the current value of the slider next to it.", sync=True)
class IntProgressWidget(_BoundedIntWidget):
class IntProgress(_BoundedInt):
_view_name = Unicode('ProgressView', sync=True)
_IntWidget = DeprecatedClass(_Int, '_IntWidget')
_BoundedIntWidget = DeprecatedClass(_BoundedInt, '_BoundedIntWidget')
IntTextWidget = DeprecatedClass(IntText, 'IntTextWidget')
BoundedIntTextWidget = DeprecatedClass(BoundedIntText, 'BoundedIntTextWidget')
IntSliderWidget = DeprecatedClass(IntSlider, 'IntSliderWidget')
IntProgressWidget = DeprecatedClass(IntProgress, 'IntProgressWidget')

@ -1,4 +1,4 @@
"""SelectionWidget classes.
"""Selection classes.
Represents an enumeration using a widget.
"""
@ -20,11 +20,12 @@ from threading import Lock
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, List, Bool, Any, Dict, TraitError
from IPython.utils.py3compat import unicode_type
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# SelectionWidget
#-----------------------------------------------------------------------------
class _SelectionWidget(DOMWidget):
class _Selection(DOMWidget):
"""Base class for Selection widgets
``values`` can be specified as a list or dict. If given as a list,
@ -109,17 +110,23 @@ class _SelectionWidget(DOMWidget):
self.value_lock.release()
class ToggleButtonsWidget(_SelectionWidget):
class ToggleButtons(_Selection):
_view_name = Unicode('ToggleButtonsView', sync=True)
class DropdownWidget(_SelectionWidget):
class Dropdown(_Selection):
_view_name = Unicode('DropdownView', sync=True)
class RadioButtonsWidget(_SelectionWidget):
class RadioButtons(_Selection):
_view_name = Unicode('RadioButtonsView', sync=True)
class SelectWidget(_SelectionWidget):
class Select(_Selection):
_view_name = Unicode('SelectView', sync=True)
_SelectionWidget = DeprecatedClass(_Selection, '_SelectionWidget')
ToggleButtonsWidget = DeprecatedClass(ToggleButtons, 'ToggleButtonsWidget')
DropdownWidget = DeprecatedClass(Dropdown, 'DropdownWidget')
RadioButtonsWidget = DeprecatedClass(RadioButtons, 'RadioButtonsWidget')
SelectWidget = DeprecatedClass(Select, 'SelectWidget')

@ -1,4 +1,4 @@
"""SelectionContainerWidget class.
"""SelectionContainer class.
Represents a multipage container that can be used to group other widgets into
pages.
@ -16,11 +16,12 @@ pages.
#-----------------------------------------------------------------------------
from .widget_container import ContainerWidget
from IPython.utils.traitlets import Unicode, Dict, CInt
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class _SelectionContainerWidget(ContainerWidget):
class _SelectionContainer(ContainerWidget):
_titles = Dict(help="Titles of the pages", sync=True)
selected_index = CInt(0, sync=True)
@ -50,9 +51,13 @@ class _SelectionContainerWidget(ContainerWidget):
return None
class AccordionWidget(_SelectionContainerWidget):
class Accordion(_SelectionContainer):
_view_name = Unicode('AccordionView', sync=True)
class TabWidget(_SelectionContainerWidget):
class Tab(_SelectionContainer):
_view_name = Unicode('TabView', sync=True)
_SelectionContainerWidget = DeprecatedClass(_SelectionContainer, '_SelectionContainerWidget')
AccordionWidget = DeprecatedClass(Accordion, 'AccordionWidget')
TabWidget = DeprecatedClass(Tab, 'TabWidget')

@ -1,4 +1,4 @@
"""StringWidget class.
"""String class.
Represents a unicode string using a widget.
"""
@ -15,37 +15,38 @@ Represents a unicode string using a widget.
#-----------------------------------------------------------------------------
from .widget import DOMWidget, CallbackDispatcher
from IPython.utils.traitlets import Unicode, Bool
from IPython.utils.warn import DeprecatedClass
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class _StringWidget(DOMWidget):
class _String(DOMWidget):
value = Unicode(help="String value", sync=True)
disabled = Bool(False, help="Enable or disable user changes", sync=True)
description = Unicode(help="Description of the value this widget represents", sync=True)
placeholder = Unicode("", help="Placeholder text to display when nothing has been typed", sync=True)
class HTMLWidget(_StringWidget):
class HTML(_String):
_view_name = Unicode('HTMLView', sync=True)
class LatexWidget(_StringWidget):
class Latex(_String):
_view_name = Unicode('LatexView', sync=True)
class TextareaWidget(_StringWidget):
class Textarea(_String):
_view_name = Unicode('TextareaView', sync=True)
def scroll_to_bottom(self):
self.send({"method": "scroll_to_bottom"})
class TextWidget(_StringWidget):
class Text(_String):
_view_name = Unicode('TextView', sync=True)
def __init__(self, **kwargs):
super(TextWidget, self).__init__(**kwargs)
super(Text, self).__init__(**kwargs)
self._submission_callbacks = CallbackDispatcher()
self.on_msg(self._handle_string_msg)
@ -71,3 +72,9 @@ class TextWidget(_StringWidget):
remove: bool (optional)
Whether to unregister the callback"""
self._submission_callbacks.register_callback(callback, remove=remove)
_StringWidget = DeprecatedClass(_String, '_StringWidget')
HTMLWidget = DeprecatedClass(HTML, 'HTMLWidget')
LatexWidget = DeprecatedClass(Latex, 'LatexWidget')
TextareaWidget = DeprecatedClass(Textarea, 'TextareaWidget')
TextWidget = DeprecatedClass(Text, 'TextWidget')

Loading…
Cancel
Save