[Task] Solve the issue with right click menu on workspaces entry in Rietveld tab
Import some example data (as attached here, NOM161121tof.gsa, NOM161122tof.gsa, NOM161123tof.gsa) in
Rietveld
tab, we then right click onworkspaces
inBragg Workspaces
tree and all items there in the right click menu will crash ADDIE.
-
For
Delete workspace
option, we need to go to the definition of functiondo_delete_gsas
inaddie/rietveld/braggtree.py
. In thefor
loop there, we are cycling through all workspaces and here, we want to simply skipworkspaces
. So the old codes are,for gsas_node in gsas_node_list: # delete the gsas group workspace (deletes sub-workspaces as well) gsas_name = str(gsas_node.text()) gss_ws_name = gsas_name.split('_group')[0] self._main_window.get_workflow().delete_workspace(gss_ws_name)
and new codes will be,
for gsas_node in gsas_node_list: # delete the gsas group workspace (deletes sub-workspaces as well) gsas_name = str(gsas_node.text()) gss_ws_name = gsas_name.split('_group')[0] if gss_ws_name == "workspaces": continue self._main_window.get_workflow().delete_workspace(gss_ws_name)
-
For
Remove from plotting
option, we need to go to the definition of functionremove_gss_from_plot
inaddie/rietveld/braggtree.py
and change the following part of codes,if len(gss_wksps) == 0: raise RuntimeError( 'GSAS-single-bank workspace name list is empty!')
to
if len(gss_wksps) == 0: print("[Warning] GSAS-single-bank workspace name list is empty!") return
-
For
Merge to GSAS
option, we need to go to the definition of functiondo_merge_to_gss
inaddie/rietveld/braggtree.py
and change the codes from,gss_node_list = ret_obj if len(gss_node_list) == 0: return elif len(gss_node_list) > 1: msg = '[Error] Only 1 GSS node can be selected.' msg += 'Current selected nodes are {}.' print(msg.format(gss_node_list)) return
to
gss_node_list = ret_obj if len(gss_node_list) == 0: return elif len(gss_node_list) > 1: msg = '[Error] Only 1 GSS node can be selected.' msg += 'Current selected nodes are {}.' print(msg.format(gss_node_list)) return if str(gss_node_list[0]) == "workspaces": print("[Warning] No valid workspace selected!") return
-
For
To IPython
option, we need to go to the definition of functiondo_copy_to_ipython
inaddie/rietveld/braggtree.py
and change the codes from,ws_name = str(current_item.text()) python_cmd = "ws = mtd['%s']" % ws_name
to
ws_name = str(current_item.text()) if ws_name == "workspaces": print("[Warning] No valid workspace selected.") return python_cmd = "ws = mtd['%s']" % ws_name
-
For
Plot
option, we need to go to the definition of functiondo_copy_to_ipython
inaddie/rietveld/braggtree.py
and change the codes from,# set to plot for gss_group_node in selected_nodes: # gss_group_name = str(gss_group_node.text()) # self._main_window.set_bragg_ws_to_plot(gss_group_name) self._main_window.set_bragg_ws_to_plot(gss_group_node)
to
# set to plot for gss_group_node in selected_nodes: gss_group_name = str(gss_group_node) if gss_group_name == "workspaces": continue # self._main_window.set_bragg_ws_to_plot(gss_group_name) self._main_window.set_bragg_ws_to_plot(gss_group_node)