/
ace.py
65 lines (48 loc) · 1.72 KB
/
ace.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Defines custom AcePlot bokeh model to render Ace editor.
"""
from bokeh.core.properties import String, Override, Dict, Any, List, Bool, Enum, Nullable
from bokeh.models import HTMLBox
from ..io.resources import bundled_files
from ..util import classproperty
from .enums import ace_themes
class AcePlot(HTMLBox):
"""
A Bokeh model that wraps around a Ace editor and renders it inside
a Bokeh plot.
"""
__javascript_raw__ = [
'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ace.js',
'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ext-language_tools.js',
'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ext-modelist.js'
]
__tarball__ = {
'tar': 'https://registry.npmjs.org/ace-builds/-/ace-builds-1.4.11.tgz',
'src': 'package/src-min/',
'dest': 'ajax/libs/1.4.11',
'exclude': ['snippets']
}
@classproperty
def __javascript__(cls):
return bundled_files(cls)
@classproperty
def __js_skip__(cls):
return {'ace': cls.__javascript__}
__js_require__ = {
'paths': {
('ace', ('ace/ace', 'ace/ext-language_tools', 'ace/ext-modelist')): '//cdnjs.cloudflare.com/ajax/libs/ace/1.4.7'},
'exports': {'ace/ace': 'ace'},
'shim': {
'ace/ext-language_tools': { 'deps': ["ace/ace"] },
'ace/ext-modelist': { 'deps': ["ace/ace"] }
}
}
code = String()
theme = Enum(ace_themes, default='chrome')
filename = Nullable(String())
language = String()
annotations = List(Dict(String, Any), default=[])
readonly = Bool(default=False)
print_margin = Bool(default=False)
height = Override(default=300)
width = Override(default=300)