コード例 #1
0
 def setDefaultStyles(self):
     config = configuration.getStyleConfigPath()
     # KEA 2002-05-28
     # STCStyleEditor doesn't work yet on OS X
     if config is not None:
         STCStyleEditor.initSTC(self.components.document, config, 'python')
         if self.application.shell is not None:
             STCStyleEditor.initSTC(self.application.shell, config,
                                    'python')
コード例 #2
0
 def setEditorStyle(self, ext=None):
     config = configuration.getStyleConfigPath()
     if config is not None:
         if ext is not None:
             ext = ext.lower().split('.')[-1]
         if ext in ['py', 'pyw']:
             style = 'python'
         elif ext in ['ini', 'text', 'txt']:
             style = 'text'
         elif ext in ['htm', 'html']:
             # 'html' style appears broken, just use xml for now
             style = 'xml'
         elif ext in ['rdf', 'xml']:
             style = 'xml'
         else:
             style = 'text'
         STCStyleEditor.initSTC(self, config, style)
コード例 #3
0
    def _setStyles(self, faces):
        """Configure font size, typeface and color for lexer."""

        # Default style
        self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
                          "face:%(mono)s,size:%(size)d" % faces)

        self.StyleClearAll()

        # Built in styles
        self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,
                          "back:#C0C0C0,face:%(mono)s,size:%(lnsize)d" % faces)
        self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s" % faces)
        self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,
                          "fore:#0000FF,back:#FFFF88")
        self.StyleSetSpec(stc.STC_STYLE_BRACEBAD, "fore:#FF0000,back:#FFFF88")

        # Python styles
        self.StyleSetSpec(stc.STC_P_DEFAULT, "face:%(mono)s" % faces)
        self.StyleSetSpec(stc.STC_P_COMMENTLINE,
                          "fore:#007F00,face:%(mono)s" % faces)
        self.StyleSetSpec(stc.STC_P_NUMBER, "")
        self.StyleSetSpec(stc.STC_P_STRING,
                          "fore:#7F007F,face:%(mono)s" % faces)
        self.StyleSetSpec(stc.STC_P_CHARACTER,
                          "fore:#7F007F,face:%(mono)s" % faces)
        self.StyleSetSpec(stc.STC_P_WORD, "fore:#00007F,bold")
        self.StyleSetSpec(stc.STC_P_TRIPLE, "fore:#7F0000")
        self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, "fore:#000033,back:#FFFFE8")
        self.StyleSetSpec(stc.STC_P_CLASSNAME, "fore:#0000FF,bold")
        self.StyleSetSpec(stc.STC_P_DEFNAME, "fore:#007F7F,bold")
        self.StyleSetSpec(stc.STC_P_OPERATOR, "")
        self.StyleSetSpec(stc.STC_P_IDENTIFIER, "")
        self.StyleSetSpec(stc.STC_P_COMMENTBLOCK, "fore:#7F7F7F")
        self.StyleSetSpec(
            stc.STC_P_STRINGEOL,
            "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces)

        configfile = configuration.getStyleConfigPath()
        if os.path.exists(configfile):
            STCStyleEditor.initSTC(self, configfile, 'python')
コード例 #4
0
    def on_doSetStyles_command(self, event):
        config = configuration.getStyleConfigPath()
        if config is None:
            return

        cwd = os.curdir
        os.chdir(os.path.dirname(config))
        dlg = STCStyleEditor.STCStyleEditDlg(
            self,
            'Python',
            'python',
            #'HTML', 'html',
            #'XML', 'xml',
            #'C++', 'cpp',
            #'Text', 'text',
            #'Properties', 'prop',
            config)
        try:
            dlg.ShowModal()
        finally:
            dlg.Destroy()
        os.chdir(cwd)
        self.setDefaultStyles()
コード例 #5
0
    KEA, modified for PythonCard to use wxSTC styles 2002-06-28
    
__version__ = "$Revision: 1.7 $"
__date__ = "$Date: 2004/04/25 15:23:45 $"

"""

# Imports
import cgi, sys, cStringIO
import keyword, token, tokenize

import os
from PythonCard import configuration, STCStyleEditor

cfg = STCStyleEditor.initFromConfig(configuration.getStyleConfigPath(),
                                    'python')
# cfg is a big tuple
styles = cfg[3]
styleDict = {}

# build style dict based on given styles
for numStyle in styles:
    num, style = STCStyleEditor.parsePropLine(numStyle)
    attributes = style.split(',')
    for a in attributes:
        if a.startswith('fore:'):
            foreColor = a[a.find(':') + 1:]
            styleDict[num] = foreColor
        else:
            if num not in styleDict: