Index: guiframe/data_panel.py
===================================================================
--- guiframe/data_panel.py	(revision f72b14376bf2c49b38b1506c8877078303f4d4bc)
+++ guiframe/data_panel.py	(revision 61ffd1e13d7f1eb5c11da1dc8b3ba6dd8305b32a)
@@ -106,4 +106,6 @@
         self.list_cb_data = {}
         self.list_cb_theory = {}
+        self.tree_ctrl = None
+        self.tree_ctrl_theory = None
         
         self.owner = None
@@ -161,4 +163,6 @@
         self.sizer5.AddMany([(select_txt,0, wx.ALL,5),
                             (self.selection_cbox,0, wx.ALL,5)])
+        self.enable_selection()
+        
     def layout_perspective(self, list_of_perspective=[]):
         """
@@ -420,66 +424,59 @@
         add need data with its theory under the tree
         """
-        if not list:
-            self.enable_remove()
-            self.enable_import()
-            self.enable_plot()
-            self.enable_freeze()
-            return
-        # uncheck previous items
-        #self._uncheck_all()    
-           
-        for state_id, dstate in list.iteritems():
-            data = dstate.get_data()
-            theory_list = dstate.get_theory()
-            if data is not None:
-                data_name = data.name
-                data_class = data.__class__.__name__
-                path = dstate.get_path() 
-                process_list = data.process
-                data_id = data.id
-                
-                if state_id not in self.list_cb_data:
-                    #new state
-                    data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0,
-                                                       data_name, ct_type=1, 
-                                         data=(data_id, data_class, state_id))
-                    data_c.Check(True)
-                    self.enable_button(data_c)
-                    d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info')
-                    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' % str(path))
-                    d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process')
+        if list:
+            for state_id, dstate in list.iteritems():
+                data = dstate.get_data()
+                theory_list = dstate.get_theory()
+                if data is not None:
+                    data_name = data.name
+                    data_class = data.__class__.__name__
+                    path = dstate.get_path() 
+                    process_list = data.process
+                    data_id = data.id
                     
-                    for process in process_list:
-                        i_t_c = self.tree_ctrl.AppendItem(d_p_c,
-                                                          process.__str__())
-                    theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES")
-                   
-                    self.list_cb_data[state_id] = [data_c, 
-                                                   d_i_c,
-                                                   i_c_c,
-                                                    p_c_c,
-                                                     d_p_c,
-                                                     theory_child]
-                else:
-                    data_ctrl_list =  self.list_cb_data[state_id]
-                    #This state is already display replace it contains
-                    data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list
-                    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, 'Type: %s' % data_class)
-                    self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 
-                    self.tree_ctrl.DeleteChildren(d_p_c) 
-                    for process in process_list:
-                        i_t_c = self.tree_ctrl.AppendItem(d_p_c,
-                                                          process.__str__())
-            self.append_theory(state_id, theory_list)
+                    if state_id not in self.list_cb_data:
+                        #new state
+                        data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0,
+                                                           data_name, ct_type=1, 
+                                             data=(data_id, data_class, state_id))
+                        data_c.Check(True)
+                        self.enable_button(data_c)
+                        d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info')
+                        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' % str(path))
+                        d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process')
+                        
+                        for process in process_list:
+                            i_t_c = self.tree_ctrl.AppendItem(d_p_c,
+                                                              process.__str__())
+                        theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES")
+                       
+                        self.list_cb_data[state_id] = [data_c, 
+                                                       d_i_c,
+                                                       i_c_c,
+                                                        p_c_c,
+                                                         d_p_c,
+                                                         theory_child]
+                    else:
+                        data_ctrl_list =  self.list_cb_data[state_id]
+                        #This state is already display replace it contains
+                        data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list
+                        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, 'Type: %s' % data_class)
+                        self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 
+                        self.tree_ctrl.DeleteChildren(d_p_c) 
+                        for process in process_list:
+                            i_t_c = self.tree_ctrl.AppendItem(d_p_c,
+                                                              process.__str__())
+                self.append_theory(state_id, theory_list)
         self.enable_remove()
         self.enable_import()
         self.enable_plot()
         self.enable_freeze()
+        self.enable_selection()
         
     def _uncheck_all(self):
@@ -883,5 +880,8 @@
         enable or disable send button
         """
-        if self.tctrl_perspective.GetLabelText() == "No Active Application":
+        n_t = 0
+        if self.tree_ctrl != None:
+            n_t = self.tree_ctrl.GetCount()
+        if n_t <=0  or self.tctrl_perspective.GetLabelText() == "No Active Application":
             self.bt_import.Disable()
         else:
@@ -912,5 +912,8 @@
         enable or disable the freeze button
         """
-        n_t_t = self.tree_ctrl_theory.GetCount()
+        n_t_t = 0
+        n_l = 0
+        if self.tree_ctrl_theory != None:
+            n_t_t = self.tree_ctrl_theory.GetCount()
         n_l = len(self.list_cb_theory)
         if (n_t_t <= 0) and (n_l <= 0):
@@ -919,5 +922,20 @@
             self.bt_freeze.Enable()
         
-        
+    def enable_selection(self):
+        """
+        enable or disable combobo box selection
+        """
+        n_t = 0
+        n_t_t = 0
+        if self.tree_ctrl != None:
+            n_t = self.tree_ctrl.GetCount()
+        if self.tree_ctrl_theory != None:
+            n_t_t = self.tree_ctrl_theory.GetCount()
+        if n_t + n_t_t > 0 and self.selection_cbox != None:
+            self.selection_cbox.Enable()
+        else:
+            self.selection_cbox.Disable()
+            
+            
         
 class DataFrame(wx.Frame):
