Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Schorb
VolumeAlign
Commits
b7496b98
Commit
b7496b98
authored
Jan 13, 2022
by
Martin Schorb
Browse files
enhance performance by skipping callbacks if page not active
parent
1f97b9e3
Changes
10
Hide whitespace changes
Inline
Side-by-side
dash/callbacks/filebrowse.py
View file @
b7496b98
...
...
@@ -11,6 +11,7 @@ import dash
from
app
import
app
from
dash.exceptions
import
PreventUpdate
from
dash.dependencies
import
Input
,
Output
,
State
,
MATCH
,
ALL
from
utils
import
helper_functions
as
hf
...
...
@@ -24,7 +25,7 @@ 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
()
# print('pathstore -- ')
...
...
@@ -48,14 +49,19 @@ def update_store(inpath,extpath):
[
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'
)]
)
def
update_path_dd
(
filesel
,
intrig
,
inpath
,
path
,
show_files
,
filetypes
):
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
:
trigger
=
hf
.
trigger
()
else
:
trigger
=
'-'
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
if
os
.
path
.
isdir
(
str
(
inpath
)):
inpath
=
inpath
...
...
dash/callbacks/match_selector.py
View file @
b7496b98
...
...
@@ -32,7 +32,8 @@ from utils import helper_functions as hf
],
[
Input
({
'component'
:
'store_init_render'
,
'module'
:
MATCH
},
'data'
),
Input
({
'component'
:
'mcown_input'
,
'module'
:
MATCH
},
'value'
)],
State
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'options'
))
State
({
'component'
:
'mc_owner_dd'
,
'module'
:
MATCH
},
'options'
)
,
prevent_initial_call
=
True
)
def
update_mc_owner_dd
(
init_in
,
new_owner
,
dd_own_in
):
if
not
dash
.
callback_context
.
triggered
:
trigger
=
'init'
...
...
@@ -83,15 +84,23 @@ def update_mc_owner_dd(init_in, new_owner, dd_own_in):
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'
)]
)
def
pointmatch_mcown_dd_sel
(
mc_own_sel
,
new_mc
,
mc_dd_opt
,
init_match
,
new_enabled
=
'False'
):
,
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
all_mcs
=
dash
.
no_update
thispage
=
thispage
.
lstrip
(
'/'
)
trigger
=
hf
.
trigger
()
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
if
'mc_owner_dd'
in
trigger
:
if
mc_own_sel
==
''
:
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
mc_own_sel
==
'new_mc_owner'
and
new_enabled
==
'True'
:
...
...
@@ -151,7 +160,8 @@ def pointmatch_mcown_dd_sel(mc_own_sel,new_mc,mc_dd_opt,init_match,new_enabled='
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'
)])
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
...
...
dash/callbacks/render_selector.py
View file @
b7496b98
...
...
@@ -31,11 +31,12 @@ def init_update_store(thismodule,prevmodule,comp_in='store_render_launch',comp_o
dash_out
=
Output
({
'component'
:
comp_out
,
'module'
:
thismodule
},
'data'
)
dash_in
=
Input
({
'component'
:
comp_in
,
'module'
:
prevmodule
},
'data'
)
dash_state
=
State
({
'component'
:
'store_init_render'
,
'module'
:
thismodule
},
'data'
)
dash_state
=
[
State
({
'component'
:
'store_init_render'
,
'module'
:
thismodule
},
'data'
),
State
(
'url'
,
'pathname'
)]
return
dash_out
,
dash_in
,
dash_state
def
update_store
(
prevstore
,
thisstore
):
def
update_store
(
prevstore
,
thisstore
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
...
...
@@ -58,21 +59,21 @@ def update_store(prevstore,thisstore):
[
Input
({
'component'
:
'store_init_render'
,
'module'
:
MATCH
},
'data'
),
Input
(
'url'
,
'pathname'
)],
State
({
'component'
:
'owner_dd'
,
'module'
:
MATCH
},
'options'
)
)
,
prevent_initial_call
=
True
)
def
update_owner_dd
(
init_in
,
thispage
,
dd_options_in
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
if
thispage
i
s
None
:
r
eturn
dash
.
no_u
pdate
if
thispage
i
n
(
None
,
''
)
:
r
aise
PreventU
pdate
thispage
=
thispage
.
lstrip
(
'/'
)
trigger
=
hf
.
trigger
()
if
t
rigger
==
'url'
and
not
hf
.
trigger
(
key
=
'module'
)
==
thispage
and
not
dd_options_in
is
None
:
r
eturn
dash
.
no_u
pdate
if
t
hispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
)
and
not
dd_options_in
is
None
:
r
aise
PreventU
pdate
dd_options
=
list
(
dict
())
...
...
@@ -114,18 +115,18 @@ def update_proj_dd(owner_sel,init_store,newproj_in,thispage,store_proj,dd_option
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
if
thispage
i
s
None
:
r
eturn
dash
.
no_u
pdate
if
thispage
i
n
(
None
,
''
)
:
r
aise
PreventU
pdate
thispage
=
thispage
.
lstrip
(
'/'
)
trigger
=
hf
.
trigger
()
if
trigger
==
'url'
and
not
hf
.
trigger
(
key
=
'module'
)
==
thispage
and
not
dd_options_in
is
None
:
r
eturn
dash
.
no_u
pdate
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
aise
PreventU
pdate
if
owner_sel
==
''
or
owner_sel
is
None
:
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
out_project
=
''
...
...
@@ -194,15 +195,15 @@ def update_stack_dd(init_store,own_sel,proj_sel,newstack_in,store_stack,dd_optio
stackdiv_style
=
fullitem_style
if
thispage
i
s
None
:
r
eturn
dash
.
no_u
pdate
if
thispage
i
n
(
None
,
''
)
:
r
aise
PreventU
pdate
thispage
=
thispage
.
lstrip
(
'/'
)
trigger
=
hf
.
trigger
()
if
t
rigger
==
'url'
and
not
hf
.
trigger
(
key
=
'module'
)
==
thispage
:
r
eturn
dash
.
no_u
pdate
if
t
hispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
aise
PreventU
pdate
if
proj_sel
is
None
or
proj_sel
==
''
:
...
...
dash/callbacks/runstate.py
View file @
b7496b98
...
...
@@ -34,7 +34,7 @@ from utils import helper_functions as hf
State
({
'component'
:
'outfile'
,
'module'
:
MATCH
},
'children'
),
State
({
'component'
:
'name'
,
'module'
:
MATCH
},
'data'
),
State
(
'url'
,
'pathname'
)]
)
,
prevent_initial_call
=
True
)
def
update_status
(
n
,
click
,
run_state
,
logfile
,
module
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
...
...
@@ -48,13 +48,10 @@ def update_status(n,click,run_state,logfile,module,thispage):
status_style
=
{
'display'
:
'none'
}
thispage
=
thispage
.
lstrip
(
'/'
)
#
# print(hf.trigger(key='module'))
# print(thispage in hf.trigger(key='module'))
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
eturn
dash
.
no_u
pdate
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
aise
PreventU
pdate
trigger
=
hf
.
trigger
()
...
...
@@ -116,17 +113,19 @@ def update_status(n,click,run_state,logfile,module,thispage):
],
Input
({
'component'
:
'store_run_status'
,
'module'
:
MATCH
},
'data'
),
[
State
({
'component'
:
'name'
,
'module'
:
MATCH
},
'data'
),
State
(
'url'
,
'pathname'
)])
State
(
'url'
,
'pathname'
)]
,
prevent_initial_call
=
True
)
def
get_status
(
run_state
,
module
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
print
(
hf
.
trigger
(
key
=
'module'
))
return
dash
.
no_update
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
print
(
'we go on!'
)
status_style
=
{
"font-family"
:
"Courier New"
,
'color'
:
'#000'
}
# procs=params.processes[module.strip('_')]
...
...
@@ -171,8 +170,8 @@ def update_output(n,outfile,thispage):
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
eturn
dash
.
no_u
pdate
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
aise
PreventU
pdate
data
=
''
...
...
@@ -201,7 +200,7 @@ def update_output(n,outfile,thispage):
Input
({
'component'
:
'store_r_status'
,
'module'
:
MATCH
},
'modified_timestamp'
)],
[
State
({
'component'
:
'store_launch_status'
,
'module'
:
MATCH
},
'data'
),
State
({
'component'
:
'store_r_status'
,
'module'
:
MATCH
},
'data'
)]
)
,
prevent_initial_call
=
True
)
def
run_state
(
launch_trigger
,
status_trigger
,
launch_in
,
status_in
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
...
...
dash/callbacks/substack_sel.py
View file @
b7496b98
...
...
@@ -15,19 +15,25 @@ from dash.exceptions import PreventUpdate
from
app
import
app
from
utils
import
helper_functions
as
hf
@
app
.
callback
(
Output
({
'component'
:
'store_stackparams'
,
'module'
:
MATCH
},
'data'
),
Input
({
'component'
:
'stack_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'store_allstacks'
,
'module'
:
MATCH
},
'data'
)
)
def
stacktoparams
(
stack_sel
,
allstacks
):
[
State
({
'component'
:
'store_allstacks'
,
'module'
:
MATCH
},
'data'
),
State
(
'url'
,
'pathname'
)]
,
prevent_initial_call
=
True
)
def
stacktoparams
(
stack_sel
,
allstacks
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
if
allstacks
in
(
None
,
''
,[]):
raise
PreventUpdate
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
thisstore
=
dict
()
if
not
(
stack_sel
==
'-'
):
...
...
@@ -36,10 +42,10 @@ def stacktoparams(stack_sel,allstacks):
stackparams
=
stacklist
[
0
]
if
'None'
in
(
stackparams
[
'stackId'
][
'owner'
],
stackparams
[
'stackId'
][
'project'
]):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
not
'stats'
in
stackparams
.
keys
():
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
thisstore
[
'stack'
]
=
stackparams
[
'stackId'
][
'stack'
]
thisstore
[
'stackparams'
]
=
stackparams
...
...
@@ -57,14 +63,20 @@ def stacktoparams(stack_sel,allstacks):
Output
({
'component'
:
'endsection'
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
'endsection'
,
'module'
:
MATCH
},
'max'
)],
Input
({
'component'
:
'store_stackparams'
,
'module'
:
MATCH
},
'data'
),
)
def
paramstosections
(
thisstore
):
State
(
'url'
,
'pathname'
)
,
prevent_initial_call
=
True
)
def
paramstosections
(
thisstore
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
if
not
'zmin'
in
thisstore
.
keys
():
return
dash
.
no_update
raise
PreventUpdate
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
sec_start
=
int
(
thisstore
[
'zmin'
])
sec_end
=
int
(
thisstore
[
'zmax'
])
...
...
@@ -78,7 +90,7 @@ def paramstosections(thisstore):
[
Input
({
'component'
:
'startsection'
,
'module'
:
MATCH
},
'value'
),
Input
({
'component'
:
'endsection'
,
'module'
:
MATCH
},
'value'
),
Input
({
'component'
:
'sec_input1'
,
'module'
:
MATCH
},
'value'
)]
)
,
prevent_initial_call
=
True
)
def
sectionlimits
(
start_sec
,
end_sec
,
sec_range
=
0
):
if
not
sec_range
is
None
and
not
start_sec
is
None
and
not
end_sec
is
None
:
...
...
dash/callbacks/tile_view.py
View file @
b7496b98
...
...
@@ -45,6 +45,8 @@ for idx in range(params.max_tileviews):
inputs
.
extend
([
Input
({
'component'
:
'dummystore'
,
'module'
:
MATCH
},
'modified_timestamp'
)]
*
2
)
states
.
extend
([
State
({
'component'
:
'dummystore'
,
'module'
:
MATCH
},
'modified_timestamp'
)]
*
2
)
states
.
append
(
State
(
'url'
,
'pathname'
))
@
app
.
callback
([
Output
({
'component'
:
imtype
+
'_section_in'
+
idx_str
,
'module'
:
MATCH
},
'value'
),
Output
({
'component'
:
imtype
+
'_section_in'
+
idx_str
,
'module'
:
MATCH
},
'min'
),
Output
({
'component'
:
imtype
+
'_section_in'
+
idx_str
,
'module'
:
MATCH
},
'max'
),
...
...
@@ -52,11 +54,18 @@ for idx in range(params.max_tileviews):
Output
({
'component'
:
imtype
+
'_contrastslider'
+
idx_str
,
'module'
:
MATCH
},
'max'
),
Output
({
'component'
:
imtype
+
'_contrastslider'
+
idx_str
,
'module'
:
MATCH
},
'value'
)],
inputs
,
states
)
def
stacktoslice
(
stack_sel
,
lead_trigger
,
tilepairdir
,
allstacks
,
owner
,
project
,
orig_sec
,
neighbours
,
lead_tile
):
states
,
prevent_initial_call
=
True
)
def
stacktoslice
(
stack_sel
,
lead_trigger
,
tilepairdir
,
allstacks
,
owner
,
project
,
orig_sec
,
neighbours
,
lead_tile
,
thispage
):
stacklist
=
[]
slicestyle
=
{}
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
print
(
hf
.
trigger
(
key
=
'module'
))
raise
PreventUpdate
trigger
=
hf
.
trigger
()
ol
=
dash
.
callback_context
.
outputs_list
...
...
@@ -71,10 +80,10 @@ for idx in range(params.max_tileviews):
stackparams
=
stacklist
[
0
]
if
'None'
in
(
stackparams
[
'stackId'
][
'owner'
],
stackparams
[
'stackId'
][
'project'
]):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
not
'stats'
in
stackparams
.
keys
():
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
o_min
=
stackparams
[
'stats'
][
'stackBounds'
][
'minZ'
]
o_max
=
stackparams
[
'stats'
][
'stackBounds'
][
'maxZ'
]
...
...
@@ -88,7 +97,7 @@ for idx in range(params.max_tileviews):
tiles
,
slices
,
positions
=
hf
.
neighbours_from_json
(
tp_jsonfiles
,
lead_tile
[
'tile'
])
if
tiles
in
(
None
,[]):
r
eturn
dash
.
no_u
pdate
if
tiles
in
(
None
,[]):
r
aise
PreventU
pdate
slices
=
list
(
map
(
int
,
slices
))
...
...
@@ -118,7 +127,7 @@ for idx in range(params.max_tileviews):
return
o_val
,
o_min
,
o_max
,
slicestyle
,
max_int
,[
0
,
max_int
]
else
:
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
...
...
@@ -134,16 +143,22 @@ for idx in range(params.max_tileviews):
State
({
'component'
:
'tile_dd'
+
idx_str
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'tp_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'neighbours'
,
'module'
:
MATCH
},
'children'
),
State
({
'component'
:
'lead_tile'
,
'module'
:
MATCH
},
'data'
)
]
)
def
slicetotiles
(
slicenum
,
owner
,
project
,
stack
,
prev_tile
,
tilepairdir
,
neighbours
,
lead_tile
):
State
({
'component'
:
'lead_tile'
,
'module'
:
MATCH
},
'data'
)
,
State
(
'url'
,
'pathname'
)
]
,
prevent_initial_call
=
True
)
def
slicetotiles
(
slicenum
,
owner
,
project
,
stack
,
prev_tile
,
tilepairdir
,
neighbours
,
lead_tile
,
thispage
):
if
None
in
(
slicenum
,
owner
,
project
,
stack
,
neighbours
,
lead_tile
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
'None'
in
(
owner
,
project
,
stack
):
return
dash
.
no_update
raise
PreventUpdate
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
trigger
=
hf
.
trigger
()
tileim_index
=
trigger
.
split
(
'_'
)[
-
1
]
...
...
@@ -156,7 +171,7 @@ for idx in range(params.max_tileviews):
tiles
=
requests
.
get
(
url
).
json
()
if
tiles
==
[]:
r
eturn
dash
.
no_update
r
aise
PreventUpdate
t_labels
=
tiles
.
copy
()
tile
=
tiles
[
int
(
len
(
tiles
)
/
2
)]
...
...
@@ -180,7 +195,7 @@ for idx in range(params.max_tileviews):
t_labels
=
tiles
.
copy
()
if
tiles
==
[]:
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
tile
=
tiles
[
-
1
]
...
...
@@ -202,7 +217,7 @@ for idx in range(params.max_tileviews):
t_labels
,
tile
=
params
.
tile_display
[
owner
](
tiles
,
prev_tile
,
slicenum
)
if
None
in
(
t_labels
,
tile
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
# assemble dropdown
dd_options
=
list
(
dict
())
...
...
@@ -225,23 +240,23 @@ for idx in range(params.max_tileviews):
State
({
'component'
:
'stack_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'tileim_section_in'
+
idx_str
,
'module'
:
MATCH
},
'value'
),
State
(
'url'
,
'pathname'
)
]
)
]
,
prevent_initial_call
=
True
)
def
im_view_url
(
tile
,
runstore
,
owner
,
project
,
stack
,
section
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
# print('tile is now: '+ tile)
# print('stack is now: '+ stack)
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
hf
.
trigger
(
key
=
'module'
)
==
thispage
:
r
eturn
dash
.
no_u
pdate
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
r
aise
PreventU
pdate
if
None
in
(
tile
,
runstore
,
owner
,
project
,
stack
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
'None'
in
(
owner
,
project
,
stack
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
url
=
params
.
render_base_url
+
params
.
render_version
+
'owner/'
+
owner
+
'/project/'
+
project
+
'/stack/'
+
stack
...
...
@@ -252,7 +267,7 @@ for idx in range(params.max_tileviews):
try
:
tilespec
=
requests
.
get
(
url1
).
json
()
except
:
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
scale
=
float
(
params
.
im_width
)
/
float
(
tilespec
[
'width'
])
...
...
@@ -276,17 +291,23 @@ for idx in range(params.max_tileviews):
# init tile image display
@
app
.
callback
(
Output
({
'component'
:
'tileim_image'
+
idx_str
,
'module'
:
MATCH
},
'src'
),
[
Input
({
'component'
:
'tileim_contrastslider'
+
idx_str
,
'module'
:
MATCH
},
'value'
),
Input
({
'component'
:
'tileim_imurl'
+
idx_str
,
'module'
:
MATCH
},
'children'
)]
Input
({
'component'
:
'tileim_imurl'
+
idx_str
,
'module'
:
MATCH
},
'children'
)],
State
(
'url'
,
'pathname'
)
)
def
im_view
(
c_limits
,
imurl
):
def
im_view
(
c_limits
,
imurl
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
if
None
in
(
c_limits
,
imurl
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
'None'
in
(
c_limits
,
imurl
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
imurl
+=
'&minIntensity='
+
str
(
c_limits
[
0
])
+
'&maxIntensity='
+
str
(
c_limits
[
1
])
...
...
@@ -302,7 +323,7 @@ for idx in range(params.max_tileviews):
State
({
'component'
:
'project_dd'
,
'module'
:
MATCH
},
'value'
),
State
({
'component'
:
'stack_dd'
,
'module'
:
MATCH
},
'value'
),
State
(
'url'
,
'pathname'
)
]
)
]
,
prevent_initial_call
=
True
)
def
slice_view
(
section
,
runstore
,
c_limits
,
owner
,
project
,
stack
,
thispage
):
if
not
dash
.
callback_context
.
triggered
:
raise
PreventUpdate
...
...
@@ -310,13 +331,13 @@ for idx in range(params.max_tileviews):
thispage
=
thispage
.
lstrip
(
'/'
)
if
not
hf
.
trigger
(
key
=
'module'
)
==
thispage
:
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
None
in
(
section
,
runstore
,
owner
,
project
,
stack
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
if
'None'
in
(
owner
,
project
,
stack
):
r
eturn
dash
.
no_u
pdate
r
aise
PreventU
pdate
url
=
params
.
render_base_url
+
params
.
render_version
+
'owner/'
+
owner
+
'/project/'
+
project
+
'/stack/'
+
stack
...
...
dash/convert.py
View file @
b7496b98
...
...
@@ -9,12 +9,15 @@ import dash
from
dash
import
dcc
from
dash
import
html
from
dash.dependencies
import
Input
,
Output
,
State
from
dash.exceptions
import
PreventUpdate
import
importlib
import
params
from
app
import
app
from
utils
import
pages
from
utils
import
helper_functions
as
hf
# from callbacks import runstate
...
...
@@ -88,9 +91,15 @@ switch_outputs.append(Output({'component': 'store_render_init', 'module': module
# Switch the visibility of elements for each selected sub-page based on the import type dropdown selection
@
app
.
callback
(
switch_outputs
,
Input
({
'component'
:
'import_type_dd'
,
'module'
:
module
},
'value'
))
def
convert_output
(
dd_value
):
Input
({
'component'
:
'import_type_dd'
,
'module'
:
module
},
'value'
),
State
(
'url'
,
'pathname'
))
def
convert_output
(
dd_value
,
thispage
):
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
outputs
=
dash
.
callback_context
.
outputs_list
outstyles
=
[{
'display'
:
'none'
}]
*
(
len
(
outputs
)
-
1
)
...
...
dash/inputtypes/sbem_conv.py
View file @
b7496b98
...
...
@@ -9,6 +9,7 @@ import dash
from
dash
import
dcc
from
dash
import
html
from
dash.dependencies
import
Input
,
Output
,
State
from
dash.exceptions
import
PreventUpdate
import
os
#for file browsing dialogs
...
...
@@ -23,6 +24,7 @@ from app import app
import
params
from
utils
import
launch_jobs
,
pages
,
checks
from
utils
import
helper_functions
as
hf
from
callbacks
import
filebrowse
,
render_selector
...
...
@@ -77,6 +79,12 @@ us_out,us_in,us_state = render_selector.init_update_store(label,parent,comp_in='
@
app
.
callback
(
us_out
,
us_in
,
us_state
,
prevent_initial_call
=
True
)
def
sbem_conv_update_store
(
*
args
):
thispage
=
args
[
-
1
]
thispage
=
thispage
.
lstrip
(
'/'
)
if
thispage
==
''
or
not
thispage
in
hf
.
trigger
(
key
=
'module'
):
raise
PreventUpdate
return
render_selector
.
update_store
(
*
args
)
...
...
dash/inputtypes/serialem_conv.py
View file @
b7496b98
...
...
@@ -9,6 +9,7 @@ import dash
from
dash
import
dcc
from
dash
import
html
from
dash.dependencies
import
Input
,
Output
,
State
from
dash.exceptions
import
PreventUpdate
import
os
#for file browsing dialogs
...
...
@@ -23,13 +24,14 @@ from app import app
import
params