<s> from muntjac . ui . text_field import TextField <EOL> from muntjac . addon . codemirror . client . code_mode import CodeMode <EOL> from muntjac . addon . codemirror . client . code_theme import CodeTheme <EOL> class CodeMirror ( TextField ) : <EOL> """<STR_LIT>""" <EOL> CLIENT_WIDGET = None <EOL> TYPE_MAPPING = '<STR_LIT>' <EOL> def __init__ ( self , caption , codeMode = None , codeTheme = None ) : <EOL> if codeMode is None : <EOL> codeMode = CodeMode . TEXT <EOL> if codeTheme is None : <EOL> codeTheme = CodeTheme . DEFAULT <EOL> self . _codeStyle = None <EOL> self . _showLineNumbers = False <EOL> self . _codeTheme = None <EOL> super ( CodeMirror , self ) . __init__ ( caption ) <EOL> self . setCodeMode ( codeMode ) <EOL> self . setCodeTheme ( codeTheme ) <EOL> def paintContent ( self , target ) : <EOL> super ( CodeMirror , self ) . paintContent ( target ) <EOL> if self . getCodeMode ( ) is not None : <EOL> target . addAttribute ( '<STR_LIT>' , self . getCodeMode ( ) . getId ( ) ) <EOL> target . addAttribute ( '<STR_LIT>' , self . isShowLineNumbers ( ) ) <EOL> if self . getCodeTheme ( ) is not None : <EOL> target . addAttribute ( '<STR_LIT>' , self . getCodeTheme ( ) . getId ( ) ) <EOL> def setCodeMode ( self , codeMode ) : <EOL> self . _codeMode = codeMode <EOL> self . requestRepaint ( ) <EOL> def getCodeMode ( self ) : <EOL> return self . _codeMode <EOL> def setShowLineNumbers ( self , showLineNumbers ) : <EOL> self . _showLineNumbers = showLineNumbers <EOL> self . requestRepaint ( ) <EOL> def isShowLineNumbers ( self ) : <EOL> return self . _showLineNumbers <EOL> def setCodeTheme ( self , codeTheme ) : <EOL> self . _codeTheme = codeTheme <EOL> self . requestRepaint ( ) <EOL> def getCodeTheme ( self ) : <EOL> return self . _codeTheme </s>
