Hi Phyo,

Thanks a lot for your work on this and sorry for my late response. I think it's quite nice to have the same theme on both the Editor and the IPython console. I'll try to look at it as soon as possible to help you applying the schemes on the fly.

Cheers,
Carlos

El 17/10/13 11:25, Phyo Arkar Lwin escribió:
Hello Spyderlib devs,

Here is my current work on adaptable ipython schema. Currently it is trying to mimic ipython's background scheme + syntax higlighting to that of Editor's schema .

It works for background and it should work if i know how to apply the sytle sheep without registering at pygments (as it need to do dynamically and not intrusively place inside pyflake folder). Attached is the current patch , with working background,foreground,highlight schema .

I need your help how to apply syntax schema , it looks like this :


    from pygments.style import Style
    from pygments.token import Keyword, Name, Comment, String, Error,
    Text, \
         Number, Operator, Generic, Whitespace, Punctuation, Other,
    Literal
    from spyderlib.config import CONF
    from pygments.formatters import html
    section = "color_schemes"
    name = CONF.get("editor", "color_scheme_name")
    print "Color scheme name :",name
    bg = CONF.get(section,"%s/%s" % (name, "background"))
    fg = CONF.get(section,"%s/%s" % (name, "normal"))[0]
    hl = CONF.get(section,"%s/%s" % (name, "currentline"))
    built_in = CONF.get(section,"%s/%s" % (name, "builtin"))[0]
    funcs = CONF.get(section,"%s/%s" % (name, "definition"))[0]
    comm = CONF.get(section,"%s/%s" % (name, "comment"))[0]
    strs = CONF.get(section,"%s/%s" % (name, "string"))[0]
    num = CONF.get(section,"%s/%s" % (name, "number"))[0]
    kw = CONF.get(section,"%s/%s" % (name, "keyword"))[0]
    instance = CONF.get(section,"%s/%s" % (name, "instance"))[0]
    op = CONF.get(section,"%s/%s" % (name, "matched_p"))
    err = CONF.get(section,"%s/%s" % (name, "unmatched_p"))

    custom_style_sheet = default_custom_template%dict(
                    bgcolor=bg, fgcolor=fg, select=hl)
    class SpyderStyle(Style):
        """
        This style mimics the Monokai color scheme.
        """
        background_color = bg
        highlight_color = hl
        styles = {
            # No corresponding class for the following:
            Text:                      fg, # class:  ''
            Whitespace:                "",        # class: 'w'
            Error:                     "#960050 bg:#1e0010", # class:
    'err'
            Other:                     "",        # class 'x'
            Comment:                   comm, # class: 'c'
            Comment.Multiline:         "",        # class: 'cm'
            Comment.Preproc:           "",        # class: 'cp'
            Comment.Single:            "",        # class: 'c1'
            Comment.Special:           "",        # class: 'cs'
            Keyword:                   kw, # class: 'k'
            Keyword.Constant:          "",        # class: 'kc'
            Keyword.Declaration:       "",        # class: 'kd'
            Keyword.Namespace:         kw, # class: 'kn'
            Keyword.Pseudo:            "",        # class: 'kp'
            Keyword.Reserved:          "",        # class: 'kr'
            Keyword.Type:              "",        # class: 'kt'
            Operator:                  fg, # class: 'o'
            Operator.Word:             "",        # class: 'ow' - like
    keywords
            Punctuation:               instance, # class: 'p'
            Name:                      fg, # class: 'n'
            Name.Attribute:            funcs, # class: 'na' - to be
    revised
           #--------snipped due to gmail's char limit-------------
        }



I tried to apply SpyderStyle instances directly into ipython style but it can't work. Inspection of RichIptyhonWidget do not allow such.

Any idea how to apply it? just 1 inch away to get it done.

Thanks.

Phyo.
--
You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to