Show More
@@ -50,12 +50,23 b' define([' | |||||
50 | var FlexContainerView = ContainerView.extend({ |
|
50 | var FlexContainerView = ContainerView.extend({ | |
51 | render: function(){ |
|
51 | render: function(){ | |
52 | FlexContainerView.__super__.render.apply(this); |
|
52 | FlexContainerView.__super__.render.apply(this); | |
|
53 | this.model.on('change:orientation', this.update_orientation, this); | |||
53 | this.model.on('change:flex', this._flex_changed, this); |
|
54 | this.model.on('change:flex', this._flex_changed, this); | |
54 | this.model.on('change:pack', this._pack_changed, this); |
|
55 | this.model.on('change:pack', this._pack_changed, this); | |
55 | this.model.on('change:align', this._align_changed, this); |
|
56 | this.model.on('change:align', this._align_changed, this); | |
56 | this._flex_changed(); |
|
57 | this._flex_changed(); | |
57 | this._pack_changed(); |
|
58 | this._pack_changed(); | |
58 | this._align_changed(); |
|
59 | this._align_changed(); | |
|
60 | that.update_orientation(); | |||
|
61 | }, | |||
|
62 | ||||
|
63 | update_orientation: function(){ | |||
|
64 | var orientation = this.model.get("orientation"); | |||
|
65 | if (orientation == "vertical") { | |||
|
66 | this.$el.removeClass("hbox").addClass("vbox"); | |||
|
67 | } else { | |||
|
68 | this.$el.removeClass("vbox").addClass("hbox"); | |||
|
69 | } | |||
59 | }, |
|
70 | }, | |
60 |
|
71 | |||
61 | _flex_changed: function(){ |
|
72 | _flex_changed: function(){ |
@@ -14,7 +14,7 b' from .interaction import interact, interactive, fixed' | |||||
14 | # Deprecated classes |
|
14 | # Deprecated classes | |
15 | from .widget_bool import CheckboxWidget, ToggleButtonWidget |
|
15 | from .widget_bool import CheckboxWidget, ToggleButtonWidget | |
16 | from .widget_button import ButtonWidget |
|
16 | from .widget_button import ButtonWidget | |
17 | from .widget_container import ContainerWidget, PopupWidget |
|
17 | from .widget_container import ContainerWidget, HBox, VBox, PopupWidget | |
18 | from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget |
|
18 | from .widget_float import FloatTextWidget, BoundedFloatTextWidget, FloatSliderWidget, FloatProgressWidget | |
19 | from .widget_image import ImageWidget |
|
19 | from .widget_image import ImageWidget | |
20 | from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, IntProgressWidget |
|
20 | from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, IntProgressWidget |
@@ -37,6 +37,7 b' class Popup(Container):' | |||||
37 |
|
37 | |||
38 | class FlexContainer(Container): |
|
38 | class FlexContainer(Container): | |
39 | _view_name = Unicode('FlexContainerView', sync=True) |
|
39 | _view_name = Unicode('FlexContainerView', sync=True) | |
|
40 | orientation = Unicode('vertical', sync=True) | |||
40 | flex = Int(0, sync=True, help="""Specify the flexible-ness of the model.""") |
|
41 | flex = Int(0, sync=True, help="""Specify the flexible-ness of the model.""") | |
41 | def _flex_changed(self, name, old, new): |
|
42 | def _flex_changed(self, name, old, new): | |
42 | new = min(max(0, new), 2) |
|
43 | new = min(max(0, new), 2) |
General Comments 0
You need to be logged in to leave comments.
Login now