mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-11 12:30:51 +08:00
adding hbox and vbox
Conflicts: IPython/html/static/widgets/js/widget_container.js IPython/html/widgets/widget_container.py
This commit is contained in:
parent
170b13102e
commit
c9ed512d54
@ -50,12 +50,23 @@ define([
|
||||
var FlexContainerView = ContainerView.extend({
|
||||
render: function(){
|
||||
FlexContainerView.__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);
|
||||
this.model.on('change:align', this._align_changed, this);
|
||||
this._flex_changed();
|
||||
this._pack_changed();
|
||||
this._align_changed();
|
||||
that.update_orientation();
|
||||
},
|
||||
|
||||
update_orientation: function(){
|
||||
var orientation = this.model.get("orientation");
|
||||
if (orientation == "vertical") {
|
||||
this.$el.removeClass("hbox").addClass("vbox");
|
||||
} else {
|
||||
this.$el.removeClass("vbox").addClass("hbox");
|
||||
}
|
||||
},
|
||||
|
||||
_flex_changed: function(){
|
||||
|
@ -14,7 +14,7 @@ from .interaction import interact, interactive, fixed
|
||||
# Deprecated classes
|
||||
from .widget_bool import CheckboxWidget, ToggleButtonWidget
|
||||
from .widget_button import ButtonWidget
|
||||
from .widget_container import ContainerWidget, PopupWidget
|
||||
from .widget_container import ContainerWidget, HBox, VBox, PopupWidget
|
||||
from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget
|
||||
from .widget_image import ImageWidget
|
||||
from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, IntProgressWidget
|
||||
|
@ -37,6 +37,7 @@ class Popup(Container):
|
||||
|
||||
class FlexContainer(Container):
|
||||
_view_name = Unicode('FlexContainerView', sync=True)
|
||||
orientation = Unicode('vertical', sync=True)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user