Changeset d792e813 in sasview


Ignore:
Timestamp:
Apr 22, 2010 2:07:22 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
85a8e95
Parents:
efea0bd
Message:

disable append data1d into theory panel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_loader.py

    r04349fe rd792e813  
    1111from sans.guicomm.events import NewPlotEvent, StatusEvent 
    1212 
     13def enable_add_data(existing_panel, new_plot): 
     14    """ 
     15        Enable append data on a plot panel 
     16    """ 
     17    is_theory = len(existing_panel.plots)<= 1 and \ 
     18        existing_panel.plots.values()[0].__class__.__name__=="Theory1D" 
     19         
     20    is_data2d = hasattr(new_plot, 'data') 
     21    is_data1d = existing_panel.__class__.__name__ == "ModelPanel1D"\ 
     22        and existing_panel.group_id is not None 
     23    
     24    return is_data1d and not is_data2d and not is_theory 
    1325 
    1426def parse_name(name, expression): 
     
    4153    return path 
    4254 
    43 def append_data_to_existing_panel(panel_name, data_name): 
     55def open_dialog_append_data(panel_name, data_name): 
    4456    """ 
    4557        Pop up an error message. 
     
    202214                panel_name = existing_panel.window_caption 
    203215                data_name = new_plot.name 
    204                 if existing_panel.__class__.__name__ == "ModelPanel1D"\ 
    205                     and existing_panel.group_id is not None and \ 
    206                         not hasattr(new_plot, 'data'): 
    207                     if append_data_to_existing_panel(panel_name, data_name): 
     216                if enable_add_data(existing_panel, new_plot): 
     217                    if open_dialog_append_data(panel_name, data_name): 
    208218                        #add this plot the an existing panel 
    209219                        new_plot.group_id = existing_panel.group_id 
     
    261271                panel_name = existing_panel.window_caption 
    262272                data_name = new_plot.name 
    263                 if existing_panel.__class__.__name__ == "ModelPanel1D"\ 
    264                     and existing_panel.group_id is not None and \ 
    265                     not hasattr(new_plot, 'data'): 
    266                     if append_data_to_existing_panel(panel_name, data_name): 
     273                if enable_add_data(existing_panel, new_plot): 
     274                    if open_dialog_append_data(panel_name, data_name): 
    267275                        #add this plot the an existing panel 
    268276                        new_plot.group_id = existing_panel.group_id 
Note: See TracChangeset for help on using the changeset viewer.