Ejemplo n.º 1
0
def build_orbital_parameter(title, css_class, start, end, step, value):
    slider = Slider(
        title=title,
        value=value,
        start=start,
        end=end,
        step=step,
        css_classes=["slider", f"{css_class}_slider"],
    )

    spinner = Spinner(
        low=start,
        high=end,
        value=value,
        step=step,
        width=80,
        css_classes=["spinner", f"{css_class}_spinner"],
    )
    spinner.js_link("value", slider, "value")
    slider.js_link("value", spinner, "value")
    layout = row(slider, spinner, css_classes=[f"{css_class}_layout"])
    return (layout, slider)
Ejemplo n.º 2
0
def get_widgets(model):
    widgets_list = []
    for p, v in model.properties_with_values().items():
        if isinstance(v, dict):
            if "value" in v:
                v = v.get("value")
            else:
                continue
        if v is None:
            continue

        kw = dict(title=prettify(p), name=prettify(p), value=v, width=360)
        if "alpha" in p:
            w = Slider(start=0, step=0.05, end=1, **kw)
        elif "color" in p:
            if v in list(NamedColor):
                w = Select(options=list(NamedColor), **kw)
            else:
                kw.pop("value")
                w = ColorPicker(color=v, **kw)
        elif p.endswith("width"):
            w = Slider(start=0, step=0.2, end=5, **kw)
        elif "marker" in p:
            w = Select(options=list(MarkerType), **kw)
        elif p == "size":
            w = Slider(start=0, step=1, end=20, **kw)
        elif p.endswith("text") or p.endswith("label"):
            w = TextInput(**kw)
        else:
            continue
        if isinstance(w, ColorPicker):
            w.js_link("color", model, p)
        else:
            w.js_link("value", model, p)
        widgets_list.append(w)
    if widgets_list:
        return Column(*sorted(widgets_list, key=lambda w: w.name), width=380)
    return None
Ejemplo n.º 3
0
    console.log(d2);
    source_sx_persistency.change.emit();
    """))



toggle_sx = Toggle(label="Persistence", button_type="success", active=True)
toggle1 = Toggle(label="Word", button_type="success", active=True)
toggle1.js_link('active', r_wcrd_2, 'visible')

toggle2 = Toggle(label="Thumbnail", button_type="success", active=True)
toggle2.js_link('active', r_tcrd_2, 'visible')

slider_alpha_Value = Slider(start=0, end=1, value=1, step=.1, title="Alpha Value")
#slider.on_change('value', slider_onchange)
slider_alpha_Value.js_link('value', image_tcrd, 'global_alpha')

silder_draw_index = Slider(start=0, end=TSET_INTERVAL_NUM-1, value=FIRST_DRAW_INDEX, step=-1, title="Draw Index", direction="rtl", sizing_mode='stretch_width')
callback = CustomJS(
        args=dict(
            source_wcrd=source_wcrd, source_wcrd_view=source_wcrd_view,
            source_tcrd=source_tcrd, source_tcrd_view=source_tcrd_view,
            source_sx=source_sx,
            source_sx_draw_highlight=source_sx_draw_highlight),
        code="""
        var d1 = source_wcrd.data;
        var d2 = source_wcrd_view.data;
        var d3 = source_tcrd.data;
        var d4 = source_tcrd_view.data;

        for (var i = 0; i < d2['url_list'].length; i++) {