Avoid selection of multiple indicies
This commit is contained in:
parent
cfe9832c1e
commit
80fddb514a
@ -265,10 +265,23 @@ def create():
|
|||||||
plot.toolbar.logo = None
|
plot.toolbar.logo = None
|
||||||
|
|
||||||
# Scan select
|
# Scan select
|
||||||
def scan_table_callback(_attr, _old, new):
|
def scan_table_callback(_attr, old, new):
|
||||||
if new:
|
if not new:
|
||||||
_update_plot(scan_table_source.data["scan"][new[-1]])
|
# skip empty selections
|
||||||
export_toggle.active = scan_table_source.data["export"][new[-1]]
|
return
|
||||||
|
|
||||||
|
# Avoid selection of multiple indicies (via Shift+Click or Ctrl+Click)
|
||||||
|
if len(new) > 1:
|
||||||
|
# drop selection to the previous one
|
||||||
|
scan_table_source.selected.indices = old
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(old) > 1:
|
||||||
|
# skip unnecessary update caused by selection drop
|
||||||
|
return
|
||||||
|
|
||||||
|
_update_plot(scan_table_source.data["scan"][new[0]])
|
||||||
|
export_toggle.active = scan_table_source.data["export"][new[0]]
|
||||||
|
|
||||||
scan_table_source = ColumnDataSource(dict(scan=[], hkl=[], peaks=[], fit=[], export=[]))
|
scan_table_source = ColumnDataSource(dict(scan=[], hkl=[], peaks=[], fit=[], export=[]))
|
||||||
scan_table = DataTable(
|
scan_table = DataTable(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user