Beispiel #1
0
 def test(style):
     pygments_style = get_style_by_name(style)
     pygout_style = create_style_from_pygments(style)
     # Check that all token styles are the same - at this point they haven't
     # been via TokenStyleEditor.
     compare_style_lists(style, pygments_style.list_styles(),
                         pygout_style.list_styles())
     new_pygout_style = create_style(None, pygout_style.pygout_styles)
     # Check that a style that's gone via the TokenStyleEditor conversion
     # still is the same style.
     compare_style_lists(style, pygout_style.list_styles(),
                         new_pygout_style.list_styles())
Beispiel #2
0
    def read(self, stream):
        config = self._create_configparser()
        config.read_file(stream)

        token_styles = {}
        for name, section in config.items():
            # Ignore sections that aren't going to be allowed as token names
            if name == 'IGNORED_DEFAULT' or name[0].islower():
                continue

            token = string_to_tokentype(name)
            token_styles[token] = _read_style_section(section)

        # TODO: handle background, highlight colors
        # TODO: save palette?
        # TODO: have a style name?
        return create_style(None, token_styles)