Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Schorb
VolumeAlign
Commits
bb4916a3
Commit
bb4916a3
authored
Apr 12, 2022
by
Martin Schorb
Browse files
Merge branch 'main' of
https://git.embl.de/schorb/volumealign
into main
parents
b56c2bc1
d047eef4
Pipeline
#32089
passed with stage
in 35 seconds
Changes
40
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
dashUI/callbacks/boundingbox.py
View file @
bb4916a3
...
...
@@ -6,22 +6,18 @@ Created on Mon Jan 18 14:52:17 2021
@author: schorb
"""
import
dash
# import dash_core_components as dcc
# import dash_html_components as html
from
dash.dependencies
import
Input
,
Output
,
State
,
MATCH
,
ALL
from
dash.exceptions
import
PreventUpdate
from
app
import
app
# import params
from
utils
import
helper_functions
as
hf
outs
=
list
()
for
dim
in
[
'X'
,
'Y'
,
'Z'
]:
for
dim
in
[
'X'
,
'Y'
,
'Z'
]:
@
app
.
callback
([
Output
({
'component'
:
'start'
+
dim
,
'module'
:
MATCH
},
'max'
),
Output
({
'component'
:
'end'
+
dim
,
'module'
:
MATCH
},
'min'
)],
[
Input
({
'component'
:
'start'
+
dim
,
'module'
:
MATCH
},
'value'
),
...
...
@@ -30,18 +26,20 @@ for dim in ['X','Y','Z']:
def
innerlimits
(
minval
,
maxval
):
return
maxval
,
minval
outs
.
extend
([
Output
({
'component'
:
'start'
+
dim
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'start'
+
dim
,
'module'
:
MATCH
},
'min'
),
Output
({
'component'
:
'end'
+
dim
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'end'
+
dim
,
'module'
:
MATCH
},
'max'
)])
outs
.
extend
([
Output
({
'component'
:
'start'
+
dim
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'start'
+
dim
,
'module'
:
MATCH
},
'min'
),
Output
({
'component'
:
'end'
+
dim
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'end'
+
dim
,
'module'
:
MATCH
},
'max'
)])
outs
.
append
(
Output
({
'component'
:
'sliceim_bboxparams_0'
,
'module'
:
MATCH
},
'data'
))
@
app
.
callback
(
outs
,
[
Input
({
'component'
:
'sliceim_rectsel_0'
,
'module'
:
MATCH
},
"data"
)],
State
({
'component'
:
'sliceim_params_0'
,
'module'
:
MATCH
},
'data'
)
)
def
paramstoouterlimits
(
annotations
,
imparams
):
def
paramstoouterlimits
(
annotations
,
imparams
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
out
=
list
()
...
...
@@ -51,13 +49,12 @@ def paramstoouterlimits(annotations,imparams):
minval
=
annotations
[
dim
][
0
]
maxval
=
annotations
[
dim
][
1
]
outdims
[
dim
]
=
[
minval
,
maxval
]
outdims
[
dim
]
=
[
minval
,
maxval
]
out
.
extend
([
minval
,
minval
,
maxval
,
maxval
])
out
.
extend
([
minval
,
minval
,
maxval
,
maxval
])
outdims
[
'Z'
]
=
[
imparams
[
'minZ'
],
imparams
[
'maxZ'
]]
out
.
extend
([
imparams
[
'minZ'
],
imparams
[
'minZ'
],
imparams
[
'maxZ'
],
imparams
[
'maxZ'
]])
outdims
[
'Z'
]
=
[
imparams
[
'minZ'
],
imparams
[
'maxZ'
]]
out
.
extend
([
imparams
[
'minZ'
],
imparams
[
'minZ'
],
imparams
[
'maxZ'
],
imparams
[
'maxZ'
]])
out
.
append
(
outdims
)
return
out
dashUI/callbacks/filebrowse.py
View file @
bb4916a3
...
...
@@ -16,119 +16,143 @@ from dash.exceptions import PreventUpdate
from
dash.dependencies
import
Input
,
Output
,
State
,
MATCH
,
ALL
from
utils
import
helper_functions
as
hf
startpath
=
os
.
getcwd
()
# show_files = False
show_hidden
=
False
@
app
.
callback
(
Output
({
'component'
:
'path_input'
,
'module'
:
MATCH
},
'value'
),
[
Input
({
'component'
:
'path_store'
,
'module'
:
MATCH
},
'data'
),
Input
({
'component'
:
'path_ext'
,
'module'
:
MATCH
},
'data'
)]
,
prevent_initial_call
=
True
)
def
update_store
(
inpath
,
extpath
):
trigger
=
hf
.
trigger
()
@
app
.
callback
([
Output
({
'component'
:
'path_input'
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'path_dummy'
,
'module'
:
MATCH
},
'data'
)],
[
Input
({
'component'
:
'path_store'
,
'module'
:
MATCH
},
'data'
),
Input
({
'component'
:
'path_ext'
,
'module'
:
MATCH
},
'data'
)],
State
({
'component'
:
'newdir_sel'
,
'module'
:
MATCH
},
'value'
),
prevent_initial_call
=
True
)
def
update_store
(
inpath
,
extpath
,
createdir_val
):
trigger
=
hf
.
trigger
()
createdir
=
createdir_val
==
[
'Create new directory'
]
# print('pathstore -- ')
# print(trigger)
if
trigger
==
'path_store'
:
if
os
.
path
.
exists
(
str
(
inpath
)):
outtrigger
=
dash
.
no_update
if
trigger
==
'path_store'
:
if
os
.
path
.
exists
(
str
(
inpath
))
or
createdir
:
path
=
inpath
else
:
path
=
startpath
else
:
# print(extpath)
path
=
extpath
return
path
@
app
.
callback
([
Output
({
'component'
:
'browse_dd'
,
'module'
:
MATCH
},
'options'
),
Output
({
'component'
:
'path_store'
,
'module'
:
MATCH
},
'data'
)],
[
Input
({
'component'
:
'browse_dd'
,
'module'
:
MATCH
},
'value'
),
Input
({
'component'
:
'path_input'
,
'module'
:
MATCH
},
'n_blur'
)],
[
State
({
'component'
:
'path_input'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'path_store'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'path_showfiles'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'path_filetypes'
,
'module'
:
MATCH
},
'data'
),
State
(
'url'
,
'pathname'
)]
,
prevent_initial_call
=
True
)
def
update_path_dd
(
filesel
,
intrig
,
inpath
,
path
,
show_files
,
filetypes
,
thispage
):
if
dash
.
callback_context
.
triggered
:
path
=
extpath
outtrigger
=
extpath
return
path
,
outtrigger
@
app
.
callback
([
Output
({
'component'
:
'browse_dd'
,
'module'
:
MATCH
},
'options'
),
Output
({
'component'
:
'path_store'
,
'module'
:
MATCH
},
'data'
),
Output
({
'component'
:
'browse_dd'
,
'module'
:
MATCH
},
'value'
)],
[
Input
({
'component'
:
'browse_dd'
,
'module'
:
MATCH
},
'value'
),
Input
({
'component'
:
'path_input'
,
'module'
:
MATCH
},
'n_blur'
),
Input
({
'component'
:
'path_dummy'
,
'module'
:
MATCH
},
'modified_timestamp'
)],
[
State
({
'component'
:
'path_input'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'path_store'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'path_showfiles'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'path_filetypes'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'path_dummy'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'newdir_sel'
,
'module'
:
MATCH
},
'value'
),
State
(
'url'
,
'pathname'
)],
prevent_initial_call
=
True
)
def
update_path_dd
(
filesel
,
intrig
,
trig2
,
inpath
,
path
,
show_files
,
filetypes
,
dummydata
,
createdir_val
,
thispage
):
if
dash
.
callback_context
.
triggered
:
trigger
=
hf
.
trigger
()
else
:
trigger
=
'-'
trigger
=
'-'
thispage
=
thispage
.
lstrip
(
'/'
)
createdir
=
createdir_val
==
[
'Create new directory'
]
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
if
thispage
==
''
or
thispage
not
in
hf
.
trigger
(
key
=
'module'
)
or
inpath
is
None
:
raise
PreventUpdate
if
'dummy'
in
trigger
:
path
=
dummydata
path
=
inpath
if
os
.
path
.
isdir
(
str
(
inpath
)):
inpath
=
inpath
elif
os
.
path
.
exists
(
str
(
inpath
)):
inpath
=
os
.
path
.
dirname
(
inpath
)
else
:
path
=
startpath
if
not
os
.
path
.
isdir
(
str
(
path
)):
if
os
.
path
.
isdir
(
str
(
inpath
)):
if
not
createdir
:
path
=
startpath
if
not
os
.
path
.
isdir
(
str
(
path
)):
if
os
.
path
.
isdir
(
str
(
inpath
))
or
createdir
:
path
=
inpath
else
:
path
=
startpath
if
trigger
==
'path_input'
:
if
os
.
path
.
isdir
(
str
(
inpath
)):
path
=
inpath
filesel
=
None
filesel
=
None
outselect
=
dash
.
no_update
if
filesel
==
'..'
:
outselect
=
''
if
type
(
filetypes
)
is
str
:
filetypes
=
[
filetypes
]
if
not
filetypes
==
[]:
show_files
=
True
if
not
filetypes
==
[]:
show_files
=
True
for
idx
,
filetype
in
enumerate
(
filetypes
):
for
idx
,
filetype
in
enumerate
(
filetypes
):
filetypes
[
idx
]
=
filetype
.
lower
()
if
not
filetype
.
startswith
(
os
.
path
.
extsep
):
filetypes
[
idx
]
=
os
.
path
.
extsep
+
filetypes
[
idx
]
if
filesel
is
None
or
filesel
[
0
:
2
]
==
'> '
or
filesel
==
'..'
:
if
not
filesel
is
None
:
if
filesel
[
0
:
2
]
==
'> '
:
path
=
os
.
path
.
join
(
path
,
filesel
[
2
:])
if
filesel
is
None
or
filesel
[
0
:
2
]
==
'> '
or
filesel
==
'..'
:
if
filesel
is
not
None
:
if
filesel
[
0
:
2
]
==
'> '
:
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
filesel
[
2
:]))
:
path
=
os
.
path
.
join
(
path
,
filesel
[
2
:])
elif
filesel
==
'..'
:
path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
path
,
filesel
))
path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
path
,
filesel
))
if
not
os
.
path
.
isdir
(
str
(
path
)):
files
=
[]
else
:
files
=
os
.
listdir
(
path
)
files
=
os
.
listdir
(
path
)
dd_options
=
list
(
dict
())
dd_options
.
append
({
'label'
:
'..'
,
'value'
:
'..'
})
f_list
=
list
(
dict
())
dd_options
.
append
({
'label'
:
'..'
,
'value'
:
'..'
})
f_list
=
list
(
dict
())
files
.
sort
()
for
item
in
files
:
for
item
in
files
:
# print(item)
# print(os.path.isdir(os.path.join(path,item)))
if
os
.
path
.
isdir
(
os
.
path
.
join
(
path
,
item
)):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
path
,
item
)):
if
item
.
startswith
(
'.'
)
and
show_hidden
or
not
item
.
startswith
(
'.'
):
dd_options
.
append
({
'label'
:
'
\u21AA
'
+
item
,
'value'
:
'> '
+
item
})
dd_options
.
append
({
'label'
:
'
\u21AA
'
+
item
,
'value'
:
'> '
+
item
})
else
:
if
item
.
startswith
(
'.'
)
and
show_hidden
or
not
item
.
startswith
(
'.'
):
if
not
(
len
(
filetypes
)
>
0
and
os
.
path
.
splitext
(
item
)[
1
].
lower
()
not
in
filetypes
):
f_list
.
append
({
'label'
:
item
,
'value'
:
item
})
if
not
(
len
(
filetypes
)
>
0
and
os
.
path
.
splitext
(
item
)[
1
].
lower
()
not
in
filetypes
):
f_list
.
append
({
'label'
:
item
,
'value'
:
item
})
if
show_files
:
dd_options
.
extend
(
f_list
)
return
dd_options
,
path
return
dd_options
,
path
,
outselect
else
:
path
=
os
.
path
.
join
(
path
,
filesel
)
path
=
os
.
path
.
join
(
path
,
filesel
)
return
dash
.
no_update
,
path
\ No newline at end of file
return
dash
.
no_update
,
path
,
outselect
dashUI/callbacks/match_selector.py
View file @
bb4916a3
...
...
@@ -6,7 +6,6 @@ Created on Mon Jan 18 14:52:17 2021
@author: schorb
"""
import
dash
from
dash.dependencies
import
Input
,
Output
,
State
,
MATCH
,
ALL
...
...
@@ -23,22 +22,20 @@ from utils import checks
from
utils
import
helper_functions
as
hf
# Update mc_owner dropdown:
@
app
.
callback
([
Output
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'options'
),
Output
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'value'
)
],
[
Input
({
'component'
:
'store_init_render'
,
'module'
:
MATCH
},
'data'
),
@
app
.
callback
([
Output
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'options'
),
Output
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'value'
)
],
[
Input
({
'component'
:
'store_init_render'
,
'module'
:
MATCH
},
'data'
),
Input
({
'component'
:
'mcown_input'
,
'module'
:
MATCH
},
'value'
),
Input
(
'url'
,
'pathname'
)],
State
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'options'
)
,
prevent_initial_call
=
True
)
Input
(
'url'
,
'pathname'
)],
State
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'options'
)
,
prevent_initial_call
=
True
)
def
update_mc_owner_dd
(
init_in
,
new_owner
,
thispage
,
dd_own_in
):
if
not
dash
.
callback_context
.
triggered
:
trigger
=
'init'
else
:
if
not
dash
.
callback_context
.
triggered
:
trigger
=
'init'
else
:
trigger
=
hf
.
trigger
()
if
thispage
in
(
None
,
''
):
...
...
@@ -48,56 +45,55 @@ def update_mc_owner_dd(init_in, new_owner, thispage, dd_own_in):
trigger
=
hf
.
trigger
()
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
if
thispage
not
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
dd_options
=
list
()
if
'init'
in
trigger
or
'url'
in
trigger
:
if
len
(
dd_own_in
)
>
0
:
if
dd_own_in
[
0
][
'value'
]
==
'new_mc_owner'
:
dd_options
.
extend
(
dd_own_in
)
if
len
(
dd_own_in
)
>
0
:
if
dd_own_in
[
0
][
'value'
]
==
'new_mc_owner'
:
dd_options
.
extend
(
dd_own_in
)
if
'all_mc_owners'
in
init_in
.
keys
():
dd_options
.
append
(
init_in
[
'all_mc_owners'
])
else
:
url
=
params
.
render_base_url
+
params
.
render_version
+
'matchCollectionOwners'
url
=
params
.
render_base_url
+
params
.
render_version
+
'matchCollectionOwners'
mc_owners
=
requests
.
get
(
url
).
json
()
for
item
in
mc_owners
:
dd_options
.
append
({
'label'
:
item
,
'value'
:
item
})
for
item
in
mc_owners
:
dd_options
.
append
({
'label'
:
item
,
'value'
:
item
})
if
'mc_owner'
in
init_in
.
keys
():
mc_owner
=
init_in
[
'mc_owner'
]
else
:
mc_owner
=
dd_options
[
0
][
'value'
]
elif
'input'
in
trigger
:
dd_options
=
dd_own_in
.
copy
()
new_owner
=
checks
.
clean_render_name
(
new_owner
)
dd_options
.
append
({
'label'
:
new_owner
,
'value'
:
new_owner
})
dd_options
.
append
({
'label'
:
new_owner
,
'value'
:
new_owner
})
mc_owner
=
new_owner
return
dd_options
,
mc_owner
# Update match collection dropdown
@
app
.
callback
([
Output
({
'component'
:
'new_mc_owner'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'options'
),
Output
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'matchcoll'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'store_all_matchcolls'
,
'module'
:
MATCH
},
'data'
)],
[
Input
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'value'
),
@
app
.
callback
([
Output
({
'component'
:
'new_mc_owner'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'options'
),
Output
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'matchcoll'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'store_all_matchcolls'
,
'module'
:
MATCH
},
'data'
)],
[
Input
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'value'
),
Input
({
'component'
:
'mc_input'
,
'module'
:
MATCH
},
'value'
)],
[
State
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'options'
),
State
({
'component'
:
'store_init_render'
,
'module'
:
MATCH
},
'data'
),
State
(
'url'
,
'pathname'
),
State
({
'component'
:
'mc_new_enabled'
,
'module'
:
MATCH
},
'data'
)]
,
prevent_initial_call
=
True
)
def
pointmatch_mcown_dd_sel
(
mc_own_sel
,
new_mc
,
mc_dd_opt
,
init_match
,
thispage
,
new_enabled
=
'False'
):
[
State
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'options'
),
State
({
'component'
:
'store_init_render'
,
'module'
:
MATCH
},
'data'
),
State
(
'url'
,
'pathname'
),
State
({
'component'
:
'mc_new_enabled'
,
'module'
:
MATCH
},
'data'
)]
,
prevent_initial_call
=
True
)
def
pointmatch_mcown_dd_sel
(
mc_own_sel
,
new_mc
,
mc_dd_opt
,
init_match
,
thispage
,
new_enabled
=
'False'
):
trigger
=
hf
.
trigger
()
all_mcs
=
dash
.
no_update
...
...
@@ -105,99 +101,95 @@ def pointmatch_mcown_dd_sel(mc_own_sel,new_mc,mc_dd_opt,init_match,thispage,new_
trigger
=
hf
.
trigger
()
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
if
thispage
==
''
or
thispage
not
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
if
'mc_owner_dd'
in
trigger
:
if
'mc_owner_dd'
in
trigger
:
if
mc_own_sel
==
''
:
raise
PreventUpdate
if
mc_own_sel
==
'new_mc_owner'
and
new_enabled
==
'True'
:
if
mc_own_sel
==
'new_mc_owner'
and
new_enabled
==
'True'
:
div1style
=
{}
mc_dd_opt
=
[{
'label'
:
'new Match Collection'
,
'value'
:
'new_mc'
}]
mc_dd_opt
=
[{
'label'
:
'new Match Collection'
,
'value'
:
'new_mc'
}]
mc_dd_val
=
'new_mc'
mc_style
=
{
'display'
:
'none'
}
mc_style
=
{
'display'
:
'none'
}
else
:
div1style
=
{
'display'
:
'none'
}
div1style
=
{
'display'
:
'none'
}
url
=
params
.
render_base_url
+
params
.
render_version
+
'owner/'
+
mc_own_sel
+
'/matchCollections'
mcolls
=
requests
.
get
(
url
).
json
()
all_mcs
=
list
()
all_mcs
=
list
()
# assemble dropdown
if
new_enabled
==
'True'
:
mc_dd_opt
=
[{
'label'
:
'new Match Collection'
,
'value'
:
'new_mcoll'
}]
mc_dd_opt
=
[{
'label'
:
'new Match Collection'
,
'value'
:
'new_mcoll'
}]
mc_dd_val
=
'new_mcoll'
else
:
mc_dd_opt
=
[]
mc_dd_val
=
''
init_mc
=
None
if
'matchcoll'
in
init_match
.
keys
():
init_mc
=
init_match
[
'matchcoll'
]
for
item
in
mcolls
:
for
item
in
mcolls
:
all_mcs
.
append
(
item
[
'collectionId'
][
'name'
])
mc_dd_opt
.
append
({
'label'
:
item
[
'collectionId'
][
'name'
],
'value'
:
item
[
'collectionId'
][
'name'
]})
mc_dd_opt
.
append
({
'label'
:
item
[
'collectionId'
][
'name'
],
'value'
:
item
[
'collectionId'
][
'name'
]})
if
init_mc
==
item
[
'collectionId'
][
'name'
]:
mc_dd_val
=
init_mc
mc_style
=
{
'display'
:
'flex'
}
mc_style
=
{
'display'
:
'flex'
}
elif
'mc_input'
in
trigger
:
div1style
=
{
'display'
:
'none'
}
div1style
=
{
'display'
:
'none'
}
new_mc
=
checks
.
clean_render_name
(
new_mc
)
mc_dd_opt
.
append
({
'label'
:
new_mc
,
'value'
:
new_mc
})
mc_dd_opt
.
append
({
'label'
:
new_mc
,
'value'
:
new_mc
})
mc_dd_val
=
new_mc
mc_style
=
{
'display'
:
'flex'
}
mc_style
=
{
'display'
:
'flex'
}
return
div1style
,
mc_dd_opt
,
mc_dd_val
,
mc_style
,
all_mcs
# initiate new mc input
@
app
.
callback
([
Output
({
'component'
:
'new_matchcoll'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'browse_mc_div'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'browse_mc'
,
'module'
:
MATCH
},
'href'
)],
Input
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'value'
),
[
State
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'store_owner'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'store_project'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'stack_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'store_all_matchcolls'
,
'module'
:
MATCH
},
'data'
)]
,
prevent_initial_call
=
True
)
def
new_matchcoll
(
mc_sel
,
mc_owner
,
owner
,
project
,
stack
,
all_mcs
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
@
app
.
callback
([
Output
({
'component'
:
'new_matchcoll'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'browse_mc_div'
,
'module'
:
MATCH
},
'style'
),
Output
({
'component'
:
'browse_mc'
,
'module'
:
MATCH
},
'href'
)],
Input
({
'component'
:
'matchcoll_dd'
,
'module'
:
MATCH
},
'value'
),
[
State
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'store_owner'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'store_project'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'stack_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'store_all_matchcolls'
,
'module'
:
MATCH
},
'data'
)]
,
prevent_initial_call
=
True
)
def
new_matchcoll
(
mc_sel
,
mc_owner
,
owner
,
project
,
stack
,
all_mcs
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
if
stack
is
None
:
stack
=
''
if
mc_sel
==
'new_mcoll'
:
return
{
'display'
:
'flex'
},
{
'display'
:
'none'
},
''
elif
mc_sel
in
[
None
,
'new_mc'
]:
return
{
'display'
:
'none'
},
{
'display'
:
'none'
},
''
return
{
'display'
:
'flex'
},
{
'display'
:
'none'
},
''
elif
mc_sel
in
[
None
,
'new_mc'
]:
return
{
'display'
:
'none'
},
{
'display'
:
'none'
},
''
else
:
if
mc_sel
in
all_mcs
:
mc_url
=
params
.
render_base_url
+
'view/point-match-explorer.html?'
mc_url
+=
'matchCollection='
+
mc_sel
mc_url
+=
'&matchOwner='
+
mc_owner
mc_url
+=
'&renderStack='
+
stack
mc_url
+=
'&renderStackOwner='
+
owner
mc_url
+=
'&renderStackOwner='
+
owner
mc_url
+=
'&renderStackProject='
+
project
mc_url
+=
'&startZ=50'
mc_url
+=
'&endZ=100'
return
{
'display'
:
'none'
},
{},
mc_url
else
:
return
{
'display'
:
'none'
},
{
'display'
:
'none'
},
''
return
{
'display'
:
'none'
},
{},
mc_url
else
:
return
{
'display'
:
'none'
},
{
'display'
:
'none'
},
''
dashUI/callbacks/render_selector.py
View file @
bb4916a3
...
...
@@ -6,7 +6,6 @@ Created on Mon Jan 18 14:52:17 2021
@author: schorb
"""
import
dash
from
dash.dependencies
import
Input
,
Output
,
State
,
MATCH
,
ALL
...
...
@@ -14,7 +13,6 @@ from dash.exceptions import PreventUpdate
import
requests
from
app
import
app
import
params
...
...
@@ -22,24 +20,25 @@ from utils import helper_functions as hf
new_project_style
=
{
'margin-left'
:
'2em'
}
new_stack_style
=
{
'margin-left'
:
'11em'
}
fullitem_style
=
{
'display'
:
'inline-block'
}
fullitem_style
=
{
'display'
:
'inline-block'
}
# Update init parameters from previous module