<s> import uuid <EOL> from atom . api import ( <EOL> Atom , Int , Constant , Enum , Event , Typed , ForwardTyped , observe , set_default <EOL> ) <EOL> from enaml . core . declarative import d_ <EOL> from enaml . widgets . control import Control , ProxyControl <EOL> SYNTAXES = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:d>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:html>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> class ScintillaDocument ( Atom ) : <EOL> """<STR_LIT>""" <EOL> uuid = Constant ( factory = lambda : uuid . uuid4 ( ) . hex ) <EOL> class ProxyScintilla ( ProxyControl ) : <EOL> """<STR_LIT>""" <EOL> declaration = ForwardTyped ( lambda : Scintilla ) <EOL> def set_document ( self , document ) : <EOL> raise NotImplementedError <EOL> def set_syntax ( self , lexer ) : <EOL> raise NotImplementedError <EOL> def set_theme ( self , theme ) : <EOL> raise NotImplementedError <EOL> def set_settings ( self , settings ) : <EOL> raise NotImplementedError <EOL> def set_zoom ( self , zoom ) : <EOL> raise NotImplementedError <EOL> def get_text ( self ) : <EOL> raise NotImplementedError <EOL> def set_text ( self , text ) : <EOL> raise NotImplementedError <EOL> class Scintilla ( Control ) : <EOL> """<STR_LIT>""" <EOL> document = d_ ( Typed ( ScintillaDocument , ( ) ) ) <EOL> syntax = d_ ( Enum ( * SYNTAXES ) ) <EOL> theme = d_ ( Typed ( dict , ( ) ) ) <EOL> settings = d_ ( Typed ( dict , ( ) ) ) <EOL> zoom = d_ ( Int ( ) ) <EOL> text_changed = d_ ( Event ( ) , writable = False ) <EOL> hug_width = set_default ( '<STR_LIT:ignore>' ) <EOL> hug_height = set_default ( '<STR_LIT:ignore>' ) <EOL> proxy = Typed ( ProxyScintilla ) <EOL> def _post_validate_document ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> return new or ScintillaDocument ( ) <EOL> def _post_validate_theme ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> return new or { } <EOL> def _post_validate_settings ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> return new or { } <EOL> @ observe ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def _update_proxy ( self , change ) : <EOL> """<STR_LIT>""" <EOL> super ( Scintilla , self ) . _update_proxy ( change ) <EOL> def get_text ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . proxy_is_active : <EOL> return self . proxy . get_text ( ) <EOL> return u'<STR_LIT>' <EOL> def set_text ( self , text ) : <EOL> """<STR_LIT>""" <EOL> if self . proxy_is_active : <EOL> self . proxy . set_text ( text ) </s>
