예제 #1
0
def make_parameter_table(p_table,
                         data,
                         headers,
                         table_width=None,
                         table_height=None):
    if (data == None or headers == None):
        print('Making default data')
        data = dict(
            col1=[i for i in range(20)],
            col2=[i * i for i in range(20)],
        )
        headers = dict(col1='Title 1', col2='Title 2')

    source = ColumnDataSource(data)

    columns = []
    for key in data:
        if (key not in headers):
            raise ValueError(f'Header dictionary does not contain: {key}')
        columns = columns + [TableColumn(field=key, title=headers[key])]
    if (p_table == None):
        if (table_width == None or table_height == None):
            p_table = DataTable(source=source,
                                columns=columns,
                                editable=False,
                                index_position=None)
        else:
            p_table = DataTable(source=source,
                                columns=columns,
                                width=table_width,
                                height=table_height,
                                editable=False,
                                index_position=None)
    else:
        p_table.source = source
        p_table.columns = columns
        p_table.editable = False
        p_table.index_position = None
        if (table_width is not None):
            p_table.width = table_width
        if (table_height is not None):
            p_table.height = table_height

    return p_table
예제 #2
0
]

data_table_column_left_letters = DataTable(
    source=graph.node_renderer.data_source,
    width=25,
    height=80,
    columns=letter_columns,
    header_row=True,
    index_position=None)
data_table_column_a = DataTable(source=graph.node_renderer.data_source,
                                width=25,
                                height=80,
                                columns=data_columns,
                                header_row=True,
                                index_position=None)
data_table_column_left_letters.height = 2000
data_table_column_a.height = 2000

# Final Layout
row_create_node = row([button_create_new_node, text_input_new_node_letter])
row_add_edge = row([button_set_new_edge, text_input_add_edge])
row_delete_edge = row([button_delete_edge, text_input_delete_edge])

row_table = row([data_table_column_left_letters, data_table_column_a])

left_column = column([div_log, output_log])
mid_column = column([
    row_create_node, row_add_edge, row_delete_edge, button_delete_node, plot,
    row_table
])
right_column = column([div_console, output_console])