enthought/enaml — pull request #111 by rkern (2012-03-20 14:39:09+00:00)
Title: Toggle constraints dynamically

I added a `.when()` method for the layout helpers. It will make a copy of the helper object and set the `.is_active` attribute to whatever bool you have given it. The helper will only generate constraints when `.is_active` is True. This is useful in several contexts when you want to enable/disable certain constraints based on certain conditions. For example, #97 can be worked around by using `align(...).when(bottom_box.visible)`. It's not an ideal solution for #97 since the layout system should ideally determine that one of the alignment components won't be visible without any extra help, but there are going to be other cases where the toggling condition isn't as clear cut.