<s> from atom . api import Typed <EOL> from enaml . widgets . split_item import ProxySplitItem <EOL> from . QtGui import QFrame , QSplitter , QLayout <EOL> from . q_single_widget_layout import QSingleWidgetLayout <EOL> from . qt_container import QtContainer <EOL> from . qt_widget import QtWidget <EOL> class QSplitItem ( QFrame ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , parent = None ) : <EOL> """<STR_LIT>""" <EOL> super ( QSplitItem , self ) . __init__ ( parent ) <EOL> self . _split_widget = None <EOL> self . setLayout ( QSingleWidgetLayout ( ) ) <EOL> self . layout ( ) . setSizeConstraint ( QLayout . SetMinAndMaxSize ) <EOL> def splitWidget ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _split_widget <EOL> def setSplitWidget ( self , widget ) : <EOL> """<STR_LIT>""" <EOL> self . _split_widget = widget <EOL> self . layout ( ) . setWidget ( widget ) <EOL> def stretch ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . sizePolicy ( ) . horizontalStretch ( ) <EOL> def setStretch ( self , stretch ) : <EOL> """<STR_LIT>""" <EOL> stretch = max ( <NUM_LIT:0> , stretch ) <EOL> policy = self . sizePolicy ( ) <EOL> policy . setHorizontalStretch ( stretch ) <EOL> policy . setVerticalStretch ( stretch ) <EOL> self . setSizePolicy ( policy ) <EOL> def collapsible ( self ) : <EOL> """<STR_LIT>""" <EOL> parent = self . parentWidget ( ) <EOL> if isinstance ( parent , QSplitter ) : <EOL> return parent . isCollapsible ( parent . indexOf ( self ) ) <EOL> return False <EOL> def setCollapsible ( self , collapsible ) : <EOL> """<STR_LIT>""" <EOL> parent = self . parentWidget ( ) <EOL> if isinstance ( parent , QSplitter ) : <EOL> return parent . setCollapsible ( parent . indexOf ( self ) , collapsible ) <EOL> class QtSplitItem ( QtWidget , ProxySplitItem ) : <EOL> """<STR_LIT>""" <EOL> widget = Typed ( QSplitItem ) <EOL> def create_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> self . widget = QSplitItem ( self . parent_widget ( ) ) <EOL> def init_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( QtSplitItem , self ) . init_widget ( ) <EOL> d = self . declaration <EOL> self . set_stretch ( d . stretch ) <EOL> self . set_collapsible ( d . collapsible ) <EOL> def init_layout ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( QtSplitItem , self ) . init_layout ( ) <EOL> self . widget . setSplitWidget ( self . split_widget ( ) ) <EOL> def split_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> d = self . declaration . split_widget ( ) <EOL> if d is not None : <EOL> return d . proxy . widget <EOL> def child_added ( self , child ) : <EOL> """<STR_LIT>""" <EOL> super ( QtSplitItem , self ) . child_added ( child ) <EOL> if isinstance ( child , QtContainer ) : <EOL> self . widget . setSplitWidget ( self . split_widget ( ) ) <EOL> def child_removed ( self , child ) : <EOL> """<STR_LIT>""" <EOL> super ( QtSplitItem , self ) . child_removed ( child ) <EOL> if isinstance ( child , QtContainer ) : <EOL> self . widget . setSplitWidget ( self . split_widget ( ) ) <EOL> def set_stretch ( self , stretch ) : <EOL> """<STR_LIT>""" <EOL> self . widget . setStretch ( stretch ) <EOL> def set_collapsible ( self , collapsible ) : <EOL> """<STR_LIT>""" <EOL> self . widget . setCollapsible ( collapsible ) </s>
