Commit 06e7ecd4 authored by Martin Schorb's avatar Martin Schorb
Browse files

filebrowse integration

parent 430a1974
Pipeline #23910 failed with stage
in 33 seconds
......@@ -22,13 +22,21 @@ show_hidden = False
@app.callback(Output({'component': 'path_input', 'module': MATCH},'value'),
Input({'component': 'path_store', 'module': MATCH},'data')
[Input({'component': 'path_store', 'module': MATCH},'data'),
Input({'component': 'path_ext', 'module': MATCH},'data')]
)
def update_store(inpath):
if os.path.exists(str(inpath)):
path = inpath
def update_store(inpath,extpath):
trigger=hf.trigger()
print('pathstore -- ')
print(trigger)
if trigger=='path_store':
if os.path.exists(str(inpath)):
path = inpath
else:
path = startpath
else:
path = startpath
print(extpath)
path=extpath
return path
......@@ -40,9 +48,9 @@ def update_store(inpath):
[State({'component': 'path_input', 'module': MATCH},'value'),
State({'component': 'path_store', 'module': MATCH},'data')]
)
def update_owner_dd(filesel,intrig,inpath,path):
def update_path_dd(filesel,intrig,inpath,path):
if dash.callback_context.triggered:
trigger = hf.trigger_component()
trigger = hf.trigger()
else:
trigger='-'
......
......@@ -26,7 +26,7 @@ import params
from utils import pages,launch_jobs
from utils import helper_functions as hf
from callbacks import substack_sel
from callbacks import substack_sel, filebrowse
......@@ -68,7 +68,7 @@ page.append(compute_settings)
@app.callback(Output({'component':'store_compset','module':label},'data'),
[Input({'component': 'input_'+col, 'module': label},'value') for col in compute_table_cols],
prevent_initial_call=True)
def mipmaps_store_compute_settings(*inputs):
def n5export_store_compute_settings(*inputs):
storage=dict()
......@@ -96,9 +96,10 @@ for dim in ['X','Y','Z']:
stackinput = [Input({'component': 'stack_dd', 'module': parent},'value')]
stackinput.extend(bbox0)
stackinput.append(Input({'component': "path_input", 'module': label},'n_blur'))
stackoutput = [Output({'component': 'input1', 'module': label},'value'),
stackoutput = [Output({'component': 'path_ext', 'module': label},'data'),
# Output({'component': 'store_stackparams', 'module': module}, 'data')
]
tablefields = [Output({'component': 't_'+col, 'module': label},'children') for col in status_table_cols]
......@@ -113,11 +114,14 @@ stackoutput.extend(compute_tablefields)
[State({'component': 'store_owner', 'module': parent}, 'data'),
State({'component': 'store_project', 'module': parent}, 'data'),
State({'component': 'store_stack', 'module': parent}, 'data'),
State({'component': 'store_allstacks', 'module': parent}, 'data')]
State({'component': 'store_allstacks', 'module': parent}, 'data'),
State({'component': "path_input", 'module': label},'value')]
)
def n5export_stacktodir(stack_sel,
xmin,xmax,ymin,ymax,zmin,zmax,
owner,project,stack,allstacks):
browsetrig,
owner,project,stack,allstacks,
browsedir):
dir_out=''
out=dict()
......@@ -153,14 +157,28 @@ def n5export_stacktodir(stack_sel,
timelim = np.ceil(out['gigapixels'] / n_cpu * params.export['min/GPix/CPU_N5']*(1+params.time_add_buffer))
ct_fields = [n_cpu,timelim]
trigger = hf.trigger()
print(trigger)
if trigger == 'path_input':
dir_out = browsedir
print(dir_out)
outlist=[dir_out] #,out]
outlist.extend(t_fields)
outlist.extend(ct_fields)
return outlist
# @app.callback(Output({'component': 'input1', 'module': label},'value'),
# Input({'component': 'path_input', 'module': label},'value'))
# def input2browsestate(inpath):
# print(inpath)
# return inpath
# =============================================
......@@ -168,13 +186,18 @@ def n5export_stacktodir(stack_sel,
page2 = html.Div(id={'component': 'page2', 'module': label},children=[html.H4('Output path'),
dcc.Input(id={'component': "input1", 'module': label}, type="text",debounce=True,persistence=True,className='dir_textinput'),
html.Button('Browse',id={'component': "browse1", 'module': label}),
'graphical browsing works on cluster login node ONLY!',
html.Br()])
dcc.Input(id={'component': "path_input", 'module': label}, type="text",debounce=True,persistence=True,className='dir_textinput'),
# dcc.Input(id={'component': "path_input", 'module': label}, type="text",style={'display': 'none'})
# html.Button('Browse',id={'component': "browse1", 'module': label}),
# 'graphical browsing works on cluster login node ONLY!',
# html.Br()
])
page.append(page2)
pathbrowse = pages.path_browse(label)
page.append(pathbrowse)
......@@ -222,7 +245,7 @@ states.append(State({'component':'sliceim_section_in_0','module': parent},'value
Output({'component': 'store_r_launch', 'module': parent},'data'),
Output({'component': 'store_render_launch', 'module': parent},'data')],
[Input({'component': 'go', 'module': label}, 'n_clicks'),
Input({'component': "input1", 'module': label},'value'),
Input({'component': "path_input", 'module': label},'value'),
Input({'component':'stack_dd','module' : parent},'value'),
Input({'component': 'input_Num_CPUs', 'module': label},'value'),
Input({'component': 'input_runtime_minutes', 'module': label},'value')],
......
......@@ -61,32 +61,32 @@ page = [directory_sel,pathbrowse]
@app.callback([Output(label+'input1', 'value'),
Output(label+'warning-popup','children')],
[Input(label+'browse1', 'n_clicks'),
Input(label+'danger-novaliddir','submit_n_clicks'),
Input(label+'danger-novaliddir','cancel_n_clicks')])
def sbem_conv_convert_filebrowse1(browse_click,popupclick1,popupclick2):
ctx = dash.callback_context
trigger = ctx.triggered[0]['prop_id'].split('.')[0].partition(label)[2]
outpage=''
conv_inputdir = ''
# @app.callback([Output({'component': 'path_input', 'module': label}, 'value'),
# Output(label+'warning-popup','children')],
# [Input(label+'browse1', 'n_clicks'),
# Input(label+'danger-novaliddir','submit_n_clicks'),
# Input(label+'danger-novaliddir','cancel_n_clicks')])
# def sbem_conv_convert_filebrowse1(browse_click,popupclick1,popupclick2):
# ctx = dash.callback_context
# trigger = ctx.triggered[0]['prop_id'].split('.')[0].partition(label)[2]
# outpage=''
# conv_inputdir = ''
if 'browse1'in trigger:
# if 'browse1'in trigger:
if params.hostname=='login-gui02.cluster.embl.de':
root = tkinter.Tk()
root.withdraw()
conv_inputdir = filedialog.askdirectory()
root.destroy()
outpage=''
else:
outpage=dcc.ConfirmDialog(
id=label+'danger-wrong_host',displayed=True,
message='This functionality only works when accessing this page from the graphical login node.'
)
# if params.hostname=='login-gui02.cluster.embl.de':
# root = tkinter.Tk()
# root.withdraw()
# conv_inputdir = filedialog.askdirectory()
# root.destroy()
# outpage=''
# else:
# outpage=dcc.ConfirmDialog(
# id=label+'danger-wrong_host',displayed=True,
# message='This functionality only works when accessing this page from the graphical login node.'
# )
return conv_inputdir, outpage
# return conv_inputdir, outpage
......@@ -296,7 +296,7 @@ page.append(gobutton)
Output({'component': 'store_render_launch', 'module': parent},'data')
],
[Input(label+'stack_dd','value'),
Input(label+'input1','value'),
Input({'component': 'path_input', 'module': label},'value'),
Input(label+'go', 'n_clicks')
],
[State(label+'project_dd', 'value'),
......
......@@ -295,7 +295,9 @@ def path_browse(module,tf_in = None):
fbrowse = html.Details([html.Summary('Browse'),fbdd])
fbstore = dcc.Store(id={'component': 'path_store', 'module': module})
fbstore = html.Div([dcc.Store(id={'component': 'path_store', 'module': module}),
dcc.Store(id={'component': 'path_ext', 'module': module})])
return html.Div([fbrowse,fbstore])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment