<s> from atom . api import Typed <EOL> from enaml . widgets . toolkit_object import ProxyToolkitObject <EOL> from . QtCore import QObject <EOL> class QtToolkitObject ( ProxyToolkitObject ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = '<STR_LIT>' <EOL> widget = Typed ( QObject ) <EOL> def create_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> self . widget = QObject ( self . parent_widget ( ) ) <EOL> def init_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> widget = self . widget <EOL> if widget is not None : <EOL> d = self . declaration <EOL> name = d . name or u'<STR_LIT>' % id ( d ) <EOL> widget . setObjectName ( name ) <EOL> def init_layout ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def activate_top_down ( self ) : <EOL> """<STR_LIT>""" <EOL> self . create_widget ( ) <EOL> self . init_widget ( ) <EOL> def activate_bottom_up ( self ) : <EOL> """<STR_LIT>""" <EOL> self . init_layout ( ) <EOL> def destroy ( self ) : <EOL> """<STR_LIT>""" <EOL> widget = self . widget <EOL> if widget is not None : <EOL> widget . setParent ( None ) <EOL> del self . widget <EOL> super ( QtToolkitObject , self ) . destroy ( ) <EOL> def child_removed ( self , child ) : <EOL> """<STR_LIT>""" <EOL> super ( QtToolkitObject , self ) . child_removed ( child ) <EOL> if child . widget is not None : <EOL> child . widget . setParent ( None ) <EOL> def parent_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> parent = self . parent ( ) <EOL> if parent is not None : <EOL> return parent . widget <EOL> def child_widgets ( self ) : <EOL> """<STR_LIT>""" <EOL> for child in self . children ( ) : <EOL> w = child . widget <EOL> if w is not None : <EOL> yield w </s>
