Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • A Alex_Project
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Zhang, Yuanpeng
  • Alex_Project
  • Issues
  • #20

[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 on workspaces in Bragg Workspaces tree and all items there in the right click menu will crash ADDIE.

  1. For Delete workspace option, we need to go to the definition of function do_delete_gsas in addie/rietveld/braggtree.py. In the for loop there, we are cycling through all workspaces and here, we want to simply skip workspaces. 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)
  2. For Remove from plotting option, we need to go to the definition of function remove_gss_from_plot in addie/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
  3. For Merge to GSAS option, we need to go to the definition of function do_merge_to_gss in addie/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
  4. For To IPython option, we need to go to the definition of function do_copy_to_ipython in addie/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
  5. For Plot option, we need to go to the definition of function do_copy_to_ipython in addie/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)
Edited Jun 21, 2021 by Zhang, Yuanpeng
Assignee
Assign to
Time tracking