示例#1
0
    def __init__(self, childproperties, defaults, config,
                 colorscheme_path=None):

        properties = {
            'colorscheme':            (StringProperty,  {}),
            'fillColor':              (ColorProperty,   {}),
            'strokeColor':            (ColorProperty,   {}),
            'connectionColor':        (ColorProperty,   {}),
            'fontColor':              (ColorProperty,   {}),
            'fontColorAuto':          (BooleanProperty, {}),
            'fontColorAutoDark':      (ColorProperty,   {}),
            'fontColorAutoLight':     (ColorProperty,   {}),
            'fontColorAutoThreshold': (NumberProperty,  {'min': 0.0})
        }

        colorscheme_properties = {
            'backgroundColor': (ColorProperty, {}),
            'rootColor':       (ColorProperty, {}),
            'nodeColors':      (ArrayProperty, {'type': ColorProperty})
        }
        properties.update(childproperties)
        self._props = Properties(properties, self._defaults_path(defaults),
                                 config)

        E = self._eval_func()
        if not colorscheme_path:
            colorscheme_path = E('colorscheme')

        colorscheme = loadconfig(colors_path(colorscheme_path), flat=True)

        self._colorscheme_props = Properties(colorscheme_properties,
                                             'colorizer/colorscheme',
                                             colorscheme)
示例#2
0
def _buildtree(data_fname, config_fname, colorscheme):
    data = loadjson(data_fname)
    config = loadconfig(config_path(config_fname))
    return twyg.buildtree(data, config, colorscheme)