Fix datatable selection
This commit is contained in:
@ -284,7 +284,7 @@ def create():
|
||||
# skip unnecessary update caused by selection drop
|
||||
return
|
||||
|
||||
_update_plot(det_data[scan_table_source.data["scan"][new[0]]])
|
||||
_update_plot(det_data[new[0]])
|
||||
|
||||
scan_table_source = ColumnDataSource(dict(scan=[], hkl=[], peaks=[], fit=[], export=[]))
|
||||
scan_table = DataTable(
|
||||
@ -303,9 +303,7 @@ def create():
|
||||
scan_table_source.selected.on_change("indices", scan_table_select_callback)
|
||||
|
||||
def _get_selected_scan():
|
||||
selected_index = scan_table_source.selected.indices[0]
|
||||
selected_scan_id = scan_table_source.data["scan"][selected_index]
|
||||
return det_data[selected_scan_id]
|
||||
return det_data[scan_table_source.selected.indices[0]]
|
||||
|
||||
def peak_pos_textinput_callback(_attr, _old, new):
|
||||
if new is not None and not peak_pos_textinput_lock:
|
||||
@ -512,7 +510,7 @@ def create():
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
temp_file = temp_dir + "/temp"
|
||||
export_data = deepcopy(det_data)
|
||||
for s, export in zip(scan_table_source.data["scan"], scan_table_source.data["export"]):
|
||||
for s, export in enumerate(scan_table_source.data["export"]):
|
||||
if not export:
|
||||
if "fit" in export_data[s]:
|
||||
del export_data[s]["fit"]
|
||||
@ -545,7 +543,7 @@ def create():
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
temp_file = temp_dir + "/temp"
|
||||
export_data = deepcopy(det_data)
|
||||
for s, export in zip(scan_table_source.data["scan"], scan_table_source.data["export"]):
|
||||
for s, export in enumerate(scan_table_source.data["export"]):
|
||||
if not export:
|
||||
del export_data[s]
|
||||
|
||||
|
Reference in New Issue
Block a user