Index: src/sas/sasgui/guiframe/data_panel.py
===================================================================
--- src/sas/sasgui/guiframe/data_panel.py	(revision b5c44f0493a2482bb7ea5c39743c7eb7514dd935)
+++ src/sas/sasgui/guiframe/data_panel.py	(revision e767897d6a10f25bfe2bccbef3e3fe6ab0385f7c)
@@ -2,5 +2,5 @@
 #This software was developed by the University of Tennessee as part of the
 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-#project funded by the US National Science Foundation. 
+#project funded by the US National Science Foundation.
 #
 #See the license text in license.txt
@@ -41,13 +41,13 @@
         as QucikPlotDialog
 import sas.sasgui.guiframe.config as config
- 
+
 extension_list = []
 if config.APPLICATION_STATE_EXTENSION is not None:
     extension_list.append(config.APPLICATION_STATE_EXTENSION)
-EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS + extension_list   
+EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS + extension_list
 PLUGINS_WLIST = config.PLUGINS_WLIST
 APPLICATION_WLIST = config.APPLICATION_WLIST
 
-#Control panel width 
+#Control panel width
 if sys.platform.count("win32") > 0:
     PANEL_WIDTH = 235
@@ -67,6 +67,6 @@
 STYLE_FLAG = wx.RAISED_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\
                     wx.WANTS_CHARS|CT.TR_HAS_VARIABLE_ROW_HEIGHT
-                    
-                    
+
+
 class DataTreeCtrl(CT.CustomTreeCtrl):
     """
@@ -97,9 +97,9 @@
                     CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds)
         self.root = self.AddRoot("Available Data")
-                   
+
     def OnCompareItems(self, item1, item2):
-        """ 
-        Overrides OnCompareItems in wx.TreeCtrl. 
-        Used by the SortChildren method. 
+        """
+        Overrides OnCompareItems in wx.TreeCtrl.
+        Used by the SortChildren method.
         """
         # Get the item data
@@ -113,8 +113,8 @@
         else:
             return 0
-        
+
 class DataPanel(ScrolledPanel, PanelBase):
     """
-    This panel displays data available in the application and widgets to 
+    This panel displays data available in the application and widgets to
     interact with data.
     """
@@ -123,10 +123,10 @@
     ## Title to appear on top of the window
     window_caption = "Data Explorer"
-    #type of window 
+    #type of window
     window_type = "Data Panel"
     ## Flag to tell the GUI manager that this panel is not
     #  tied to any perspective
     #ALWAYS_ON = True
-    def __init__(self, parent, 
+    def __init__(self, parent,
                  list=None,
                  size=(PANEL_WIDTH, PANEL_HEIGHT),
@@ -138,9 +138,9 @@
         PanelBase.__init__(self, parent)
         self.SetupScrolling()
-        #Set window's font size 
+        #Set window's font size
         self.SetWindowVariant(variant=FONT_VARIANT)
-        self.loader = Loader()  
+        self.loader = Loader()
         #Default location
-        self._default_save_location = None  
+        self._default_save_location = None
         self.all_data1d = True
         self.parent = parent.parent
@@ -188,5 +188,5 @@
         if self.parent is not None:
             self.parent.Bind(EVT_DELETE_PLOTPANEL, self._on_delete_plot_panel)
-     
+
     def do_layout(self):
         """
@@ -198,5 +198,5 @@
         self.layout_batch()
         self.layout_button()
-        
+
     def disable_app_combo(self, enable):
         """
@@ -204,5 +204,5 @@
         """
         self.perspective_cbox.Enable(enable)
-        
+
     def define_panel_structure(self):
         """
@@ -213,10 +213,10 @@
         self.sizer1 = wx.BoxSizer(wx.VERTICAL)
         self.sizer1.SetMinSize(wx.Size(w/13, h*2/5))
-      
+
         self.sizer2 = wx.BoxSizer(wx.VERTICAL)
         self.sizer3 = wx.FlexGridSizer(9, 2, 4, 1)
         self.sizer4 = wx.BoxSizer(wx.VERTICAL)
         self.sizer5 = wx.BoxSizer(wx.VERTICAL)
-       
+
         self.vbox.Add(self.sizer5, 0, wx.EXPAND|wx.ALL, 1)
         self.vbox.Add(self.sizer1, 1, wx.EXPAND|wx.ALL, 0)
@@ -224,7 +224,7 @@
         self.vbox.Add(self.sizer3, 0, wx.EXPAND|wx.ALL, 10)
         #self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5)
-        
+
         self.SetSizer(self.vbox)
-        
+
     def layout_selection(self):
         """
@@ -244,9 +244,9 @@
         self.selection_cbox.SetValue('Select all Data')
         wx.EVT_COMBOBOX(self.selection_cbox, -1, self._on_selection_type)
-        self.sizer5.AddMany([(select_txt, 0, wx.ALL, 5), 
+        self.sizer5.AddMany([(select_txt, 0, wx.ALL, 5),
                             (self.selection_cbox, 0, wx.ALL,5)])
         self.enable_selection()
-        
-    
+
+
     def _on_selection_type(self, event):
         """
@@ -254,32 +254,39 @@
             :param event: UI event
         """
+        def check_item_and_children(control, check_value=True):
+            self.tree_ctrl.CheckItem(data_ctrl, check_value)
+            if data_ctrl.HasChildren():
+                if check_value == True and not control.IsExpanded():
+                    # Only select children if control is expanded
+                    # Always deselect children, regardless (see ticket #259)
+                    return
+                for child_ctrl in data_ctrl.GetChildren():
+                    self.tree_ctrl.CheckItem(child_ctrl, check_value)
+
         option = self.selection_cbox.GetValue()
-        
+
         pos = self.selection_cbox.GetSelection()
         if pos == wx.NOT_FOUND:
-            return 
+            return
         option = self.selection_cbox.GetString(pos)
         for item in self.list_cb_data.values():
             data_ctrl, _, _, _, _, _, _, _ = item
-            _, data_class, _ = self.tree_ctrl.GetItemPyData(data_ctrl) 
+            _, data_class, _ = self.tree_ctrl.GetItemPyData(data_ctrl)
             if option == 'Select all Data':
-                self.tree_ctrl.CheckItem(data_ctrl, True) 
+                check_item_and_children(data_ctrl, check_value=True)
             elif option == 'Unselect all Data':
-                self.tree_ctrl.CheckItem(data_ctrl, False)
+                check_item_and_children(data_ctrl, check_value=False)
             elif option == 'Select all Data 1D':
                 if data_class == 'Data1D':
-                    self.tree_ctrl.CheckItem(data_ctrl, True) 
+                    check_item_and_children(data_ctrl, check_value=True)
             elif option == 'Unselect all Data 1D':
                 if data_class == 'Data1D':
-                    self.tree_ctrl.CheckItem(data_ctrl, False) 
-            elif option == 'Select all Data 1D':
-                if data_class == 'Data1D':
-                    self.tree_ctrl.CheckItem(data_ctrl, True) 
+                    check_item_and_children(data_ctrl, check_value=False)
             elif option == 'Select all Data 2D':
                 if data_class == 'Data2D':
-                    self.tree_ctrl.CheckItem(data_ctrl, True) 
+                    check_item_and_children(data_ctrl, check_value=True)
             elif option == 'Unselect all Data 2D':
                 if data_class == 'Data2D':
-                    self.tree_ctrl.CheckItem(data_ctrl, False) 
+                    check_item_and_children(data_ctrl, check_value=False)
         self.enable_append()
         self.enable_freeze()
@@ -287,5 +294,5 @@
         self.enable_import()
         self.enable_remove()
-               
+
     def layout_button(self):
         """
@@ -293,9 +300,9 @@
         """
         #Load Data Button
-        self.bt_add = wx.Button(self, wx.NewId(), "Load Data", 
+        self.bt_add = wx.Button(self, wx.NewId(), "Load Data",
                                 size=(BUTTON_WIDTH, -1))
         self.bt_add.SetToolTipString("Load data files")
         wx.EVT_BUTTON(self, self.bt_add.GetId(), self._load_data)
-        
+
         #Delete Data Button
         self.bt_remove = wx.Button(self, wx.NewId(), "Delete Data",
@@ -303,5 +310,5 @@
         self.bt_remove.SetToolTipString("Delete data from the application")
         wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove)
-        
+
         #Send data to perspective button
         self.bt_import = wx.Button(self, wx.NewId(), "Send To",
@@ -309,5 +316,5 @@
         self.bt_import.SetToolTipString("Send Data set to active perspective")
         wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import)
-        
+
         #Choose perspective to be send data to combo box
         self.perspective_cbox = wx.ComboBox(self, -1,
@@ -315,7 +322,7 @@
         if not IS_MAC:
             self.perspective_cbox.SetMinSize((BUTTON_WIDTH*1.6, -1))
-        wx.EVT_COMBOBOX(self.perspective_cbox, -1, 
+        wx.EVT_COMBOBOX(self.perspective_cbox, -1,
                         self._on_perspective_selection)
-    
+
         #Append data to current Graph Button
         self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To",
@@ -324,13 +331,13 @@
                                 "Plot the selected data in the active panel")
         wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot)
-        
+
         #Create a new graph and send data to that new graph button
-        self.bt_plot = wx.Button(self, wx.NewId(), "New Plot", 
+        self.bt_plot = wx.Button(self, wx.NewId(), "New Plot",
                                  size=(BUTTON_WIDTH, -1))
         self.bt_plot.SetToolTipString("To trigger plotting")
         wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot)
-        
+
         #Freeze current theory button - becomes a data set and stays on graph
-        self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory", 
+        self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory",
                                    size=(BUTTON_WIDTH, -1))
         freeze_tip = "To trigger freeze a theory: making a copy\n"
@@ -339,15 +346,15 @@
         self.bt_freeze.SetToolTipString(freeze_tip)
         wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze)
-       
+
         #select plot to send to combo box (blank if no data)
         if sys.platform == 'darwin':
-            self.cb_plotpanel = wx.ComboBox(self, -1, 
+            self.cb_plotpanel = wx.ComboBox(self, -1,
                                             style=wx.CB_READONLY)
         else:
-            self.cb_plotpanel = wx.ComboBox(self, -1, 
+            self.cb_plotpanel = wx.ComboBox(self, -1,
                                             style=wx.CB_READONLY|wx.CB_SORT)
         wx.EVT_COMBOBOX(self.cb_plotpanel, -1, self._on_plot_selection)
         self.cb_plotpanel.Disable()
-        
+
         #Help button
         self.bt_help = wx.Button(self, wx.NewId(), "HELP",
@@ -365,10 +372,10 @@
                              ((10, 10)),
                              (self.bt_append_plot),
-                             (self.cb_plotpanel, 
+                             (self.cb_plotpanel,
                               wx.EXPAND|wx.ADJUST_MINSIZE, 5),
                              ((5, 5)),
                              ((5, 5)),
                              (self.bt_import, 0, wx.EXPAND|wx.RIGHT, 5),
-                             (self.perspective_cbox, 
+                             (self.perspective_cbox,
                               wx.EXPAND|wx.ADJUST_MINSIZE, 5),
                              ((10, 10)),
@@ -385,5 +392,5 @@
         self.enable_freeze()
         self.enable_remove_plot()
-        
+
     def layout_batch(self):
         """
@@ -397,10 +404,10 @@
         self.Bind(wx.EVT_RADIOBUTTON, self.on_batch_mode,
                    id=self.rb_batch_mode.GetId())
-        
+
         self.rb_single_mode.SetValue(not self.parent.batch_on)
         self.rb_batch_mode.SetValue(self.parent.batch_on)
         self.sizer4.AddMany([(self.rb_single_mode, 0, wx.ALL, 4),
                              (self.rb_batch_mode, 0, wx.ALL, 4)])
-        
+
     def on_single_mode(self, event):
         """
@@ -410,5 +417,5 @@
         if self.parent is not None:
             wx.PostEvent(self.parent, NewBatchEvent(enable=False))
-       
+
     def on_batch_mode(self, event):
         """
@@ -417,8 +424,8 @@
         """
         if self.parent is not None:
-            wx.PostEvent(self.parent, 
+            wx.PostEvent(self.parent,
                          NewBatchEvent(enable=True))
-    
-    def _get_data_selection(self, event):  
+
+    def _get_data_selection(self, event):
         """
             Get data selection from the right click
@@ -435,5 +442,5 @@
             data = theory_list.values()[0][0]
         return data
-    
+
     def on_edit_data(self, event):
         """
@@ -443,9 +450,9 @@
         from sas.sasgui.guiframe.local_perspectives.plotting.masking \
             import MaskPanel as MaskDialog
-        
-        panel = MaskDialog(parent=self.parent, base=self, 
+
+        panel = MaskDialog(parent=self.parent, base=self,
                            data=data, id=wx.NewId())
         panel.ShowModal()
-    
+
     def on_plot_3d(self, event):
         """
@@ -455,9 +462,9 @@
         from sas.sasgui.guiframe.local_perspectives.plotting.masking \
         import FloatPanel as Float3dDialog
-        
-        panel = Float3dDialog(base=self, data=data, 
+
+        panel = Float3dDialog(base=self, data=data,
                               dimension=3, id=wx.NewId())
-        panel.ShowModal()   
-    
+        panel.ShowModal()
+
     def on_quick_plot(self, event):
         """
@@ -468,6 +475,6 @@
             dimension = 2
         else:
-            dimension = 1 
-        #panel = QucikPlotDialog(base=self, data=data, 
+            dimension = 1
+        #panel = QucikPlotDialog(base=self, data=data,
         #                        dimension=dimension, id=wx.NewId())
         frame = QucikPlotDialog(self, -1, "Plot " + data.name, 'log_{10}')
@@ -477,6 +484,6 @@
         frame.Show(True)
         frame.SetFocus()
-        #panel.ShowModal()    
-    
+        #panel.ShowModal()
+
     def on_data_info(self, event):
         """
@@ -488,5 +495,5 @@
         else:
             self.parent.show_data1d(data, data.name)
-        
+
     def on_save_as(self, event):
         """
@@ -506,5 +513,5 @@
             else:
                 print "unable to save this type of data"
-        
+
     def layout_data_list(self):
         """
@@ -523,5 +530,5 @@
         self.data_menu.Append(id, name, msg)
         wx.EVT_MENU(self, id, self.on_data_info)
-        
+
         id = wx.NewId()
         name = "Save As"
@@ -529,5 +536,5 @@
         self.data_menu.Append(id, name, msg)
         wx.EVT_MENU(self, id, self.on_save_as)
-    
+
         quickplot_id = wx.NewId()
         name = "Quick Plot"
@@ -535,5 +542,5 @@
         self.data_menu.Append(quickplot_id, name, msg)
         wx.EVT_MENU(self, quickplot_id, self.on_quick_plot)
-        
+
         self.plot3d_id = wx.NewId()
         name = "Quick 3DPlot (Slow)"
@@ -541,5 +548,5 @@
         self.data_menu.Append(self.plot3d_id, name, msg)
         wx.EVT_MENU(self, self.plot3d_id, self.on_plot_3d)
-            
+
         self.editmask_id = wx.NewId()
         name = "Edit Mask"
@@ -547,12 +554,12 @@
         self.data_menu.Append(self.editmask_id, name, msg)
         wx.EVT_MENU(self, self.editmask_id, self.on_edit_data)
-        
+
         tree_ctrl_theory_label = wx.StaticText(self, -1, "Theory")
         tree_ctrl_theory_label.SetForegroundColour('blue')
-        self.tree_ctrl_theory = DataTreeCtrl(parent=self, 
+        self.tree_ctrl_theory = DataTreeCtrl(parent=self,
                                                     style=wx.SUNKEN_BORDER)
-        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, 
+        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING,
                                                     self.on_check_item)
-        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 
+        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU,
                                    self.on_right_click_theory)
         self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10)
@@ -560,5 +567,5 @@
         self.sizer1.Add(tree_ctrl_theory_label, 0,  wx.LEFT, 10)
         self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND|wx.ALL, 10)
-           
+
     def on_right_click_theory(self, event):
         """
@@ -575,6 +582,6 @@
             self.data_menu.Enable(self.editmask_id, False)
             self.data_menu.Enable(self.plot3d_id, menu_enable)
-            self.PopupMenu(self.data_menu) 
-                   
+            self.PopupMenu(self.data_menu)
+
     def on_right_click_data(self, event):
         """
@@ -596,7 +603,7 @@
             self.data_menu.Enable(self.editmask_id, maskmenu_enable)
             self.data_menu.Enable(self.plot3d_id, menu_enable)
-            self.PopupMenu(self.data_menu) 
-        
-    def onContextMenu(self, event): 
+            self.PopupMenu(self.data_menu)
+
+    def onContextMenu(self, event):
         """
         Retrieve the state selected state
@@ -606,7 +613,7 @@
         pos = event.GetPosition()
         pos = self.ScreenToClient(pos)
-        self.PopupMenu(self.popUpMenu, pos) 
-      
-  
+        self.PopupMenu(self.popUpMenu, pos)
+
+
     def on_check_item(self, event):
         """
@@ -614,5 +621,5 @@
         """
         item = event.GetItem()
-        item.Check(not item.IsChecked()) 
+        item.Check(not item.IsChecked())
         self.enable_append()
         self.enable_freeze()
@@ -621,5 +628,5 @@
         self.enable_remove()
         event.Skip()
-        
+
     def fill_cbox_analysis(self, plugin):
         """
@@ -635,10 +642,10 @@
                 if plug.get_perspective():
                     self.perspective_cbox.Append(plug.sub_menu, plug)
-            
+
             curr_pers = self.parent.get_current_perspective()
             if curr_pers:
                 self.perspective_cbox.SetStringSelection(curr_pers.sub_menu)
                 self.enable_import()
-                        
+
     def load_data_list(self, list):
         """
@@ -654,5 +661,5 @@
                     data_run = str(data.run)
                     data_class = data.__class__.__name__
-                    path = dstate.get_path() 
+                    path = dstate.get_path()
                     process_list = data.process
                     data_id = data.id
@@ -661,18 +668,18 @@
                         #new state
                         data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,
-                                        0, data_name, ct_type=1, 
+                                        0, data_name, ct_type=1,
                                         data=(data_id, data_class, state_id))
                         data_c.Check(True)
                         d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info')
-                        d_t_c = self.tree_ctrl.AppendItem(d_i_c, 
+                        d_t_c = self.tree_ctrl.AppendItem(d_i_c,
                                                       'Title: %s' % data_title)
-                        r_n_c = self.tree_ctrl.AppendItem(d_i_c, 
+                        r_n_c = self.tree_ctrl.AppendItem(d_i_c,
                                                       'Run: %s' % data_run)
-                        i_c_c = self.tree_ctrl.AppendItem(d_i_c, 
+                        i_c_c = self.tree_ctrl.AppendItem(d_i_c,
                                                       'Type: %s' % data_class)
                         p_c_c = self.tree_ctrl.AppendItem(d_i_c,
                                                       "Path: '%s'" % s_path)
                         d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process')
-                        
+
                         for process in process_list:
                             process_str = str(process).replace('\n',' ')
@@ -680,7 +687,7 @@
                                 process_str = process_str[:20]+' [...]'
                             self.tree_ctrl.AppendItem(d_p_c, process_str)
-                        theory_child = self.tree_ctrl.AppendItem(data_c, 
+                        theory_child = self.tree_ctrl.AppendItem(data_c,
                                                                  "THEORIES")
-                        self.list_cb_data[state_id] = [data_c, 
+                        self.list_cb_data[state_id] = [data_c,
                                                        d_i_c,
                                                        d_t_c,
@@ -695,12 +702,12 @@
                         data_c, d_i_c, d_t_c, r_n_c,  i_c_c, p_c_c, d_p_c, _ \
                                 = data_ctrl_list
-                        self.tree_ctrl.SetItemText(data_c, data_name) 
+                        self.tree_ctrl.SetItemText(data_c, data_name)
                         temp = (data_id, data_class, state_id)
-                        self.tree_ctrl.SetItemPyData(data_c, temp) 
-                        self.tree_ctrl.SetItemText(i_c_c, 
+                        self.tree_ctrl.SetItemPyData(data_c, temp)
+                        self.tree_ctrl.SetItemText(i_c_c,
                                                    'Type: %s' % data_class)
-                        self.tree_ctrl.SetItemText(p_c_c, 
-                                                   'Path: %s' % s_path) 
-                        self.tree_ctrl.DeleteChildren(d_p_c) 
+                        self.tree_ctrl.SetItemText(p_c_c,
+                                                   'Path: %s' % s_path)
+                        self.tree_ctrl.DeleteChildren(d_p_c)
                         for process in process_list:
                             if not process.is_empty():
@@ -710,5 +717,5 @@
             # Sort by data name
             if self.tree_ctrl.root:
-                self.tree_ctrl.SortChildren(self.tree_ctrl.root)    
+                self.tree_ctrl.SortChildren(self.tree_ctrl.root)
         self.enable_remove()
         self.enable_import()
@@ -716,5 +723,5 @@
         self.enable_freeze()
         self.enable_selection()
-        
+
     def _uncheck_all(self):
         """
@@ -723,5 +730,5 @@
         for item in self.list_cb_data.values():
             data_ctrl, _, _, _, _, _, _, _ = item
-            self.tree_ctrl.CheckItem(data_ctrl, False) 
+            self.tree_ctrl.CheckItem(data_ctrl, False)
         self.enable_append()
         self.enable_freeze()
@@ -729,5 +736,5 @@
         self.enable_import()
         self.enable_remove()
-   
+
     def append_theory(self, state_id, theory_list):
         """
@@ -736,5 +743,5 @@
         """
         if not theory_list:
-            return 
+            return
         if state_id not in self.list_cb_data.keys():
             root = self.tree_ctrl_theory.root
@@ -746,9 +753,9 @@
             tree = self.tree_ctrl
         if root is not None:
-            wx.CallAfter(self.append_theory_helper, tree=tree, root=root, 
-                                       state_id=state_id, 
+            wx.CallAfter(self.append_theory_helper, tree=tree, root=root,
+                                       state_id=state_id,
                                        theory_list=theory_list)
-      
-      
+
+
     def append_theory_helper(self, tree, root, state_id, theory_list):
         """
@@ -778,23 +785,23 @@
                                                     name, ct_type=1, data=temp)
                     t_i_c = tree.AppendItem(t_child, 'Info')
-                    i_c_c = tree.AppendItem(t_i_c, 
+                    i_c_c = tree.AppendItem(t_i_c,
                                                   'Type: %s' % theory_class)
                     t_p_c = tree.AppendItem(t_i_c, 'Process')
-                    
+
                     for process in theory_data.process:
                         tree.AppendItem(t_p_c, process.__str__())
-                    theory_list_ctrl[theory_id] = [t_child, 
-                                                   i_c_c, 
+                    theory_list_ctrl[theory_id] = [t_child,
+                                                   i_c_c,
                                                    t_p_c]
                 else:
                     #replace theory
                     t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id]
-                    tree.SetItemText(t_child, name) 
-                    tree.SetItemPyData(t_child, temp) 
-                    tree.SetItemText(i_c_c, 'Type: %s' % theory_class) 
-                    tree.DeleteChildren(t_p_c) 
+                    tree.SetItemText(t_child, name)
+                    tree.SetItemPyData(t_child, temp)
+                    tree.SetItemText(i_c_c, 'Type: %s' % theory_class)
+                    tree.DeleteChildren(t_p_c)
                     for process in theory_data.process:
                         tree.AppendItem(t_p_c, process.__str__())
-              
+
         else:
             #data didn't have a theory associated it before
@@ -807,23 +814,23 @@
                     theory_id = theory_data.id
                     #if theory_state is not None:
-                    #    name = theory_state.model.name 
+                    #    name = theory_state.model.name
                     temp = (theory_id, theory_class, state_id)
                     t_child = tree.AppendItem(root,
-                            name, ct_type=1, 
+                            name, ct_type=1,
                             data=(theory_data.id, theory_class, state_id))
                     t_i_c = tree.AppendItem(t_child, 'Info')
-                    i_c_c = tree.AppendItem(t_i_c, 
+                    i_c_c = tree.AppendItem(t_i_c,
                                                   'Type: %s' % theory_class)
                     t_p_c = tree.AppendItem(t_i_c, 'Process')
-                    
+
                     for process in theory_data.process:
                         tree.AppendItem(t_p_c, process.__str__())
-            
+
                     theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c]
                 #self.list_cb_theory[data_id] = theory_list_ctrl
                 self.list_cb_theory[state_id] = theory_list_ctrl
-        
-            
-   
+
+
+
     def set_data_helper(self):
         """
@@ -840,5 +847,5 @@
                 if state_id not in state_to_plot:
                     state_to_plot.append(state_id)
-           
+
         for theory_dict in self.list_cb_theory.values():
             for _, value in theory_dict.iteritems():
@@ -850,5 +857,5 @@
                         state_to_plot.append(state_id)
         return data_to_plot, theory_to_plot, state_to_plot
-    
+
     def remove_by_id(self, id):
         """
@@ -857,22 +864,22 @@
         for item in self.list_cb_data.values():
             data_c, _, _, _, _, _,  _, _ = item
-            data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c) 
+            data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c)
             if id == data_id:
                 self.tree_ctrl.Delete(data_c)
                 del self.list_cb_data[state_id]
                 del self.list_cb_theory[data_id]
-              
+
     def load_error(self, error=None):
         """
         Pop up an error message.
-        
+
         :param error: details error message to be displayed
         """
         if error is not None or str(error).strip() != "":
-            dial = wx.MessageDialog(self.parent, str(error), 
+            dial = wx.MessageDialog(self.parent, str(error),
                                     'Error Loading File',
                                     wx.OK | wx.ICON_EXCLAMATION)
-            dial.ShowModal()  
-        
+            dial.ShowModal()
+
     def _load_data(self, event):
         """
@@ -881,10 +888,10 @@
         if self.parent is not None:
             wx.PostEvent(self.parent, NewLoadDataEvent())
-            
+
 
     def on_remove(self, event):
         """
         Get a list of item checked and remove them from the treectrl
-        Ask the parent to remove reference to this item 
+        Ask the parent to remove reference to this item
         """
         msg = "This operation will delete the data sets checked "
@@ -893,5 +900,5 @@
         if msg_box.ShowModal() != wx.ID_OK:
             return
-        
+
         data_to_remove, theory_to_remove, _ = self.set_data_helper()
         data_key = []
@@ -906,5 +913,5 @@
                     theory_list_ctrl = self.list_cb_theory[d_key]
                     theory_to_remove += theory_list_ctrl.keys()
-        # Remove theory from treectrl       
+        # Remove theory from treectrl
         for _, theory_dict in self.list_cb_theory.iteritems():
             for  key, value in theory_dict.iteritems():
@@ -916,5 +923,5 @@
                         pass
                     theory_key.append(key)
-                    
+
         #Remove data and related theory references
         for key in data_key:
@@ -934,6 +941,6 @@
                                 pass
                     del theory_dict[key]
-                    
-            
+
+
         self.parent.remove_data(data_id=data_to_remove,
                                   theory_id=theory_to_remove)
@@ -941,5 +948,5 @@
         self.enable_freeze()
         self.enable_remove_plot()
-        
+
     def on_import(self, event=None):
         """
@@ -951,5 +958,5 @@
         temp = data_id + state_id
         self.parent.set_data(data_id=temp, theory_id=theory_id)
-        
+
     def on_append_plot(self, event=None):
         """
@@ -958,9 +965,9 @@
         self._on_plot_selection()
         data_id, theory_id, state_id = self.set_data_helper()
-        self.parent.plot_data(data_id=data_id,  
+        self.parent.plot_data(data_id=data_id,
                               state_id=state_id,
                               theory_id=theory_id,
                               append=True)
-   
+
     def on_plot(self, event=None):
         """
@@ -968,10 +975,10 @@
         """
         data_id, theory_id, state_id = self.set_data_helper()
-        self.parent.plot_data(data_id=data_id,  
+        self.parent.plot_data(data_id=data_id,
                               state_id=state_id,
                               theory_id=theory_id,
                               append=False)
         self.enable_remove_plot()
-         
+
     def on_close_page(self, event=None):
         """
@@ -982,5 +989,5 @@
         # send parent to update menu with no show nor hide action
         self.parent.show_data_panel(action=False)
-    
+
     def on_freeze(self, event):
         """
@@ -995,5 +1002,5 @@
             msg = "Freeze Theory: Requires at least one theory checked."
         wx.PostEvent(self.parent, StatusEvent(status=msg))
-            
+
     def set_active_perspective(self, name):
         """
@@ -1002,8 +1009,8 @@
         self.perspective_cbox.SetStringSelection(name)
         self.enable_import()
-        
+
     def _on_delete_plot_panel(self, event):
         """
-        get an event with attribute name and caption to delete existing name 
+        get an event with attribute name and caption to delete existing name
         from the combobox of the current panel
         """
@@ -1011,9 +1018,9 @@
         caption = event.caption
         if self.cb_plotpanel is not None:
-            pos = self.cb_plotpanel.FindString(str(caption)) 
+            pos = self.cb_plotpanel.FindString(str(caption))
             if pos != wx.NOT_FOUND:
                 self.cb_plotpanel.Delete(pos)
         self.enable_append()
-        
+
     def set_panel_on_focus(self, name=None):
         """
@@ -1031,5 +1038,5 @@
         self.enable_append()
         self.enable_remove_plot()
-    
+
     def set_plot_unfocus(self):
         """
@@ -1037,5 +1044,5 @@
         """
         return
-    
+
     def _on_perspective_selection(self, event=None):
         """
@@ -1047,5 +1054,5 @@
             perspective.on_perspective(event=None)
             self.parent.check_multimode(perspective=perspective)
-                
+
     def _on_plot_selection(self, event=None):
         """
@@ -1061,10 +1068,10 @@
         if combo.GetValue() != 'None':
             panel = combo.GetClientData(selection)
-            self.parent.on_set_plot_focus(panel)   
-            
+            self.parent.on_set_plot_focus(panel)
+
     def on_close_plot(self, event):
         """
         clseo the panel on focus
-        """ 
+        """
         self.enable_append()
         selection = self.cb_plotpanel.GetSelection()
@@ -1072,19 +1079,19 @@
             panel = self.cb_plotpanel.GetClientData(selection)
             if self.parent is not None and panel is not None:
-                wx.PostEvent(self.parent, 
+                wx.PostEvent(self.parent,
                              NewPlotEvent(group_id=panel.group_id,
                                           action="delete"))
         self.enable_remove_plot()
-    
+
     def set_frame(self, frame):
         """
         """
         self.frame = frame
-    
+
     def get_frame(self):
         """
         """
-        return self.frame 
-    
+        return self.frame
+
     def on_help(self, event):
         """
@@ -1115,5 +1122,5 @@
         """
         self.parent.show_data_panel(event)
-                        
+
     def set_schedule_full_draw(self, panel=None, func='del'):
         """
@@ -1121,5 +1128,5 @@
         """
         self.parent.set_schedule_full_draw(panel, func)
-        
+
     def enable_remove_plot(self):
         """
@@ -1131,5 +1138,5 @@
         #else:
         #    self.bt_close_plot.Enable()
-            
+
     def enable_remove(self):
         """
@@ -1142,5 +1149,5 @@
         else:
             self.bt_remove.Enable()
-            
+
     def enable_import(self):
         """
@@ -1160,10 +1167,10 @@
         else:
             self.perspective_cbox.Enable()
-            
+
     def enable_plot(self):
         """
         enable or disable plot button
         """
-        n_t = 0 
+        n_t = 0
         n_t_t = 0
         if self.tree_ctrl != None:
@@ -1176,10 +1183,10 @@
             self.bt_plot.Enable()
         self.enable_append()
-       
+
     def enable_append(self):
         """
         enable or disable append button
         """
-        n_t = 0 
+        n_t = 0
         n_t_t = 0
         if self.tree_ctrl != None:
@@ -1187,5 +1194,5 @@
         if self.tree_ctrl_theory != None:
             n_t_t = self.tree_ctrl_theory.GetCount()
-        if n_t + n_t_t <= 0: 
+        if n_t + n_t_t <= 0:
             self.bt_append_plot.Disable()
             self.cb_plotpanel.Disable()
@@ -1196,5 +1203,5 @@
             self.bt_append_plot.Enable()
             self.cb_plotpanel.Enable()
-            
+
     def check_theory_to_freeze(self):
         """
@@ -1214,5 +1221,5 @@
         else:
             self.bt_freeze.Disable()
-        
+
     def enable_selection(self):
         """
@@ -1229,8 +1236,8 @@
         else:
             self.selection_cbox.Disable()
-            
+
     def show_data_button(self):
         """
-        show load data and remove data button if 
+        show load data and remove data button if
         dataloader on else hide them
         """
@@ -1238,14 +1245,14 @@
             gui_style = self.parent.get_style()
             style = gui_style & GUIFRAME.DATALOADER_ON
-            if style == GUIFRAME.DATALOADER_ON: 
+            if style == GUIFRAME.DATALOADER_ON:
                 #self.bt_remove.Show(True)
-                self.bt_add.Show(True) 
+                self.bt_add.Show(True)
             else:
                 #self.bt_remove.Hide()
                 self.bt_add.Hide()
-        except: 
+        except:
             #self.bt_remove.Hide()
-            self.bt_add.Hide() 
-    
+            self.bt_add.Hide()
+
 
 
@@ -1264,5 +1271,5 @@
         self.list_of_ctrl = []
         if not data_list:
-            return 
+            return
         self._sizer_main = wx.BoxSizer(wx.VERTICAL)
         self._sizer_txt = wx.BoxSizer(wx.VERTICAL)
@@ -1273,5 +1280,5 @@
         self._panel.SetupScrolling()
         self.__do_layout(data_list, text=text)
-        
+
     def __do_layout(self, data_list, text=''):
         """
@@ -1279,7 +1286,7 @@
         """
         if not data_list or len(data_list) <= 1:
-            return 
+            return
         #add text
-        
+
         text = "Deleting these file reset some panels.\n"
         text += "Do you want to proceed?\n"
@@ -1315,8 +1322,8 @@
                                 wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
         static_line = wx.StaticLine(self, -1)
-        
+
         self._sizer_txt.Add(self._panel, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
         self._sizer_main.Add(self._sizer_txt, 1, wx.EXPAND|wx.ALL, 10)
-        #self._sizer_main.Add(self._data_text_ctrl, 0, 
+        #self._sizer_main.Add(self._data_text_ctrl, 0,
         #                     wx.EXPAND|wx.LEFT|wx.RIGHT, 10)
         self._sizer_main.Add(static_line, 0, wx.EXPAND, 0)
@@ -1324,5 +1331,5 @@
         self.SetSizer(self._sizer_main)
         self.Layout()
-        
+
     def get_data(self):
         """
@@ -1335,5 +1342,5 @@
                 temp.append(data)
         return temp
-               
+
 class DataFrame(wx.Frame):
     """
@@ -1347,5 +1354,5 @@
     #  tied to any perspective
     ALWAYS_ON = True
-    
+
     def __init__(self, parent=None, owner=None, manager=None, size=(300, 800),
                          list_of_perspective=[], list=[], *args, **kwds):
@@ -1357,8 +1364,8 @@
         self.owner = owner
         self._manager = manager
-        self.panel = DataPanel(parent=self, 
+        self.panel = DataPanel(parent=self,
                                manager=manager,
                                list_of_perspective=list_of_perspective)
-     
+
     def load_data_list(self, list=[]):
         """
@@ -1366,7 +1373,7 @@
         """
         self.panel.load_data_list(list=list)
-        
-   
-    
+
+
+
 from sas.sasgui.guiframe.dataFitting import Theory1D
 from sas.sasgui.guiframe.data_state import DataState
@@ -1383,5 +1390,5 @@
         self.msg += "name  value\n"
         return self.msg
-    
+
 def set_data_state(data=None, path=None, theory=None, state=None):
     """
@@ -1391,9 +1398,9 @@
     dstate.set_path(path=path)
     dstate.set_theory(theory, state)
-  
+
     return dstate
-    
+
 if __name__ == "__main__":
-    
+
     app = wx.App()
     try:
@@ -1477,6 +1484,4 @@
         #raise
         print "error", sys.exc_value
-        
-    app.MainLoop()  
-    
-    
+
+    app.MainLoop()
Index: src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
===================================================================
--- src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py	(revision 70308f6c0db5fd4e37863a2fff66dd448c954d56)
+++ src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py	(revision a674d0b7da37ed36693004d2d51e0941ed38842f)
@@ -170,68 +170,69 @@
         """
         """
-        message = ""
-        log_msg = ''
+        file_errors = {}
         output = {}
-        data_error = False
-        error_message = ""
+        exception_occurred = False
 
         for p_file in path:
-            file_error = False
-            info = "info"
             basename = os.path.basename(p_file)
             _, extension = os.path.splitext(basename)
             if extension.lower() in EXTENSIONS:
-                info = "error"
                 log_msg = "Data Loader cannot "
-                log_msg += "load: %s\n" % str(p_file)
-                log_msg += """Please try to open that file from "open project" """
-                log_msg += """or "open analysis" menu\n\n"""
-                error_message += log_msg
+                log_msg += "load: {}\n".format(str(p_file))
+                log_msg += "Please try to open that file from \"open project\""
+                log_msg += "or \"open analysis\" menu."
                 logging.info(log_msg)
+                file_errors[basename] = [log_msg]
                 continue
 
             try:
-                message = "Loading Data... " + str(p_file) + "\n"
-                self.load_update(output=output, message=message, info=info)
+                message = "Loading {}...\n".format(p_file)
+                self.load_update(output=output, message=message, info="info")
                 temp = self.loader.load(p_file, format)
-                if temp.__class__.__name__ == "list":
-                    for item in temp:
-                        output, error_message, data_error = \
-                            self._process_data_and_errors(item,
-                                                          p_file,
-                                                          output,
-                                                          error_message)
-                else:
+                if not isinstance(temp, list):
+                    temp = [temp]
+                for item in temp:
+                    error_message = ""
                     output, error_message, data_error = \
-                            self._process_data_and_errors(temp,
-                                                          p_file,
-                                                          output,
-                                                          error_message)
+                        self._process_data_and_errors(item,
+                                                      p_file,
+                                                      output,
+                                                      error_message)
+                    if data_error:
+                        if basename in file_errors.keys():
+                            file_errors[basename] += [error_message]
+                        else:
+                            file_errors[basename] = [error_message]
+                        self.load_update(output=output,
+                            message=error_message, info="warning")
+
+                self.load_update(output=output,
+                message="Loaded {}\n".format(p_file),
+                info="info")
+
             except:
                 logging.error(sys.exc_value)
-                file_error = True
-            if file_error:
-                error = "Error: " + str(sys.exc_info()[1])
-                error += " while loading file: %s" % str(basename)
-                error_message += "The data file you selected could not be loaded.\n"
+
+                error_message = "The Data file you selected could not be loaded.\n"
                 error_message += "Make sure the content of your file"
                 error_message += " is properly formatted.\n"
                 error_message += "When contacting the SasView team, mention the"
-                error_message += " following:\n%s\n\n" % str(error)
-                info = "error"
-            elif data_error:
-                base_message = "Errors occurred while loading "
-                base_message += "{0}\n".format(basename)
-                base_message += "The data file loaded but with errors.\n"
-                error_message = base_message + error_message
-                info = "error"
-
-        if error_message != "":
-            self.load_update(output=output, message=error_message, info=info)
-        else:
-            message = "Loading Data Complete! "
-        message += log_msg
-        self.load_complete(output=output, error_message=error_message,
-                           message=message, path=path, info='info')
+                error_message += " following:\n"
+                error_message += "Error: " + str(sys.exc_info()[1])
+                file_errors[basename] = [error_message]
+                self.load_update(output=output, message=error_message, info="warning")
+
+        if len(file_errors) > 0:
+            error_message = ""
+            for filename, error_array in file_errors.iteritems():
+                error_message += "The following errors occured whilst "
+                error_message += "loading {}:\n".format(filename)
+                for message in error_array:
+                    error_message += message + "\n"
+                error_message += "\n"
+            self.load_update(output=output, message=error_message, info="error")
+
+        self.load_complete(output=output, message="Loading data complete!",
+            info="info")
 
     def load_update(self, output=None, message="", info="warning"):
