Пример #1
0
def upload_data(contents, filename):
    """Upload Files and Regenerate the file list."""
    if contents:
        for i in range(len(filename)):
            FileUtils.upload(filename[i], contents[i])
    files = FileUtils.files('raw')
    if len(files) == 0:
        options = [{'label': 'No files uploaded yet!', 'value': 'None'}]
        return options
    else:
        options = [{'label': file, 'value': file} for file in files]
        return options
Пример #2
0
def get_options(dir: str):
    files = FileUtils.files(dir)
    if len(files) == 0:
        return [{'label': 'No files yet!', 'value': 'None'}]
    else:
        return [{'label': file, 'value': file} for file in files]
Пример #3
0
                   'lineHeight': '50px',
                   'borderWidth': '1px',
                   'borderStyle': 'dashed',
                   'borderRadius': '5px',
                   'textAlign': 'center',
                   'margin': '10px'
               },
               multiple=True),
    html.Br(),
    html.Div([
        html.H2("Select a file from all the uploaded files:"),
        dcc.Dropdown(id='selected-file',
                     options=[{
                         'label': file,
                         'value': file
                     } for file in FileUtils.files('raw')],
                     value=None,
                     multi=False),
        html.Br(),
    ],
             style={
                 'margin': '10px',
                 'width': '50%'
             }),
    html.Div([], id="display-file"),
    html.Div([], id="file-properties"),
    html.Div([], id="file-separator-do-nothing"),
    html.Div([], id="file-header-do-nothing")
])

Пример #4
0
            'width': '50%',
            'height': '50px',
            'lineHeight': '50px',
            'borderWidth': '1px',
            'borderStyle': 'dashed',
            'borderRadius': '5px',
            'textAlign': 'center',
            'margin': '10px'
        },
        multiple=True),
        html.Br(),
        html.Div([
            html.H2("Select a file from all the uploaded files:"),
            dcc.Dropdown(
                id = 'selected-file',
                options=[{'label':file, 'value':file} for file in FileUtils.files('raw')],
                value=None,
                multi=False
            ),
            html.Br(),
        ],
        style = {'margin': '10px', 'width': '50%'}),
        html.Div([], id = "display-file"),
        html.Div([], id = "file-properties"),
        html.Div([], id = "file-separator-do-nothing"),
        html.Div([], id = "file-header-do-nothing")
])

@app.callback(
    Output("selected-file", "options"),
    [Input('upload-data', 'contents'),