Skip to content

Commit 9992d7c

Browse files
committed
Merge pull request #299 from SylvainCorlay/jupyter_registry
Use Jupyter namespace for widget registry
2 parents d56304d + 38e4720 commit 9992d7c

11 files changed

+54
-56
lines changed

ipywidgets/widgets/widget_bool.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def __init__(self, value=None, **kwargs):
2222
kwargs['value'] = value
2323
super(_Bool, self).__init__(**kwargs)
2424

25-
@register('IPython.Checkbox')
25+
26+
@register('Jupyter.Checkbox')
2627
class Checkbox(_Bool):
2728
"""Displays a boolean `value` in the form of a checkbox.
2829
@@ -36,7 +37,7 @@ class Checkbox(_Bool):
3637
_view_name = Unicode('CheckboxView', sync=True)
3738

3839

39-
@register('IPython.ToggleButton')
40+
@register('Jupyter.ToggleButton')
4041
class ToggleButton(_Bool):
4142
"""Displays a boolean `value` in the form of a toggle button.
4243
@@ -61,7 +62,7 @@ class ToggleButton(_Bool):
6162
predefined styling for the button.""")
6263

6364

64-
@register('IPython.Valid')
65+
@register('Jupyter.Valid')
6566
class Valid(_Bool):
6667

6768
"""Displays a boolean `value` in the form of a green check (True / valid)

ipywidgets/widgets/widget_box.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from warnings import warn
1313

1414

15-
@register('IPython.Box')
15+
@register('Jupyter.Box')
1616
class Box(DOMWidget):
1717
"""Displays multiple widgets in a group."""
1818
_model_name = Unicode('BoxModel', sync=True)
@@ -48,7 +48,7 @@ def _fire_children_displayed(self):
4848
child._handle_displayed()
4949

5050

51-
@register('IPython.Proxy')
51+
@register('Jupyter.Proxy')
5252
class Proxy(Widget):
5353
"""A DOMWidget that holds another DOMWidget or nothing."""
5454
_model_name = Unicode('ProxyModel', sync=True)
@@ -68,7 +68,7 @@ def _fire_child_displayed(self):
6868
self.child._handle_displayed()
6969

7070

71-
@register('IPython.PlaceProxy')
71+
@register('Jupyter.PlaceProxy')
7272
class PlaceProxy(Proxy):
7373
"""Renders the child widget at the specified selector."""
7474
_view_name = Unicode('PlaceProxyView', sync=True)
@@ -90,7 +90,7 @@ def HBox(*pargs, **kwargs):
9090
return box
9191

9292

93-
@register('IPython.FlexBox')
93+
@register('Jupyter.FlexBox')
9494
class FlexBox(Box): # TODO: Deprecated in 5.0 (entire class)
9595
"""Displays multiple widgets using the flexible box model."""
9696
_view_name = Unicode('FlexBoxView', sync=True)

ipywidgets/widgets/widget_button.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
from traitlets import Unicode, Bool, CaselessStrEnum
1313

1414

15-
@register('IPython.Button')
15+
@register('Jupyter.Button')
1616
class Button(DOMWidget):
1717
"""Button widget.
18-
This widget has an `on_click` method that allows you to listen for the
18+
This widget has an `on_click` method that allows you to listen for the
1919
user clicking on the button. The click event itself is stateless.
2020
2121
Parameters
@@ -36,10 +36,10 @@ class Button(DOMWidget):
3636
icon = Unicode('', help= "Font-awesome icon.", sync=True)
3737

3838
button_style = CaselessStrEnum(
39-
values=['primary', 'success', 'info', 'warning', 'danger', ''],
39+
values=['primary', 'success', 'info', 'warning', 'danger', ''],
4040
default_value='', allow_none=True, sync=True, help="""Use a
4141
predefined styling for the button.""")
42-
42+
4343
def __init__(self, **kwargs):
4444
"""Constructor"""
4545
super(Button, self).__init__(**kwargs)

ipywidgets/widgets/widget_color.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
from traitlets import Unicode, Bool
1313

1414

15-
@register('IPython.ColorPicker')
15+
@register('Jupyter.ColorPicker')
1616
class ColorPicker(DOMWidget):
1717
value = Color('black', sync=True)
1818
short = Bool(sync=True)
1919
description = Unicode(sync=True)
20-
20+
2121
_view_name = Unicode('ColorPicker', sync=True)

ipywidgets/widgets/widget_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from traitlets import Bool, Int, Float, Unicode, List, Instance
1212

1313

14-
@register('IPython.ControllerButton')
14+
@register('Jupyter.ControllerButton')
1515
class Button(Widget):
1616
"""Represents a gamepad or joystick button"""
1717
value = Float(min=0.0, max=1.0, read_only=True, sync=True)
@@ -20,15 +20,15 @@ class Button(Widget):
2020
_view_name = Unicode('ControllerButton', sync=True)
2121

2222

23-
@register('IPython.ControllerAxis')
23+
@register('Jupyter.ControllerAxis')
2424
class Axis(Widget):
2525
"""Represents a gamepad or joystick axis"""
2626
value = Float(min=-1.0, max=1.0, read_only=True, sync=True)
2727

2828
_view_name = Unicode('ControllerAxis', sync=True)
2929

3030

31-
@register('IPython.Controller')
31+
@register('Jupyter.Controller')
3232
class Controller(DOMWidget):
3333
"""Represents a game controller"""
3434
index = Int(sync=True)
@@ -48,4 +48,4 @@ class Controller(DOMWidget):
4848

4949
_view_name = Unicode('ControllerView', sync=True)
5050
_model_name = Unicode('Controller', sync=True)
51-
51+

ipywidgets/widgets/widget_float.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class _BoundedFloat(_Float):
2929
min = CFloat(0.0, help="Min value", sync=True)
3030
step = CFloat(0.1, help="Minimum step to increment the value (ignored by some views)", sync=True)
3131

32-
def __init__(self, *pargs, **kwargs):
33-
"""Constructor"""
34-
super(_BoundedFloat, self).__init__(*pargs, **kwargs)
35-
3632
def _value_validate(self, value, trait):
3733
"""Cap and floor value"""
3834
if self.min > value or self.max < value:
@@ -56,7 +52,7 @@ def _max_validate(self, max, trait):
5652
return max
5753

5854

59-
@register('IPython.FloatText')
55+
@register('Jupyter.FloatText')
6056
class FloatText(_Float):
6157
""" Displays a float value within a textbox. For a textbox in
6258
which the value must be within a specific range, use BoundedFloatText.
@@ -73,7 +69,7 @@ class FloatText(_Float):
7369
_view_name = Unicode('FloatTextView', sync=True)
7470

7571

76-
@register('IPython.BoundedFloatText')
72+
@register('Jupyter.BoundedFloatText')
7773
class BoundedFloatText(_BoundedFloat):
7874
""" Displays a float value within a textbox. Value must be within the range specified.
7975
For a textbox in which the value doesn't need to be within a specific range, use FloatText.
@@ -87,14 +83,14 @@ class BoundedFloatText(_BoundedFloat):
8783
max : float
8884
maximal value of the range of possible values displayed
8985
description : str
90-
description displayed next to the textbox
86+
description displayed next to the textbox
9187
color : str Unicode color code (eg. '#C13535'), optional
92-
color of the value displayed
88+
color of the value displayed
9389
"""
9490
_view_name = Unicode('FloatTextView', sync=True)
9591

9692

97-
@register('IPython.FloatSlider')
93+
@register('Jupyter.FloatSlider')
9894
class FloatSlider(_BoundedFloat):
9995
""" Slider/trackbar of floating values with the specified range.
10096
@@ -113,22 +109,22 @@ class FloatSlider(_BoundedFloat):
113109
orientation : {'vertical', 'horizontal}, optional
114110
default is horizontal
115111
readout : {True, False}, optional
116-
default is True, display the current value of the slider next to it
117-
slider_color : str Unicode color code (eg. '#C13535'), optional
118-
color of the slider
112+
default is True, display the current value of the slider next to it
113+
slider_color : str Unicode color code (eg. '#C13535'), optional
114+
color of the slider
119115
color : str Unicode color code (eg. '#C13535'), optional
120116
color of the value displayed (if readout == True)
121117
"""
122118
_view_name = Unicode('FloatSliderView', sync=True)
123-
orientation = CaselessStrEnum(values=['horizontal', 'vertical'],
119+
orientation = CaselessStrEnum(values=['horizontal', 'vertical'],
124120
default_value='horizontal', help="Vertical or horizontal.", sync=True)
125121
_range = Bool(False, help="Display a range selector", sync=True)
126122
readout = Bool(True, help="Display the current value of the slider next to it.", sync=True)
127123
slider_color = Color(None, allow_none=True, sync=True)
128124
continuous_update = Bool(True, sync=True, help="Update the value of the widget as the user is sliding the slider.")
129125

130126

131-
@register('IPython.FloatProgress')
127+
@register('Jupyter.FloatProgress')
132128
class FloatProgress(_BoundedFloat):
133129
""" Displays a progress bar.
134130
@@ -251,7 +247,7 @@ def _validate(self, name, old, new):
251247
self.lower = low
252248

253249

254-
@register('IPython.FloatRangeSlider')
250+
@register('Jupyter.FloatRangeSlider')
255251
class FloatRangeSlider(_BoundedFloatRange):
256252
""" Slider/trackbar for displaying a floating value range (within the specified range of values).
257253
@@ -270,9 +266,9 @@ class FloatRangeSlider(_BoundedFloatRange):
270266
orientation : {'vertical', 'horizontal}, optional
271267
default is horizontal
272268
readout : {True, False}, optional
273-
default is True, display the current value of the slider next to it
274-
slider_color : str Unicode color code (eg. '#C13535'), optional
275-
color of the slider
269+
default is True, display the current value of the slider next to it
270+
slider_color : str Unicode color code (eg. '#C13535'), optional
271+
color of the slider
276272
color : str Unicode color code (eg. '#C13535'), optional
277273
color of the value displayed (if readout == True)
278274
"""

ipywidgets/widgets/widget_image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from traitlets import Unicode, CUnicode, Bytes
1414

1515

16-
@register('IPython.Image')
16+
@register('Jupyter.Image')
1717
class Image(DOMWidget):
1818
"""Displays an image as a widget.
1919
@@ -22,13 +22,13 @@ class Image(DOMWidget):
2222
the format of the byte string using the `format` trait (which defaults to
2323
"png")."""
2424
_view_name = Unicode('ImageView', sync=True)
25-
25+
2626
# Define the custom state properties to sync with the front-end
2727
format = Unicode('png', sync=True)
2828
width = CUnicode(sync=True)
2929
height = CUnicode(sync=True)
3030
_b64value = Unicode(sync=True)
31-
31+
3232
value = Bytes()
3333
def _value_changed(self, name, old, new):
3434
self._b64value = base64.b64encode(new)

ipywidgets/widgets/widget_int.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,21 @@ def _max_validate(self, max, trait):
119119
self.value = max
120120
return max
121121

122-
@register('IPython.IntText')
122+
@register('Jupyter.IntText')
123123
@_int_doc
124124
class IntText(_Int):
125125
"""Textbox widget that represents an integer."""
126126
_view_name = Unicode('IntTextView', sync=True)
127127

128128

129-
@register('IPython.BoundedIntText')
129+
@register('Jupyter.BoundedIntText')
130130
@_bounded_int_doc
131131
class BoundedIntText(_BoundedInt):
132132
"""Textbox widget that represents an integer bounded by a minimum and maximum value."""
133133
_view_name = Unicode('IntTextView', sync=True)
134134

135135

136-
@register('IPython.IntSlider')
136+
@register('Jupyter.IntSlider')
137137
@_bounded_int_doc
138138
class IntSlider(_BoundedInt):
139139
"""Slider widget that represents an integer bounded by a minimum and maximum value."""
@@ -146,7 +146,7 @@ class IntSlider(_BoundedInt):
146146
continuous_update = Bool(True, sync=True, help="Update the value of the widget as the user is sliding the slider.")
147147

148148

149-
@register('IPython.IntProgress')
149+
@register('Jupyter.IntProgress')
150150
@_bounded_int_doc
151151
class IntProgress(_BoundedInt):
152152
"""Progress bar that represents an integer bounded by a minimum and maximum value."""
@@ -250,7 +250,7 @@ def _validate(self, name, old, new):
250250
self.upper = high
251251
self.lower = low
252252

253-
@register('IPython.IntRangeSlider')
253+
@register('Jupyter.IntRangeSlider')
254254
class IntRangeSlider(_BoundedIntRange):
255255
"""Slider widget that represents a pair of ints between a minimum and maximum value.
256256
@@ -267,7 +267,7 @@ class IntRangeSlider(_BoundedIntRange):
267267
The highest allowed value for `upper`
268268
"""
269269
_view_name = Unicode('IntSliderView', sync=True)
270-
orientation = CaselessStrEnum(values=['horizontal', 'vertical'],
270+
orientation = CaselessStrEnum(values=['horizontal', 'vertical'],
271271
default_value='horizontal', help="Vertical or horizontal.", sync=True)
272272
_range = Bool(True, help="Display a range selector", sync=True)
273273
readout = Bool(True, help="Display the current value of the slider next to it.", sync=True)

ipywidgets/widgets/widget_selection.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _selected_labels_changed(self, name, old, new):
185185
self.value_lock.release()
186186

187187

188-
@register('IPython.ToggleButtons')
188+
@register('Jupyter.ToggleButtons')
189189
class ToggleButtons(_Selection):
190190
"""Group of toggle buttons that represent an enumeration. Only one toggle
191191
button can be toggled at any point in time."""
@@ -198,7 +198,8 @@ class ToggleButtons(_Selection):
198198
default_value='', allow_none=True, sync=True, help="""Use a
199199
predefined styling for the buttons.""")
200200

201-
@register('IPython.Dropdown')
201+
202+
@register('Jupyter.Dropdown')
202203
class Dropdown(_Selection):
203204
"""Allows you to select a single item from a dropdown."""
204205
_view_name = Unicode('DropdownView', sync=True)
@@ -208,21 +209,21 @@ class Dropdown(_Selection):
208209
default_value='', allow_none=True, sync=True, help="""Use a
209210
predefined styling for the buttons.""")
210211

211-
@register('IPython.RadioButtons')
212+
213+
@register('Jupyter.RadioButtons')
212214
class RadioButtons(_Selection):
213215
"""Group of radio buttons that represent an enumeration. Only one radio
214216
button can be toggled at any point in time."""
215217
_view_name = Unicode('RadioButtonsView', sync=True)
216218

217219

218-
219-
@register('IPython.Select')
220+
@register('Jupyter.Select')
220221
class Select(_Selection):
221222
"""Listbox that only allows one item to be selected at any given time."""
222223
_view_name = Unicode('SelectView', sync=True)
223224

224225

225-
@register('IPython.SelectMultiple')
226+
@register('Jupyter.SelectMultiple')
226227
class SelectMultiple(_MultipleSelection):
227228
"""Listbox that allows many items to be selected at any given time.
228229
Despite their names, inherited from ``_Selection``, the currently chosen

ipywidgets/widgets/widget_selectioncontainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def get_title(self, index):
4242
return None
4343

4444

45-
@register('IPython.Accordion')
45+
@register('Jupyter.Accordion')
4646
class Accordion(_SelectionContainer):
4747
"""Displays children each on a separate accordion page."""
4848
_view_name = Unicode('AccordionView', sync=True)
4949

5050

51-
@register('IPython.Tab')
51+
@register('Jupyter.Tab')
5252
class Tab(_SelectionContainer):
5353
"""Displays children each on a separate accordion tab."""
5454
_view_name = Unicode('TabView', sync=True)

0 commit comments

Comments
 (0)