##// END OF EJS Templates
Merge pull request #8302 from minrk/rm-nbconvert...
Merge pull request #8302 from minrk/rm-nbconvert remove nbconvert

File last commit:

r21208:e65db1aa
r21235:1f4b002e merge
Show More
widget_box.py
82 lines | 3.0 KiB | text/x-python | PythonLexer
Jonathan Frederic
s/Container/Box
r17637 """Box class.
Jonathan Frederic
Cleaned up Python widget code.
r14283
Represents a container that can be used to group other widgets.
"""
Jonathan Frederic
Allow a widget to be displayed more than once within a parent widget.
r17172
# Copyright (c) IPython Development Team.
Jonathan Frederic
Cleaned up Python widget code.
r14283 # Distributed under the terms of the Modified BSD License.
Sylvain Corlay
Move _unpack_models to widget.js and widget serialization to widget.py
r21157 from .widget import DOMWidget, Widget, register, widget_serialization
Jonathan Frederic
Embrace flexible box model
r17596 from IPython.utils.traitlets import Unicode, Tuple, TraitError, Int, CaselessStrEnum
Min RK
move DeprecatedClass to widgets, where it's used...
r21081 from .deprecated import DeprecatedClass
Jonathan Frederic
Add container widget
r14239
Jason Grout
Change custom serialization to use custom models, rather than transmitting the serializer name across the wire...
r20935
Sylvain Corlay
jupyter -> IPython
r18533 @register('IPython.Box')
Jonathan Frederic
s/Container/Box
r17637 class Box(DOMWidget):
Jonathan Frederic
Added some doc strings on the widgets....
r17602 """Displays multiple widgets in a group."""
Jason Grout
Change custom serialization to use custom models, rather than transmitting the serializer name across the wire...
r20935 _model_name = Unicode('BoxModel', sync=True)
Jonathan Frederic
s/Container/Box
r17637 _view_name = Unicode('BoxView', sync=True)
Jonathan Frederic
Attempt 1, HBox and VBox implementation.
r14268
MinRK
don't validate ContainerWidget.children...
r15480 # Child widgets in the container.
# Using a tuple here to force reassignment to update the list.
# When a proper notifying-list trait exists, that is what should be used here.
Jason Grout
work-in-progress for custom js serializers
r20839 children = Tuple(sync=True, **widget_serialization)
Jonathan Frederic
Fix some bugs found by the widget examples,...
r17727
_overflow_values = ['visible', 'hidden', 'scroll', 'auto', 'initial', 'inherit', '']
overflow_x = CaselessStrEnum(
values=_overflow_values,
Sylvain Corlay
removing redundant allow_none=False
r20483 default_value='', sync=True, help="""Specifies what
Jonathan Frederic
Fix some bugs found by the widget examples,...
r17727 happens to content that is too large for the rendered region.""")
overflow_y = CaselessStrEnum(
values=_overflow_values,
Sylvain Corlay
removing redundant allow_none=False
r20483 default_value='', sync=True, help="""Specifies what
Jonathan Frederic
Fix some bugs found by the widget examples,...
r17727 happens to content that is too large for the rendered region.""")
zah
Children fire event...
r15446
Jonathan Frederic
Added Bootstrap specific classes,...
r17728 box_style = CaselessStrEnum(
values=['success', 'info', 'warning', 'danger', ''],
default_value='', allow_none=True, sync=True, help="""Use a
predefined styling for the box.""")
Jason Grout
Container assumes the children attribute is not None...
r17266 def __init__(self, children = (), **kwargs):
Jason Grout
Make Container widgets take children as the first positional argument...
r17261 kwargs['children'] = children
Jonathan Frederic
s/Container/Box
r17637 super(Box, self).__init__(**kwargs)
self.on_displayed(Box._fire_children_displayed)
zah
Children fire event...
r15446
def _fire_children_displayed(self):
Jonathan Frederic
Fixed buggy behavior
r17173 for child in self.children:
zah
Children fire event...
r15446 child._handle_displayed()
Jonathan Frederic
More PEP8 changes
r14607
Sylvain Corlay
jupyter -> IPython
r18533 @register('IPython.FlexBox')
Jonathan Frederic
s/Container/Box
r17637 class FlexBox(Box):
Jonathan Frederic
Added some doc strings on the widgets....
r17602 """Displays multiple widgets using the flexible box model."""
Jonathan Frederic
s/Container/Box
r17637 _view_name = Unicode('FlexBoxView', sync=True)
Jonathan Frederic
Make HBox and VBox helper functions
r17601 orientation = CaselessStrEnum(values=['vertical', 'horizontal'], default_value='vertical', sync=True)
Jonathan Frederic
Embrace flexible box model
r17596 flex = Int(0, sync=True, help="""Specify the flexible-ness of the model.""")
def _flex_changed(self, name, old, new):
new = min(max(0, new), 2)
if self.flex != new:
self.flex = new
Jonathan Frederic
Added baseline and stretch
r17597 _locations = ['start', 'center', 'end', 'baseline', 'stretch']
pack = CaselessStrEnum(
values=_locations,
Sylvain Corlay
removing redundant allow_none=False
r20483 default_value='start', sync=True)
Jonathan Frederic
Added baseline and stretch
r17597 align = CaselessStrEnum(
values=_locations,
Sylvain Corlay
removing redundant allow_none=False
r20483 default_value='start', sync=True)
Jonathan Frederic
Embrace flexible box model
r17596
Jonathan Frederic
Make HBox and VBox helper functions
r17601 def VBox(*pargs, **kwargs):
Jonathan Frederic
Added some doc strings on the widgets....
r17602 """Displays multiple widgets vertically using the flexible box model."""
Jonathan Frederic
Make HBox and VBox helper functions
r17601 kwargs['orientation'] = 'vertical'
Jonathan Frederic
s/Container/Box
r17637 return FlexBox(*pargs, **kwargs)
Jonathan Frederic
Embrace flexible box model
r17596
Jonathan Frederic
Make HBox and VBox helper functions
r17601 def HBox(*pargs, **kwargs):
Jonathan Frederic
Added some doc strings on the widgets....
r17602 """Displays multiple widgets horizontally using the flexible box model."""
Jonathan Frederic
Make HBox and VBox helper functions
r17601 kwargs['orientation'] = 'horizontal'
Jonathan Frederic
s/Container/Box
r17637 return FlexBox(*pargs, **kwargs)
Jonathan Frederic
Embrace flexible box model
r17596
Jonathan Frederic
Renamed *Widget to *,...
r17598
Jonathan Frederic
Added some doc strings on the widgets....
r17602 # Remove in IPython 4.0
Jonathan Frederic
s/Container/Box
r17637 ContainerWidget = DeprecatedClass(Box, 'ContainerWidget')