コード例 #1
0
def list_param_to_ppt(p, kwargs):
    if isinstance(p.item_type, type) and issubclass(p.item_type,
                                                    pm.Parameterized):
        return bp.List(bp.Instance(DataModel)), [
            (ParameterizedList,
             lambda ps: [create_linked_datamodel(p) for p in ps])
        ]
    return bp.List(bp.Any, **kwargs)
コード例 #2
0
class DpxToolbar(Widget):
    "Toolbar model"
    __css__ = route("view.css", "icons.css", "toolbar.css")
    __implementation__ = 'toolbar.ts'
    __javascript__ = route()
    frozen = props.Bool(True)
    open = props.Int(0)
    save = props.Int(0)
    doc = props.Int(0)
    quit = props.Int(0)
    bead = props.Int(-1)
    discarded = props.String('')
    accepted = props.String('')
    currentbead = props.Bool(True)
    currentfile = props.Int(-1)
    delfile = props.Int(-1)
    filelist = props.List(props.String)
    seltype = props.Bool(True)
    message = props.String('')
    helpmessage = props.String('')
    hasquit = props.Bool(False)
    hasdoc = props.Bool(False)

    def __init__(self, **kwa):
        super().__init__(name='Main:toolbar', **kwa)
コード例 #3
0
class ReactiveHTML(HTMLBox):

    attrs = bp.Dict(
        bp.String, bp.List(bp.Tuple(bp.String, bp.List(bp.String), bp.String)))

    callbacks = bp.Dict(bp.String, bp.List(bp.Tuple(bp.String, bp.String)))

    children = bp.Dict(bp.String,
                       bp.List(bp.Either(bp.Instance(LayoutDOM), bp.String)))

    data = bp.Instance(DataModel)

    events = bp.Dict(bp.String, bp.Dict(bp.String, bp.Bool))

    html = bp.String()

    looped = bp.List(bp.String)

    nodes = bp.List(bp.String)

    scripts = bp.Dict(bp.String, bp.List(bp.String))

    def __init__(self, **props):
        if 'attrs' not in props and 'html' in props:
            props['attrs'] = find_attrs(props['html'])
        super().__init__(**props)
コード例 #4
0
ファイル: links.py プロジェクト: nghenzi/panel
    lambda p, kwargs: bp.Color(**kwargs),
    pm.DataFrame:
    lambda p, kwargs: (bp.ColumnData(bp.Any, bp.Seq(bp.Any), **kwargs), [(
        bp.PandasDataFrame, lambda x: ColumnDataSource._data_from_df(x))]),
    pm.DateRange:
    lambda p, kwargs: bp.Tuple(bp.Datetime, bp.Datetime, **kwargs),
    pm.Date:
    lambda p, kwargs: bp.Datetime(**kwargs),
    pm.Dict:
    lambda p, kwargs: bp.Dict(bp.String, bp.Any, **kwargs),
    pm.Event:
    lambda p, kwargs: bp.Bool(**kwargs),
    pm.Integer:
    lambda p, kwargs: bp.Int(**kwargs),
    pm.List:
    lambda p, kwargs: bp.List(bp.Any, **kwargs),
    pm.Number:
    lambda p, kwargs: bp.Float(**kwargs),
    pm.NumericTuple:
    lambda p, kwargs: bp.Tuple(*(bp.Float for p in p.length), **kwargs),
    pm.Range:
    lambda p, kwargs: bp.Tuple(bp.Float, bp.Float, **kwargs),
    pm.String:
    lambda p, kwargs: bp.String(**kwargs),
    pm.Tuple:
    lambda p, kwargs: bp.Tuple(*(bp.Any for p in p.length), **kwargs),
}


def construct_data_model(parameterized, name=None, ignore=[], types={}):
    """