[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
Rietveldtab, we then right click onworkspacesinBragg Workspacestree and all items there in the right click menu will crash ADDIE.
-
For
Delete workspaceoption, we need to go to the definition of functiondo_delete_gsasinaddie/rietveld/braggtree.py. In theforloop 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 plottingoption, we need to go to the definition of functionremove_gss_from_plotinaddie/rietveld/braggtree.pyand 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 GSASoption, we need to go to the definition of functiondo_merge_to_gssinaddie/rietveld/braggtree.pyand 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)) returnto
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 IPythonoption, we need to go to the definition of functiondo_copy_to_ipythoninaddie/rietveld/braggtree.pyand change the codes from,ws_name = str(current_item.text()) python_cmd = "ws = mtd['%s']" % ws_nameto
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
Plotoption, we need to go to the definition of functiondo_copy_to_ipythoninaddie/rietveld/braggtree.pyand 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)