diff --git a/IPython/html/widgets/__init__.py b/IPython/html/widgets/__init__.py
index 6202414..6354735 100644
--- a/IPython/html/widgets/__init__.py
+++ b/IPython/html/widgets/__init__.py
@@ -1,4 +1,4 @@
-from .widget import Widget
+from .widget import Widget, DOMWidget
from .widget_bool import BoolWidget
from .widget_button import ButtonWidget
diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py
index 7caedbe..70f3835 100644
--- a/IPython/html/widgets/widget.py
+++ b/IPython/html/widgets/widget.py
@@ -31,7 +31,7 @@ from IPython.utils.py3compat import string_types
# Classes
#-----------------------------------------------------------------------------
-class BaseWidget(LoggingConfigurable):
+class Widget(LoggingConfigurable):
# Shared declarations (Class level)
widget_construction_callback = None
@@ -42,12 +42,12 @@ class BaseWidget(LoggingConfigurable):
"""Class method, registers a callback to be called when a widget is
constructed. The callback must have the following signature:
callback(widget)"""
- BaseWidget.widget_construction_callback = callback
+ Widget.widget_construction_callback = callback
def _handle_widget_constructed(widget):
"""Class method, called when a widget is constructed."""
- if BaseWidget.widget_construction_callback is not None and callable(BaseWidget.widget_construction_callback):
- BaseWidget.widget_construction_callback(widget)
+ if Widget.widget_construction_callback is not None and callable(Widget.widget_construction_callback):
+ Widget.widget_construction_callback(widget)
@@ -68,10 +68,10 @@ class BaseWidget(LoggingConfigurable):
"""
self._display_callbacks = []
self._msg_callbacks = []
- super(BaseWidget, self).__init__(**kwargs)
+ super(Widget, self).__init__(**kwargs)
self.on_trait_change(self._handle_property_changed, self.keys)
- BaseWidget._handle_widget_constructed(self)
+ Widget._handle_widget_constructed(self)
def __del__(self):
"""Object disposal"""
@@ -205,14 +205,14 @@ class BaseWidget(LoggingConfigurable):
for k in keys:
value = getattr(self, k)
- # a more elegant solution to encoding BaseWidgets would be
+ # a more elegant solution to encoding Widgets would be
# to tap into the JSON encoder and teach it how to deal
- # with BaseWidget objects, or maybe just teach the JSON
+ # with Widget objects, or maybe just teach the JSON
# encoder to look for a _repr_json property before giving
# up encoding
- if isinstance(value, BaseWidget):
+ if isinstance(value, Widget):
value = value.model_id
- elif isinstance(value, list) and len(value)>0 and isinstance(value[0], BaseWidget):
+ elif isinstance(value, list) and len(value)>0 and isinstance(value[0], Widget):
# assume all elements of the list are widgets
value = [i.model_id for i in value]
state[k] = value
@@ -321,13 +321,13 @@ class BaseWidget(LoggingConfigurable):
return False
-class Widget(BaseWidget):
+class DOMWidget(Widget):
visible = Bool(True, help="Whether or not the widget is visible.")
# Private/protected declarations
_css = Dict() # Internal CSS property dict
- keys = ['visible', '_css'] + BaseWidget.keys
+ keys = ['visible', '_css'] + Widget.keys
def get_css(self, key, selector=""):
"""Get a CSS property of the widget. Note, this function does not
diff --git a/IPython/html/widgets/widget_bool.py b/IPython/html/widgets/widget_bool.py
index 43f4b17..641a689 100644
--- a/IPython/html/widgets/widget_bool.py
+++ b/IPython/html/widgets/widget_bool.py
@@ -13,18 +13,18 @@ Represents a boolean using a widget.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Bool, List
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class BoolWidget(Widget):
+class BoolWidget(DOMWidget):
target_name = Unicode('BoolWidgetModel')
default_view_name = Unicode('CheckboxView')
# Model Keys
- keys = ['value', 'description', 'disabled'] + Widget.keys
+ keys = ['value', 'description', 'disabled'] + DOMWidget.keys
value = Bool(False, help="Bool value")
description = Unicode('', help="Description of the boolean (label).")
disabled = Bool(False, help="Enable or disable user changes.")
diff --git a/IPython/html/widgets/widget_button.py b/IPython/html/widgets/widget_button.py
index 5f0a35c..6ef8f94 100644
--- a/IPython/html/widgets/widget_button.py
+++ b/IPython/html/widgets/widget_button.py
@@ -17,18 +17,18 @@ click events on the button and trigger backend code when the clicks are fired.
import inspect
import types
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Bool, Int
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class ButtonWidget(Widget):
+class ButtonWidget(DOMWidget):
target_name = Unicode('ButtonWidgetModel')
default_view_name = Unicode('ButtonView')
# Keys
- keys = ['description', 'disabled'] + Widget.keys
+ keys = ['description', 'disabled'] + DOMWidget.keys
description = Unicode('', help="Description of the button (label).")
disabled = Bool(False, help="Enable or disable user changes.")
diff --git a/IPython/html/widgets/widget_container.py b/IPython/html/widgets/widget_container.py
index 857bf01..ef63902 100644
--- a/IPython/html/widgets/widget_container.py
+++ b/IPython/html/widgets/widget_container.py
@@ -13,13 +13,13 @@ Represents a container that can be used to group other widgets.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Bool, List, Instance
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class ContainerWidget(Widget):
+class ContainerWidget(DOMWidget):
target_name = Unicode('ContainerWidgetModel')
default_view_name = Unicode('ContainerView')
@@ -28,8 +28,8 @@ class ContainerWidget(Widget):
keys = ['_vbox', '_hbox', '_align_start', '_align_end', '_align_center',
'_pack_start', '_pack_end', '_pack_center', '_flex0', '_flex1',
'_flex2', 'description', 'button_text',
- 'children'] + Widget.keys
- children = List(Instance(Widget))
+ 'children'] + DOMWidget.keys
+ children = List(Instance(DOMWidget))
description = Unicode()
button_text = Unicode()
diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py
index a52a7b2..f0a5431 100644
--- a/IPython/html/widgets/widget_float.py
+++ b/IPython/html/widgets/widget_float.py
@@ -13,18 +13,18 @@ Represents an unbounded float using a widget.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Float, Bool, List
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class FloatWidget(Widget):
+class FloatWidget(DOMWidget):
target_name = Unicode('FloatWidgetModel')
default_view_name = Unicode('FloatTextView')
# Keys
- keys = ['value', 'disabled', 'description'] + Widget.keys
+ keys = ['value', 'disabled', 'description'] + DOMWidget.keys
value = Float(0.0, help="Float value")
disabled = Bool(False, help="Enable or disable user changes")
description = Unicode(help="Description of the value this widget represents")
diff --git a/IPython/html/widgets/widget_float_range.py b/IPython/html/widgets/widget_float_range.py
index dac89f9..31af705 100644
--- a/IPython/html/widgets/widget_float_range.py
+++ b/IPython/html/widgets/widget_float_range.py
@@ -13,18 +13,18 @@ Represents a bounded float using a widget.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Float, Bool, List
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class FloatRangeWidget(Widget):
+class FloatRangeWidget(DOMWidget):
target_name = Unicode('FloatRangeWidgetModel')
default_view_name = Unicode('FloatSliderView')
# Keys
- keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + Widget.keys
+ keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + DOMWidget.keys
value = Float(0.0, help="Flaot value")
max = Float(100.0, help="Max value")
min = Float(0.0, help="Min value")
diff --git a/IPython/html/widgets/widget_image.py b/IPython/html/widgets/widget_image.py
index 214c772..a52e12a 100644
--- a/IPython/html/widgets/widget_image.py
+++ b/IPython/html/widgets/widget_image.py
@@ -16,18 +16,18 @@ click events on the button and trigger backend code when the clicks are fired.
#-----------------------------------------------------------------------------
import base64
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Bytes
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class ImageWidget(Widget):
+class ImageWidget(DOMWidget):
target_name = Unicode('ImageWidgetModel')
default_view_name = Unicode('ImageView')
# Define the custom state properties to sync with the front-end
- keys = ['image_format', 'width', 'height', '_b64value'] + Widget.keys
+ keys = ['image_format', 'width', 'height', '_b64value'] + DOMWidget.keys
image_format = Unicode('png')
width = Unicode()
height = Unicode()
diff --git a/IPython/html/widgets/widget_int.py b/IPython/html/widgets/widget_int.py
index 91dab57..b8d6ef5 100644
--- a/IPython/html/widgets/widget_int.py
+++ b/IPython/html/widgets/widget_int.py
@@ -13,18 +13,18 @@ Represents an unbounded int using a widget.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Int, Bool, List
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class IntWidget(Widget):
+class IntWidget(DOMWidget):
target_name = Unicode('IntWidgetModel')
default_view_name = Unicode('IntTextView')
# Keys
- keys = ['value', 'disabled', 'description'] + Widget.keys
+ keys = ['value', 'disabled', 'description'] + DOMWidget.keys
value = Int(0, help="Int value")
disabled = Bool(False, help="Enable or disable user changes")
description = Unicode(help="Description of the value this widget represents")
diff --git a/IPython/html/widgets/widget_int_range.py b/IPython/html/widgets/widget_int_range.py
index d7383d9..f197d40 100644
--- a/IPython/html/widgets/widget_int_range.py
+++ b/IPython/html/widgets/widget_int_range.py
@@ -13,18 +13,18 @@ Represents a bounded int using a widget.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Int, Bool, List
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class IntRangeWidget(Widget):
+class IntRangeWidget(DOMWidget):
target_name = Unicode('IntRangeWidgetModel')
default_view_name = Unicode('IntSliderView')
# Keys
- keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + Widget.keys
+ keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + DOMWidget.keys
value = Int(0, help="Int value")
max = Int(100, help="Max value")
min = Int(0, help="Min value")
diff --git a/IPython/html/widgets/widget_multicontainer.py b/IPython/html/widgets/widget_multicontainer.py
index c82d520..d6d73a7 100644
--- a/IPython/html/widgets/widget_multicontainer.py
+++ b/IPython/html/widgets/widget_multicontainer.py
@@ -14,22 +14,22 @@ pages.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Dict, Int, List, Instance
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class MulticontainerWidget(Widget):
+class MulticontainerWidget(DOMWidget):
target_name = Unicode('MulticontainerWidgetModel')
default_view_name = Unicode('TabView')
# Keys
- keys = ['_titles', 'selected_index', 'children'] + Widget.keys
+ keys = ['_titles', 'selected_index', 'children'] + DOMWidget.keys
_titles = Dict(help="Titles of the pages")
selected_index = Int(0)
- children = List(Instance(Widget))
+ children = List(Instance(DOMWidget))
# Public methods
def set_title(self, index, title):
diff --git a/IPython/html/widgets/widget_selection.py b/IPython/html/widgets/widget_selection.py
index 1488a5d..a3bcc0c 100644
--- a/IPython/html/widgets/widget_selection.py
+++ b/IPython/html/widgets/widget_selection.py
@@ -13,18 +13,18 @@ Represents an enumeration using a widget.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, List, Bool
#-----------------------------------------------------------------------------
# SelectionWidget
#-----------------------------------------------------------------------------
-class SelectionWidget(Widget):
+class SelectionWidget(DOMWidget):
target_name = Unicode('SelectionWidgetModel')
default_view_name = Unicode('DropdownView')
# Keys
- keys = ['value', 'values', 'disabled', 'description'] + Widget.keys
+ keys = ['value', 'values', 'disabled', 'description'] + DOMWidget.keys
value = Unicode(help="Selected value")
values = List(help="List of values the user can select")
disabled = Bool(False, help="Enable or disable user changes")
diff --git a/IPython/html/widgets/widget_string.py b/IPython/html/widgets/widget_string.py
index d7bbaad..83f004b 100644
--- a/IPython/html/widgets/widget_string.py
+++ b/IPython/html/widgets/widget_string.py
@@ -16,18 +16,18 @@ Represents a unicode string using a widget.
import inspect
import types
-from .widget import Widget
+from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Bool, List, Int
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
-class StringWidget(Widget):
+class StringWidget(DOMWidget):
target_name = Unicode('StringWidgetModel')
default_view_name = Unicode('TextBoxView')
# Keys
- keys = ['value', 'disabled', 'description'] + Widget.keys
+ keys = ['value', 'disabled', 'description'] + DOMWidget.keys
value = Unicode(help="String value")
disabled = Bool(False, help="Enable or disable user changes")
description = Unicode(help="Description of the value this widget represents")