예제 #1
0
파일: tables.py 프로젝트: cajal/pipecontrol
class SummaryTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal Id')
    session = flask_table.Col('Session')
    scan_idx = flask_table.Col('Scan Idx')
    field = flask_table.Col('Field')
    pipe_version = flask_table.Col('Pipe Version')

    kwargs = {
        'animal_id': 'animal_id',
        'session': 'session',
        'scan_idx': 'scan_idx',
        'field': 'field',
        'pipe_version': 'pipe_version'
    }
    correlation = flask_table.LinkCol(
        'Correlation Image',
        'main.figure',
        url_kwargs=kwargs,
        url_kwargs_extra={'which': 'correlation'})
    average = flask_table.LinkCol('Average Image',
                                  'main.figure',
                                  url_kwargs=kwargs,
                                  url_kwargs_extra={'which': 'average'})
    traces = flask_table.LinkCol('Spike Traces',
                                 'main.traces',
                                 url_kwargs=kwargs,
                                 url_kwargs_extra={
                                     'channel': 1,
                                     'segmentation_method': 6,
                                     'spike_method': 5
                                 })
예제 #2
0
class HistoryTable(flask_table.Table):
    id = flask_table.LinkCol("Round ID",
                             "lupi_ui.round_details",
                             attr_list=['id'],
                             url_kwargs=dict(round_id='id'))
    start_date = flask_table.Col("Start date")
    end_date = flask_table.Col("End date")
    players = flask_table.Col("# players")
예제 #3
0
class SeriesTable(flask_table.Table):
    classes = ["table table-striped"]
    test_name = flask_table.LinkCol("Test Name",
                                    "route_view_results_series_test",
                                    url_kwargs=dict(test_name="test_name",
                                                    series_name="series_name"),
                                    attr_list="test_name")

    is_stable = flask_table.Col("Considered Stable")
예제 #4
0
def ensure_task_table():
    if not hasattr(app, 'DBTaskTable'):

        class DBTaskTable(flask_table.Table):
            allow_sort = True

            def sort_url(self, col_key, reverse=False):
                if reverse:
                    direction = 'desc'
                else:
                    direction = 'asc'
                return flask.url_for(ut.get_funcname(index),
                                     sort=col_key,
                                     direction=direction)

        col_nice_lookup = {}
        columns = [
            'index',
            'dbname',
            ('task', task_link),
            # ('link', task_link)
        ]
        for tup in columns:
            if isinstance(tup, tuple):
                colname, link = tup
                colnice = col_nice_lookup.get(colname, colname)
                url_kwargs = {a: a for a in ut.get_func_argspec(link).args}
                endpoint = ut.get_funcname(link)
                link_kw = dict(
                    name=colnice,
                    attr=colname,
                    endpoint=endpoint,
                    url_kwargs=url_kwargs,
                    allow_sort=True,
                    show=True,
                )
                new_col = flask_table.LinkCol(**link_kw)
            elif isinstance(tup, six.string_types):
                colname = tup
                colnice = col_nice_lookup.get(colname, colname)
                new_col = flask_table.Col(name=colnice,
                                          attr=colname,
                                          allow_sort=True,
                                          show=True)
            else:
                assert False, 'unkonown tup'
            DBTaskTable.add_column(colname, new_col)
        app.DBTaskTable = DBTaskTable
    return app.DBTaskTable
예제 #5
0
파일: tables.py 프로젝트: cajal/pipecontrol
class SurgeryStatusTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal ID')
    username = flask_table.Col('Username')
    date = flask_table.DateCol('Surgery Date')
    mouse_room = flask_table.Col('Room')
    timestamp = flask_table.DatetimeCol('Timestamp')
    day_one = flask_table.BoolCol('Day 1 Check')
    day_two = flask_table.BoolCol('Day 2 Check')
    day_three = flask_table.BoolCol('Day 3 Check')
    euthanized = flask_table.BoolCol('Euthanized')
    checkup_notes = flask_table.Col('Notes')

    kwargs = {'animal_id': 'animal_id', 'surgery_id': 'surgery_id'}
    link = flask_table.LinkCol('Edit',
                               'main.surgery_update',
                               url_kwargs=kwargs)
예제 #6
0
파일: app.py 프로젝트: alanbarr/trapp
 class SeriesTable(FormattedTable):
     series_name = flask_table.LinkCol(
                     "Series",
                     "route_view_results_series_landing",
                     url_kwargs=dict(series_name="series_name"),
                     attr_list="series_name")