Macro Editor syntax highlighting issue

edited September 2023 in KLayout Support

Recently i tried to apply dark theme and monokai scheme syntax hightlight to my macro editor,

but I found some of the syntax color format is not showing up correctly when app restarts.

In my case, the Class name of python codes showed as orange when starts,

which is different from my setting green-ish color as image show below.


the syntax color setting for python "Class"

this becomes normal if i alter any syntax color from the settimg and save the change

eventhough I didn't change the 'Class' color the format for the Class now becomes normal

Following phenomena is what I have discovered:
1. This happends every time the macro tab is being closed, when it being opened again it showed up with a wrong formating.
2. When appling a syntax color change, color highlighting becomes normal on all active tabs.
3. New opened tabs still remain haveing the issue.
4. Only apply syntax change takes effect, change font, size or weight does nothing.

the setup file I 'm using is as below

import pya

app  = pya.Application.instance()
font = app.font
font.setStyleStrategy(pya.QFont.PreferAntialias)
app.setFont(font)
app.setStyleSheet("""
    QTabWidget QPlainTextEdit  {
        background-color : #282923;
}""")

monokai = '''
    basic:
        'Alert'=(color:'#ff80ac',background:'#3b3b32'), 
        'Attribute'=(bold:false,color:'#0095ff'), 
        'Base-N Integer'=(bold:false,color:'#ac80ff'), 
        'Built-in'=(bold:false,color:'#67d8ef'), 
        'Character'=(bold:false,color:'#f92572'), 
        'Comment'=(italic:true,bold:false,color:'#74705c'), 
        'Control Flow'=(bold:false,color:'#f92572'), 
        'Data Type'=(bold:false,color:'#ac80ff'), 
        'Decimal/Value'=(bold:false,color:'#ac80ff'), 
        'Error'=(bold:false,color:'#bf0303'), 
        'Extension'=(bold:false,color:'#0000ff'), 
        'Floating Point'=(bold:false,color:'#ac80ff'), 
        'Function'=(bold:false,color:'#67d8ef'), 
        'Import'=(bold:false,color:'#f92572'), 
        'Keyword'=(bold:false,color:'#f92572'), 
        'Normal'=(bold:false,color:'#f8f8df'), 
        'Operator'=(bold:false,color:'#f92572'), 
        'Others'=(bold:false,color:'#a6e22c'), 
        'Preprocessor'=(bold:false,color:'#006e28'), 
        'Region Marker'=(bold:false,color:'#0057ae',background:'#e1eaf8'), 
        'Special Character'=(bold:false,color:'#3daee9'), 
        'Special String'=(bold:false,color:'#e7db74'), 
        'String'=(bold:false,color:'#e7db74'), 
        'Variable'=(bold:false,color:'#fd9620'), 
        'Verbatim String'=(bold:false,color:'#e7db74');

    ruby:
        'Access Control'=(color:'#0000ff'), 
        'Attribute Definition'=(), 
        'Bin'=(), 
        'Blockcomment'=(), 
        'Char'=(), 
        'Class Variable'=(), 
        'Command'=(color:'#aa3000'), 
        'Comment'=(), 
        'Constant'=(color:'#67d8ef'), 
        'Constant Value'=(color:'#bb1188'), 
        'Data'=(), 
        'Dec'=(), 
        'Default globals'=(bold:true,color:'#c00000'), 
        'Definition'=(bold:false,color:'#0000ff'), 
        'Delimiter'=(color:'#f92572'), 
        'Error'=(), 
        'Expression'=(), 
        'Float'=(), 
        'GDL input'=(), 
        'Global Constant'=(bold:false,color:'#f8f8fd'), 
        'Global Variable'=(color:'#c00000'), 
        'Here Document'=(), 
        'Hex'=(), 
        'Instance Variable'=(), 
        'Kernel methods'=(color:'#0000ff'), 
        'Keyword'=(), 
        'Member'=(color:'#ff8000'), 
        'Message'=(bold:false), 
        'Module mixin methods'=(color:'#0000ff'), 
        'Normal Text'=(), 
        'Octal'=(), 
        'Operator'=(color:'#f92572'), 
        'Pseudo variable'=(color:'#67d8ef'), 
        'RDoc Value'=(), 
        'Raw String'=(color:'#dd4a4a'), 
        'Region Marker'=(color:'#0000ff'), 
        'Regular Expression'=(color:'#4a5704'), 
        'String'=(), 
        'Substitution'=(), 
        'Symbol'=(color:'#d40000');

    python:
        'Builtin Function'=(bold:false,color:'#67d8ef'), 
        'ClassNames'=(italic:false,bold:false,color:'#a6e22c'), 
        'Comment'=(), 
        'Complex'=(), 
        'Decorator'=(), 
        'Definition Keyword'=(color:'#67d8ef'), 
        'Error'=(), 
        'Exceptions'=(), 
        'Extensions'=(), 
        'F-String'=(color:'#e7db74'), 
        'Float'=(), 
        'Flow Control Keyword'=(), 
        'Hex'=(), 
        'Import'=(), 
        'Int'=(), 
        'Normal Text'=(), 
        'Octal'=(), 
        'Operator'=(), 
        'Operator Keyword'=(), 
        'Overloaders'=(), 
        'Raw F-String'=(), 
        'Raw String'=(), 
        'Special Variable'=(bold:false,color:'#fd9620'), 
        'String'=(bold:false,color:'#e7db74'), 
        'String Char'=(), 
        'String Substitution'=();
'''
app.set_config("macro-editor-styles", monokai)
app.set_config("macro-editor-font-family", "Consolas")
app.set_config("macro-editor-font-size", "15")

Comments

Sign In or Register to comment.