<s> """<STR_LIT>""" <EOL> from envisage . developer . api import CodeBrowser , Module <EOL> from traits . api import Event , HasTraits , Instance , Str <EOL> class Charm ( HasTraits ) : <EOL> """<STR_LIT>""" <EOL> code_browser = Instance ( CodeBrowser ) <EOL> filename = Str ( '<STR_LIT>' ) <EOL> module = Instance ( Module ) <EOL> parsing_module = Event <EOL> parsed_module = Event <EOL> def _code_browser_default ( self ) : <EOL> """<STR_LIT>""" <EOL> code_browser = CodeBrowser ( filename = self . filename ) <EOL> self . _setup_code_browser ( code_browser ) <EOL> return code_browser <EOL> def load ( self ) : <EOL> """<STR_LIT>""" <EOL> self . code_browser . load ( ) <EOL> return <EOL> def save ( self ) : <EOL> """<STR_LIT>""" <EOL> self . code_browser . save ( ) <EOL> return <EOL> def _setup_code_browser ( self , code_browser ) : <EOL> """<STR_LIT>""" <EOL> code_browser . on_trait_change ( self . _on_parsing_module , '<STR_LIT>' ) <EOL> code_browser . on_trait_change ( self . _on_parsed_module , '<STR_LIT>' ) <EOL> return <EOL> def _tear_down_code_browser ( self , code_browser ) : <EOL> """<STR_LIT>""" <EOL> code_browser . on_trait_change ( <EOL> self . _on_parsing_module , '<STR_LIT>' , remove = True <EOL> ) <EOL> code_browser . on_trait_change ( <EOL> self . _on_parsed_module , '<STR_LIT>' , remove = True <EOL> ) <EOL> return <EOL> def _code_browser_changed ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if old is not None : <EOL> self . _tear_down_code_browser ( old ) <EOL> if new is not None : <EOL> self . _setup_code_browser ( new ) <EOL> return <EOL> def _filename_changed ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> self . code_browser . filename = new <EOL> return <EOL> def _on_parsing_module ( self , event ) : <EOL> """<STR_LIT>""" <EOL> self . parsing_module = event <EOL> return <EOL> def _on_parsed_module ( self , event ) : <EOL> """<STR_LIT>""" <EOL> self . parsed_module = event <EOL> return </s>
