Remove Prev and Next buttons
Equivalent actions can be done via image index Spinner arrows, as well as up/down keyboard buttons.
This commit is contained in:
parent
2fcf5183c5
commit
f324e330ba
@ -117,13 +117,15 @@ def create():
|
|||||||
filelist = Select()
|
filelist = Select()
|
||||||
filelist.on_change("value", filelist_callback)
|
filelist.on_change("value", filelist_callback)
|
||||||
|
|
||||||
def index_spinner_callback(_attr, _old, new):
|
def index_spinner_callback(_attr, old, new):
|
||||||
nonlocal current_index
|
nonlocal current_index
|
||||||
if 0 <= new < curent_h5_data.shape[0]:
|
if 0 <= new < curent_h5_data.shape[0]:
|
||||||
current_index = new
|
current_index = new
|
||||||
update_image()
|
update_image()
|
||||||
|
else:
|
||||||
|
index_spinner.value = old
|
||||||
|
|
||||||
index_spinner = Spinner(value=0)
|
index_spinner = Spinner(title="Image index:", value=0)
|
||||||
index_spinner.on_change("value", index_spinner_callback)
|
index_spinner.on_change("value", index_spinner_callback)
|
||||||
|
|
||||||
plot = Plot(
|
plot = Plot(
|
||||||
@ -364,24 +366,6 @@ def create():
|
|||||||
roi_avg_plot_line_source = ColumnDataSource(dict(x=[], y=[]))
|
roi_avg_plot_line_source = ColumnDataSource(dict(x=[], y=[]))
|
||||||
roi_avg_plot.add_glyph(roi_avg_plot_line_source, Line(x="x", y="y", line_color="steelblue"))
|
roi_avg_plot.add_glyph(roi_avg_plot_line_source, Line(x="x", y="y", line_color="steelblue"))
|
||||||
|
|
||||||
def prev_button_callback():
|
|
||||||
nonlocal current_index
|
|
||||||
if current_index > 0:
|
|
||||||
current_index -= 1
|
|
||||||
update_image()
|
|
||||||
|
|
||||||
prev_button = Button(label="Previous")
|
|
||||||
prev_button.on_click(prev_button_callback)
|
|
||||||
|
|
||||||
def next_button_callback():
|
|
||||||
nonlocal current_index
|
|
||||||
if current_index < curent_h5_data.shape[0] - 1:
|
|
||||||
current_index += 1
|
|
||||||
update_image()
|
|
||||||
|
|
||||||
next_button = Button(label="Next")
|
|
||||||
next_button.on_click(next_button_callback)
|
|
||||||
|
|
||||||
cmap_dict = {
|
cmap_dict = {
|
||||||
"gray": Greys256,
|
"gray": Greys256,
|
||||||
"gray_reversed": Greys256[::-1],
|
"gray_reversed": Greys256[::-1],
|
||||||
@ -477,9 +461,9 @@ def create():
|
|||||||
selection_button.on_click(selection_button_callback)
|
selection_button.on_click(selection_button_callback)
|
||||||
|
|
||||||
# Final layout
|
# Final layout
|
||||||
layout_image = gridplot([[proj_v, None], [plot, proj_h]], merge_tools=False)
|
layout_image = column(
|
||||||
|
gridplot([[proj_v, None], [plot, proj_h]], merge_tools=False), row(index_spinner)
|
||||||
animate_layout = column(index_spinner, next_button, prev_button)
|
)
|
||||||
colormap_layout = column(colormap, auto_toggle, display_max_spinner, display_min_spinner)
|
colormap_layout = column(colormap, auto_toggle, display_max_spinner, display_min_spinner)
|
||||||
hkl_layout = column(radio_button_group, hkl_button)
|
hkl_layout = column(radio_button_group, hkl_button)
|
||||||
|
|
||||||
@ -492,11 +476,7 @@ def create():
|
|||||||
|
|
||||||
tab_layout = row(
|
tab_layout = row(
|
||||||
column(
|
column(
|
||||||
upload_div,
|
upload_div, upload_button, filelist, layout_image, row(colormap_layout, hkl_layout),
|
||||||
upload_button,
|
|
||||||
filelist,
|
|
||||||
layout_image,
|
|
||||||
row(colormap_layout, animate_layout, hkl_layout),
|
|
||||||
),
|
),
|
||||||
column(roi_avg_plot, layout_overview, row(selection_button, selection_list),),
|
column(roi_avg_plot, layout_overview, row(selection_button, selection_list),),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user