From 1fa8d824c60584e7463da2f48fd77f81300ff5e2 2014-08-13 20:19:27 From: Jonathan Frederic Date: 2014-08-13 20:19:27 Subject: [PATCH] s/Container/Box --- diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css index add3cd0..3335b5d 100644 --- a/IPython/html/static/style/ipython.min.css +++ b/IPython/html/static/style/ipython.min.css @@ -1493,7 +1493,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -1524,7 +1524,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -1576,7 +1576,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -1631,7 +1631,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -1683,7 +1683,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -1716,7 +1716,7 @@ div.cell.text_cell.rendered { width: 30px; } .widget-modal { - /* ContainerWidget - ModalView */ + /* Box - ModalView */ overflow: hidden; position: absolute !important; top: 0px; @@ -1724,11 +1724,11 @@ div.cell.text_cell.rendered { margin-left: 0px !important; } .widget-modal-body { - /* ContainerWidget - ModalView Body */ + /* Box - ModalView Body */ max-height: none !important; } .widget-container { - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index 9fe1651..2b02974 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -9265,7 +9265,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -9296,7 +9296,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -9348,7 +9348,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -9403,7 +9403,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -9455,7 +9455,7 @@ div.cell.text_cell.rendered { box-pack: start; /* Modern browsers */ justify-content: flex-start; - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -9488,7 +9488,7 @@ div.cell.text_cell.rendered { width: 30px; } .widget-modal { - /* ContainerWidget - ModalView */ + /* Box - ModalView */ overflow: hidden; position: absolute !important; top: 0px; @@ -9496,11 +9496,11 @@ div.cell.text_cell.rendered { margin-left: 0px !important; } .widget-modal-body { - /* ContainerWidget - ModalView Body */ + /* Box - ModalView Body */ max-height: none !important; } .widget-container { - /* ContainerWidget */ + /* Box */ box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; diff --git a/IPython/html/static/widgets/js/widget_container.js b/IPython/html/static/widgets/js/widget_container.js index fe4551f..f732320 100644 --- a/IPython/html/static/widgets/js/widget_container.js +++ b/IPython/html/static/widgets/js/widget_container.js @@ -7,10 +7,10 @@ define([ "bootstrap", ], function(widget, $){ - var ContainerView = widget.DOMWidgetView.extend({ + var BoxView = widget.DOMWidgetView.extend({ initialize: function(){ // Public constructor - ContainerView.__super__.initialize.apply(this, arguments); + BoxView.__super__.initialize.apply(this, arguments); this.update_children([], this.model.get('children')); this.model.on('change:children', function(model, value) { this.update_children(model.previous('children'), value); @@ -47,9 +47,9 @@ define([ }); - var FlexContainerView = ContainerView.extend({ + var FlexBoxView = BoxView.extend({ render: function(){ - FlexContainerView.__super__.render.apply(this); + FlexBoxView.__super__.render.apply(this); this.model.on('change:orientation', this.update_orientation, this); this.model.on('change:flex', this._flex_changed, this); this.model.on('change:pack', this._pack_changed, this); @@ -321,8 +321,8 @@ define([ }); return { - 'ContainerView': ContainerView, + 'BoxView': BoxView, 'PopupView': PopupView, - 'FlexContainerView': FlexContainerView, + 'FlexBoxView': FlexBoxView, }; }); diff --git a/IPython/html/static/widgets/less/widgets.less b/IPython/html/static/widgets/less/widgets.less index 4eed2e2..89dadd0 100644 --- a/IPython/html/static/widgets/less/widgets.less +++ b/IPython/html/static/widgets/less/widgets.less @@ -248,7 +248,7 @@ } .widget-modal { - /* ContainerWidget - ModalView */ + /* Box - ModalView */ overflow : hidden; position : absolute !important; top : 0px; @@ -257,12 +257,12 @@ } .widget-modal-body { - /* ContainerWidget - ModalView Body */ + /* Box - ModalView Body */ max-height: none !important; } .widget-container { - /* ContainerWidget */ + /* Box */ .border-box-sizing(); .align-start(); } diff --git a/IPython/html/tests/widgets/widget_container.js b/IPython/html/tests/widgets/widget_container.js index 102436b..397f820 100644 --- a/IPython/html/tests/widgets/widget_container.js +++ b/IPython/html/tests/widgets/widget_container.js @@ -7,7 +7,7 @@ casper.notebook_test(function () { this.execute_cell_then(index); var container_index = this.append_cell( - 'container = widgets.Container()\n' + + 'container = widgets.Box()\n' + 'button = widgets.Button()\n'+ 'container.children = [button]\n'+ 'display(container)\n'+ diff --git a/IPython/html/widgets/__init__.py b/IPython/html/widgets/__init__.py index a1c645b..54b1398 100644 --- a/IPython/html/widgets/__init__.py +++ b/IPython/html/widgets/__init__.py @@ -2,7 +2,7 @@ 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_container import Box, Popup, FlexBox, HBox, VBox from .widget_float import FloatText, BoundedFloatText, FloatSlider, FloatProgress from .widget_image import Image from .widget_int import IntText, BoundedIntText, IntSlider, IntProgress @@ -12,7 +12,7 @@ from .widget_string import HTML, Latex, Text, Textarea from .interaction import interact, interactive, fixed # Deprecated classes -from .widget_bool import CheckboxWidget, ToggleButtonWidget +from .widget_bool import CheckBox, ToggleButtonWidget from .widget_button import ButtonWidget from .widget_container import ContainerWidget, PopupWidget from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget diff --git a/IPython/html/widgets/interaction.py b/IPython/html/widgets/interaction.py index c8a3592..86c7125 100644 --- a/IPython/html/widgets/interaction.py +++ b/IPython/html/widgets/interaction.py @@ -23,7 +23,7 @@ from inspect import getcallargs from IPython.core.getipython import get_ipython from IPython.html.widgets import (Widget, Text, FloatSlider, IntSlider, Checkbox, Dropdown, - Container, DOMWidget) + Box, 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 @@ -176,7 +176,7 @@ def interactive(__interact_f, **kwargs): f = __interact_f co = kwargs.pop('clear_output', True) kwargs_widgets = [] - container = Container() + container = Box() container.result = None container.args = [] container.kwargs = dict() diff --git a/IPython/html/widgets/widget_bool.py b/IPython/html/widgets/widget_bool.py index b7bbb1d..06f912e 100644 --- a/IPython/html/widgets/widget_bool.py +++ b/IPython/html/widgets/widget_bool.py @@ -39,5 +39,5 @@ class ToggleButton(_Bool): # Remove in IPython 4.0 -CheckboxWidget = DeprecatedClass(Checkbox, 'CheckboxWidget') +CheckBox = DeprecatedClass(Checkbox, 'CheckBox') ToggleButtonWidget = DeprecatedClass(ToggleButton, 'ToggleButtonWidget') diff --git a/IPython/html/widgets/widget_container.py b/IPython/html/widgets/widget_container.py index 89f5f1f..bd204bd 100644 --- a/IPython/html/widgets/widget_container.py +++ b/IPython/html/widgets/widget_container.py @@ -1,4 +1,4 @@ -"""Container class. +"""Box class. Represents a container that can be used to group other widgets. """ @@ -10,9 +10,9 @@ from .widget import DOMWidget from IPython.utils.traitlets import Unicode, Tuple, TraitError, Int, CaselessStrEnum from IPython.utils.warn import DeprecatedClass -class Container(DOMWidget): +class Box(DOMWidget): """Displays multiple widgets in a group.""" - _view_name = Unicode('ContainerView', sync=True) + _view_name = Unicode('BoxView', sync=True) # Child widgets in the container. # Using a tuple here to force reassignment to update the list. @@ -21,15 +21,15 @@ class Container(DOMWidget): def __init__(self, children = (), **kwargs): kwargs['children'] = children - super(Container, self).__init__(**kwargs) - self.on_displayed(Container._fire_children_displayed) + super(Box, self).__init__(**kwargs) + self.on_displayed(Box._fire_children_displayed) def _fire_children_displayed(self): for child in self.children: child._handle_displayed() -class Popup(Container): +class Popup(Box): """Displays multiple widgets in an in page popup div.""" _view_name = Unicode('PopupView', sync=True) @@ -37,9 +37,9 @@ class Popup(Container): button_text = Unicode(sync=True) -class FlexContainer(Container): +class FlexBox(Box): """Displays multiple widgets using the flexible box model.""" - _view_name = Unicode('FlexContainerView', sync=True) + _view_name = Unicode('FlexBoxView', sync=True) orientation = CaselessStrEnum(values=['vertical', 'horizontal'], default_value='vertical', sync=True) flex = Int(0, sync=True, help="""Specify the flexible-ness of the model.""") def _flex_changed(self, name, old, new): @@ -59,15 +59,15 @@ class FlexContainer(Container): def VBox(*pargs, **kwargs): """Displays multiple widgets vertically using the flexible box model.""" kwargs['orientation'] = 'vertical' - return FlexContainer(*pargs, **kwargs) + return FlexBox(*pargs, **kwargs) def HBox(*pargs, **kwargs): """Displays multiple widgets horizontally using the flexible box model.""" kwargs['orientation'] = 'horizontal' - return FlexContainer(*pargs, **kwargs) + return FlexBox(*pargs, **kwargs) # Remove in IPython 4.0 -ContainerWidget = DeprecatedClass(Container, 'ContainerWidget') +ContainerWidget = DeprecatedClass(Box, 'ContainerWidget') PopupWidget = DeprecatedClass(Popup, 'PopupWidget') diff --git a/IPython/html/widgets/widget_selectioncontainer.py b/IPython/html/widgets/widget_selectioncontainer.py index 1560fa0..7d00b35 100644 --- a/IPython/html/widgets/widget_selectioncontainer.py +++ b/IPython/html/widgets/widget_selectioncontainer.py @@ -14,14 +14,14 @@ pages. #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- -from .widget_container import ContainerWidget +from .widget_container import Box from IPython.utils.traitlets import Unicode, Dict, CInt from IPython.utils.warn import DeprecatedClass #----------------------------------------------------------------------------- # Classes #----------------------------------------------------------------------------- -class _SelectionContainer(ContainerWidget): +class _SelectionContainer(Box): """Base class used to display multiple child widgets.""" _titles = Dict(help="Titles of the pages", sync=True) selected_index = CInt(0, sync=True)