s/Container/Box

pull/37/head
Jonathan Frederic 12 years ago
parent 848c223785
commit d985ee86c6

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

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

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

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

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

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

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

@ -39,5 +39,5 @@ class ToggleButton(_Bool):
# Remove in IPython 4.0
CheckboxWidget = DeprecatedClass(Checkbox, 'CheckboxWidget')
CheckBox = DeprecatedClass(Checkbox, 'CheckBox')
ToggleButtonWidget = DeprecatedClass(ToggleButton, 'ToggleButtonWidget')

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

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

Loading…
Cancel
Save