forked from geraldspreer/the-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makerEditorWxView.py
executable file
·496 lines (373 loc) · 38.9 KB
/
makerEditorWxView.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
import wx
import wx.stc
from wx.lib.anchors import LayoutAnchors
if wx.Platform == '__WXMSW__':
faces = { 'times': 'Times New Roman',
'mono' : 'Courier New',
'helv' : 'Arial',
'other': 'Comic Sans MS',
'size' : 10,
'size2': 10,
}
elif wx.Platform == '__WXMAC__':
faces = { 'times': 'Times New Roman',
'mono' : 'Monaco',
'helv' : 'Helvetica',
'other': 'Monaco',
'size' : 12,
'size2': 12,
'size3': 10,
}
else:
faces = { 'times': 'Times',
'mono' : 'Courier',
'helv' : 'Helvetica',
'other': 'Courier',
'size' : 10,
'size2': 8,
}
class editorView:
def __init__(self, parent, fileType):
self.editor = wx.stc.StyledTextCtrl(id=-1,
name='makerEditorView', parent=parent, pos=wx.Point(192, 87),
size=wx.Size(160, 120), style=wx.VSCROLL | wx.HSCROLL )
self.editor.SetAutoLayout(True)
self.editor.SetConstraints(LayoutAnchors(self.editor,
True, True, True, True))
#self.editor.SetText(self.BoilerPlate)
self.editor.SetThemeEnabled(True)
self.editor.SetStyleBits(7)
self.editor.StyleClearAll() # Reset all to be like the default
if fileType == ".py":
kw = [
#--start keywords--
'and',
'assert',
'break',
'class',
'continue',
'def',
'del',
'elif',
'else',
'except',
'exec',
'finally',
'for',
'from',
'global',
'if',
'import',
'in',
'is',
'lambda',
'not',
'or',
'pass',
'print',
'raise',
'return',
'try',
'while',
#--end keywords--
]
self.editor.SetLexer(wx.stc.STC_LEX_PYTHON)
self.editor.SetKeyWords(0, " ".join(kw))
elif fileType == ".css":
self.editor.SetLexer(wx.stc.STC_LEX_CSS)
elif fileType == ".js":
"""
The .js lexer is based on the .cpp lexer so
we are just using that one...
"""
self.editor.SetLexer(wx.stc.STC_LEX_CPP)
js_kw = ("abstract else instanceof super"
" boolean enum int switch"
" break export interface synchronized"
" byte extends let this"
" case false long throw"
" catch final native throws"
" char finally new transient"
" class float null true"
" const for package try"
" continue function private typeof"
" debugger goto protected var"
" default if public void"
" delete implements return volatile"
" do import short while"
" double in static with")
self.editor.SetKeyWords(0, js_kw)
else:
self.editor.SetLexer(wx.stc.STC_LEX_HTML)
kw = ("a abbr acronym address applet area b base basefont bdo big"
" blockquote body br button caption center cite code col colgroup dd del"
" dfn dir div dl dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6"
" head hr html i iframe img input ins isindex kbd label legend li link map"
" menu meta noframes noscript object ol optgroup option p param pre q s"
" samp script select small span strike strong style sub sup table tbody"
" td textarea tfoot th thead title tr tt u ul var xml xmlns abbr"
" accept-charset accept accesskey action align alink alt archive axis"
" background bgcolor border cellpadding cellspacing char charoff charset"
" checked cite class classid clear codebase codetype color cols colspan"
" compact content coords data datafld dataformatas datapagesize datasrc"
" datetime declare defer dir disabled enctype event face for frame"
" frameborder headers height href hreflang hspace http-equiv id ismap"
" label lang language leftmargin link longdesc marginwidth marginheight"
" maxlength media method multiple name nohref noresize noshade nowrap"
" object onblur onchange onclick ondblclick onfocus onkeydown onkeypress"
" onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup"
" onreset onselect onsubmit onunload profile prompt readonly rel rev rows"
" rowspan rules scheme scope selected shape size span src standby start"
" style summary tabindex target text title topmargin type usemap valign"
" value valuetype version vlink vspace width text password checkbox radio"
" submit reset file hidden image article aside calendar canvas card"
" command commandset datagrid datatree footer gauge header m menubar"
" menulabel nav progress section switch tabbox active command"
" contenteditable ping public !doctype")
self.editor.SetKeyWords(0, kw)
self.editor.SetLexerLanguage("hypertext")
self.applyCodeStyle(style = None)
# default word wrapping
self.editor.SetWrapMode(wx.stc.STC_WRAP_WORD)
self.editor.SetCurrentPos(0)
self.editor.SetEdgeMode(wx.stc.STC_EDGE_LINE)
self.editor.SetEdgeColumn(200)
self.editor.SetHighlightGuide(1)
# indentation
self.editor.SetIndentationGuides(False)
self.editor.SetIndent(4)
self.editor.SetCaretWidth(1)
self.editor.SetControlCharSymbol(0)
self.editor.SetCaretLineVisible(True)
self.editor.SetMarginType(0, wx.stc.STC_MARGIN_NUMBER)
# Text Margins
self.editor.SetMargins(10, 10)
self.editor.SetMarginWidth(0, 25)
self.editor.SetMarginWidth(1, 5)
self.editor.UsePopUp(0)
def applyCodeStyle(self, style = None ):
# make use style passed to it.
self.editorCodeStyle = style
if not style:
style = {'comment':{'color':'#bc9458','font-style':'italic'},
'constant.numeric':{'color':'#a5c261','font-weight':'normal'},
'constant.numeric.keyword':{'color':'#6d9cbe'},
'keyword':{'color':'#cc7833','font-strike-through':'none','font-weight':'normal'},
'keyword.control':{'color':'#cc7833'},
'keyword.type':{'color':'#cc7833'},
'language.function':{'color':'#fac56d'},
'language.operator':{'color':'#b96619'},
'language.variable':{'color':'#d0d1ff'},
'markup.comment':{'color':'#bc9458','font-style':'italic'},
'markup.constant.entity':{'color':'#6e9cbe'},
'markup.declaration':{'color':'#e8c06a'},
'markup.inline.cdata':{'color':'#e9c053'},
'markup.processing':{'color':'#68685b','font-weight':'bold'},
'markup.tag':{'color':'#e8c06a'}, #
'markup.tag.attribute.name':{'color':'#e8c06a'},
'markup.tag.attribute.value':{'color':'#a5c261','font-style':'italic'},
'meta.default':{'background-color':'#2b2b2b','color':'#e6e1dc'},
'meta.highlight.currentline':{'background-color':'#d9d9d9'},
'meta.important':{'color':'#b66418','font-style':'italic'},
'meta.invalid':{'background-color':'#990201','color':'#ffffff','font-weight':'bold'},
'meta.invisible.characters':{'color':'#404040'},
'meta.link':{'color':'#a5c261','font-style':'normal','font-underline':'none'},
'string':{'color':'#a5c261','font-style':'italic'},
'string.regex':{'color':'#99b93e'},
'string.regex.escaped':{'color':'#4b8928'},
'style.at-rule':{'color':'#b96619','font-weight':'bold'},
'style.comment':{'color':'#bc9458','font-style':'italic','font-weight':'normal'},
'style.property.name':{'color':'#6e9cbe'},
'style.value.color.rgb-value':{'color':'#6d9cbe'},
'style.value.keyword':{'color':'#a5c261'},
'style.value.numeric':{'color':'#99b62d'},
'style.value.string':{'color':'#a5c261','font-style':'italic'},
'support':{'color':'#da4939'}
}
self.editor.SetCaretLineBack(style["meta.highlight.currentline"]['background-color'])
self.editor.SetCaretForeground(style["meta.default"]['color'])
self.editor.SetCaretLineBackAlpha(10)
self.editor.SetSelBackground(True, "#b5d4ff")
self.editor.SetSelAlpha(120)
if self.editor.GetLexer() == wx.stc.STC_LEX_HTML:
# HTML Styles
# <p>[This is text]</p>
self.editor.StyleSetSpec(wx.stc.STC_H_DEFAULT, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [<p>]This is text</p>
self.editor.StyleSetSpec(wx.stc.STC_H_TAG, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# ??
self.editor.StyleSetSpec(wx.stc.STC_H_TAGUNKNOWN, "fore:" + style["meta.invalid"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# <img src="foo" [/>]
self.editor.StyleSetSpec(wx.stc.STC_H_TAGEND, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [href]
self.editor.StyleSetSpec(wx.stc.STC_H_ATTRIBUTE, "fore:" + style["markup.tag.attribute.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# ["doublestring"]
self.editor.StyleSetSpec(wx.stc.STC_H_DOUBLESTRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# ['singlestring']
self.editor.StyleSetSpec(wx.stc.STC_H_SINGLESTRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [<!-- comment -->]
self.editor.StyleSetSpec(wx.stc.STC_H_COMMENT, "fore:" + style["markup.comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
# vspace = [4]
self.editor.StyleSetSpec(wx.stc.STC_H_NUMBER, "fore:" + style["markup.tag.attribute.value"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# vspace [=] 4
self.editor.StyleSetSpec(wx.stc.STC_H_OTHER, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [&]
self.editor.StyleSetSpec(wx.stc.STC_H_ENTITY, "fore:" + style["markup.constant.entity"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [<?] xml version="1.0" encoding="ISO-8859-1" ?>
self.editor.StyleSetSpec(wx.stc.STC_H_XMLSTART, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# <?xml version="1.0" encoding="ISO-8859-1" [?>]
self.editor.StyleSetSpec(wx.stc.STC_H_XMLEND, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_VALUE, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [<?php ] [?>]
self.editor.StyleSetSpec(wx.stc.STC_H_QUESTION, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# ??
self.editor.StyleSetSpec(wx.stc.STC_H_ATTRIBUTEUNKNOWN, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_CDATA, "fore:" + style["markup.inline.cdata"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_SCRIPT, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_SGML_DEFAULT, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_SGML_ERROR, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_SGML_1ST_PARAM, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_SGML_COMMAND, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_H_SGML_COMMAND, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# <script>[ ]
self.editor.StyleSetSpec(wx.stc.STC_HJ_START, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_DEFAULT, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_WORD, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_COMMENTLINE, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_COMMENT, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_COMMENTDOC, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_SINGLESTRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_DOUBLESTRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_STRINGEOL, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_NUMBER, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_KEYWORD, "fore:" + style["keyword"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_SYMBOLS, "fore:" + style["language.operator"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_STRINGEOL, "fore:" + style["keyword"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJ_REGEX, "fore:" + style["keyword"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_DEFAULT, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_DOUBLESTRING, 'fore:' + style['string']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_KEYWORD, 'fore:' + style['keyword']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_NUMBER, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_REGEX, 'fore:' + style['string']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_SINGLESTRING, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_START, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_STRINGEOL, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_SYMBOLS, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HJA_WORD, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_CHARACTER, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_CLASSNAME, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_COMMENTLINE, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPA_DEFAULT, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_DEFNAME, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_IDENTIFIER, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_NUMBER, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_OPERATOR, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPA_START, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_STRING, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_TRIPLE, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# self.editor.StyleSetSpec(wx.stc.STC_HPA_TRIPLEDOUBLE, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPA_WORD, 'fore:' + style['keyword']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
#===============================================================================
#
#===============================================================================
self.editor.StyleSetSpec(wx.stc.STC_H_ASP, 'fore:' + style['meta.default']['color'] +',back:'+style['meta.default']['background-color']+',face:%(other)s,size:%(size)d' % faces)
# php is part of the html lexer
# {} () =
self.editor.StyleSetSpec(wx.stc.STC_HPHP_OPERATOR, "fore:" + style["language.operator"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_DEFAULT, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_COMMENT, "fore:" + style["markup.comment"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_COMMENTLINE, "fore:" + style["markup.comment"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_HSTRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_SIMPLESTRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_VARIABLE, "fore:" + style["language.variable"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_HSTRING_VARIABLE, "fore:" + style["language.variable"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_NUMBER, "fore:" + style["constant.numeric.keyword"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_HPHP_WORD, "fore:" + style["markup.tag"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
elif self.editor.GetLexer() == wx.stc.STC_LEX_CSS:
# CSS
self.editor.StyleSetSpec(wx.stc.STC_CSS_DEFAULT, "fore:" + style["markup.processing"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [img] {
self.editor.StyleSetSpec(wx.stc.STC_CSS_TAG, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# { } : ;
self.editor.StyleSetSpec(wx.stc.STC_CSS_OPERATOR, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# /* Comment */
self.editor.StyleSetSpec(wx.stc.STC_CSS_COMMENT, "fore:" + style["markup.comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
# float:[left];
self.editor.StyleSetSpec(wx.stc.STC_CSS_VALUE, "fore:" + style["style.value.numeric"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# input[ [type=checkbox] ]
self.editor.StyleSetSpec(wx.stc.STC_CSS_ATTRIBUTE, "fore:" + style["style.value.keyword"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# Strings
self.editor.StyleSetSpec(wx.stc.STC_CSS_SINGLESTRING, "fore:" + style["style.value.string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_DOUBLESTRING, "fore:" + style["style.value.string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [.class] { }
self.editor.StyleSetSpec(wx.stc.STC_CSS_CLASS, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [#id] { }
self.editor.StyleSetSpec(wx.stc.STC_CSS_ID, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# ??
self.editor.StyleSetSpec(wx.stc.STC_CSS_IDENTIFIER, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_IDENTIFIER2, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_IDENTIFIER3, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# [float]: left;
self.editor.StyleSetSpec(wx.stc.STC_CSS_UNKNOWN_IDENTIFIER, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# img[:hover]
self.editor.StyleSetSpec(wx.stc.STC_CSS_UNKNOWN_PSEUDOCLASS, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_PSEUDOCLASS, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_PSEUDOELEMENT, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# @import
self.editor.StyleSetSpec(wx.stc.STC_CSS_DIRECTIVE, "fore:" + style["style.at-rule"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
# p { color: #ff0000 ! [ important ] ; }
self.editor.StyleSetSpec(wx.stc.STC_CSS_IMPORTANT, "fore:" + style["meta.important"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_EXTENDED_IDENTIFIER, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_EXTENDED_PSEUDOCLASS, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size3)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_CSS_EXTENDED_PSEUDOELEMENT, "fore:" + style["style.property.name"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size3)d" % faces)
elif self.editor.GetLexer() == wx.stc.STC_LEX_PYTHON:
self.editor.StyleSetSpec(wx.stc.STC_P_COMMENTLINE, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_NUMBER, "fore:" + style["constant.numeric"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_STRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_STRINGEOL, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_TRIPLE, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_TRIPLEDOUBLE, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_CHARACTER, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
try:
self.editor.StyleSetSpec(wx.stc.STC_P_WORD, "fore:" + style["keyword.control"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_WORD2, "fore:" + style["keyword.control"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
except:
self.editor.StyleSetSpec(wx.stc.STC_P_WORD, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_WORD2, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_OPERATOR, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_DECORATOR, "fore:" + style["meta.important"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_DEFAULT, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_COMMENTBLOCK, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_CLASSNAME, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_DEFNAME, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_P_IDENTIFIER, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
elif self.editor.GetLexer() == wx.stc.STC_LEX_CPP:
# This is for javascript
self.editor.StyleSetSpec(wx.stc.STC_C_DEFAULT, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_COMMENTLINE, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_COMMENTLINEDOC, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_COMMENT, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_COMMENTDOC, "fore:" + style["comment"]['color'] +",back:"+style["meta.default"]['background-color']+",italic,face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_NUMBER, "fore:" + style["constant.numeric"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_STRING, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_STRINGEOL, "fore:" + style["string"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_CHARACTER, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
try:
self.editor.StyleSetSpec(wx.stc.STC_C_WORD, "fore:" + style["keyword"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_WORD2, "fore:" + style["keyword.control"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
except:
self.editor.StyleSetSpec(wx.stc.STC_C_WORD, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_WORD2, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_OPERATOR, "fore:" + style["language.operator"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_GLOBALCLASS, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
#self.editor.StyleSetSpec(wx.stc.STC_C_DEFNAME, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_IDENTIFIER, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_C_REGEX, "fore:" + style["string.regex"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
else:
pass
# hack for unidentified entities
self.editor.SetBackgroundColour(style["meta.default"]['background-color'])
# Global default styles for all languages
self.editor.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, "fore:" + style["meta.default"]['color'] +",back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size3)d" % faces)
self.editor.StyleSetSpec(wx.stc.STC_STYLE_BRACEBAD, "fore:#ff0000,back:"+style["meta.default"]['background-color']+",face:%(other)s,size:%(size3)d" % faces)