Пример #1
0
def add_button(name, actions=None, value=None, extraData=None):
    if value is not None:
        valueUnits = h.units(value)
        if valueUnits != '':
            name += " (" + valueUnits + ")"

    button = GeppettoJupyterGUISync.ButtonSync(widget_id=G.newId(),
                                               widget_name=name,
                                               extraData=extraData)
    if actions is not None:
        button.on_click(actions)
    return button
Пример #2
0
def add_text_field(name, value=None, read_only=False):
    parameters = {'widget_id': G.newId(), 'widget_name': name}
    parameters['read_only'] = read_only

    if value is not None:
        parameters['sync_value'] = str(eval("h." + value))
        parameters['extraData'] = {'originalValue': str(eval("h." + value))}
        parameters['value'] = value
    else:
        parameters['value'] = ''
    textfield = GeppettoJupyterGUISync.TextFieldSync(**parameters)
    if value is not None:
        textfield.on_blur(sync_value)
    return textfield
Пример #3
0
def add_panel(name,
              items=[],
              widget_id=None,
              position_x=-1,
              position_y=-1,
              width=-1,
              height=-1,
              properties={"closable": True}):
    if widget_id is None:
        widget_id = G.newId()
    for item in items:
        item.embedded = True
    return GeppettoJupyterGUISync.PanelSync(widget_id=widget_id,
                                            widget_name=name,
                                            items=items,
                                            embedded=False,
                                            position_x=position_x,
                                            position_y=position_y,
                                            width=width,
                                            height=height,
                                            properties=properties)
Пример #4
0
def add_drop_down(name, items):
    return GeppettoJupyterGUISync.DropDownSync(widget_id=G.newId(),
                                               widget_name=name,
                                               items=items)
Пример #5
0
def add_label(id, name):
    return GeppettoJupyterGUISync.LabelSync(widget_id=G.newId(),
                                            widget_name=name,
                                            sync_value=id)
Пример #6
0
def add_checkbox(name, sync_value='false', extraData=None):
    return GeppettoJupyterGUISync.CheckboxSync(widget_id=G.newId(),
                                               widget_name=name,
                                               sync_value=sync_value,
                                               extraData=extraData)