<s> from atom . api import Bool , Enum , List , Typed , ForwardTyped , observe <EOL> from enaml . core . declarative import d_ <EOL> from . action import Action <EOL> from . action_group import ActionGroup <EOL> from . constraints_widget import ConstraintsWidget , ProxyConstraintsWidget <EOL> class ProxyToolBar ( ProxyConstraintsWidget ) : <EOL> """<STR_LIT>""" <EOL> declaration = ForwardTyped ( lambda : ToolBar ) <EOL> def set_movable ( self , movable ) : <EOL> raise NotImplementedError <EOL> def set_floatable ( self , floatable ) : <EOL> raise NotImplementedError <EOL> def set_floating ( self , floating ) : <EOL> raise NotImplementedError <EOL> def set_dock_area ( self , area ) : <EOL> raise NotImplementedError <EOL> def set_allowed_dock_areas ( self , areas ) : <EOL> raise NotImplementedError <EOL> def set_orientation ( self , orientation ) : <EOL> raise NotImplementedError <EOL> class ToolBar ( ConstraintsWidget ) : <EOL> """<STR_LIT>""" <EOL> movable = d_ ( Bool ( True ) ) <EOL> floatable = d_ ( Bool ( True ) ) <EOL> floating = d_ ( Bool ( False ) ) <EOL> dock_area = d_ ( Enum ( '<STR_LIT>' , '<STR_LIT:right>' , '<STR_LIT:left>' , '<STR_LIT>' ) ) <EOL> allowed_dock_areas = d_ ( List ( <EOL> Enum ( '<STR_LIT>' , '<STR_LIT:right>' , '<STR_LIT:left>' , '<STR_LIT>' , '<STR_LIT:all>' ) , [ '<STR_LIT:all>' ] , <EOL> ) ) <EOL> orientation = d_ ( Enum ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> auto_hug = d_ ( Bool ( True ) ) <EOL> proxy = Typed ( ProxyToolBar ) <EOL> def items ( self ) : <EOL> """<STR_LIT>""" <EOL> allowed = ( Action , ActionGroup ) <EOL> return [ c for c in self . children if isinstance ( c , allowed ) ] <EOL> @ observe ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def _update_proxy ( self , change ) : <EOL> """<STR_LIT>""" <EOL> super ( ToolBar , self ) . _update_proxy ( change ) <EOL> def _default_hug_width ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . orientation == '<STR_LIT>' : <EOL> return '<STR_LIT:ignore>' <EOL> return '<STR_LIT>' <EOL> def _default_hug_height ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . orientation == '<STR_LIT>' : <EOL> return '<STR_LIT:ignore>' <EOL> return '<STR_LIT>' <EOL> def _post_setattr_orientation ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if self . auto_hug : <EOL> if new == '<STR_LIT>' : <EOL> self . hug_width = '<STR_LIT>' <EOL> self . hug_height = '<STR_LIT:ignore>' <EOL> else : <EOL> self . hug_width = '<STR_LIT:ignore>' <EOL> self . hug_height = '<STR_LIT>' </s>
