<s> from atom . api import Bool , Int , Typed , observe <EOL> from enaml . core . declarative import d_ <EOL> from enaml . layout . layout_helpers import align , hbox <EOL> from enaml . layout . spacers import Spacer <EOL> from . container import Container <EOL> class HGroup ( Container ) : <EOL> """<STR_LIT>""" <EOL> spacing = d_ ( Int ( <NUM_LIT:10> ) ) <EOL> leading_spacer = d_ ( Typed ( Spacer ) ) <EOL> trailing_spacer = d_ ( Typed ( Spacer ) ) <EOL> align_widths = d_ ( Bool ( True ) ) <EOL> @ observe ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def _layout_invalidated ( self , change ) : <EOL> """<STR_LIT>""" <EOL> super ( HGroup , self ) . _layout_invalidated ( change ) <EOL> def layout_constraints ( self ) : <EOL> """<STR_LIT>""" <EOL> widgets = self . visible_widgets ( ) <EOL> items = [ self . leading_spacer ] + widgets + [ self . trailing_spacer ] <EOL> cns = self . constraints [ : ] <EOL> cns . append ( hbox ( * items , spacing = self . spacing ) ) <EOL> cns . append ( align ( '<STR_LIT>' , * widgets ) ) <EOL> if self . align_widths : <EOL> cns . append ( align ( '<STR_LIT:width>' , * widgets ) ) <EOL> return cns </s>
