Changeset ee2b492 in sasview


Ignore:
Timestamp:
Mar 14, 2011 12:44:41 PM (13 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:
e6a93df
Parents:
e88ebfd
Message:

working on the freeze option

Location:
guiframe
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_manager.py

    re88ebfd ree2b492  
    186186        """ 
    187187        """ 
    188         new_data_state = [] 
     188        selected_theory = {} 
    189189        for d_id in data_id: 
    190190            if d_id in self.stored_data: 
     
    193193                for t_id in theory_id: 
    194194                    if t_id in theory_list.keys(): 
    195                         theory = theory_list[t_id] 
    196                         new_theory = copy.deepcopy(theory) 
     195                        theory_data, theory_state = theory_list[t_id] 
     196                        new_theory = copy.deepcopy(theory_data) 
    197197                        new_theory.id  = wx.NewId() 
    198                         data_state.append_theory(new_theory) 
    199                         theory_list.append(new_theory) 
    200                         new_data_state.append(data_state) 
     198                        selected_theory[new_theory.id] = DataState(new_theory) 
     199                        self.stored_data[new_theory.id] = selected_theory[new_theory.id] 
     200                    else: 
    201201                        msg = "Theory with ID %s " % str(theory_id) 
    202202                        msg += "couldn't not be frozen"  
    203203                        raise ValueError, msg 
    204         return new_data_state 
     204        return selected_theory 
    205205                     
    206206             
  • guiframe/data_panel.py

    re88ebfd ree2b492  
    5353        PanelBase.__init__(self) 
    5454        self.SetupScrolling() 
    55        
     55        self.all_data1d = True 
    5656        self.parent = parent 
    5757        self.manager = manager 
     
    286286        """ 
    287287        self.tree_ctrl = DataTreeCtrl(parent=self) 
    288         self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKED, self.on_check_item) 
     288        self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) 
    289289        self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_RIGHT_CLICK, self.on_right_click) 
    290290        label = wx.StaticText(self, -1, "LOADED DATA") 
     
    322322        self.PopupMenu(self.popUpMenu, pos)  
    323323       
     324   
    324325    def on_check_item(self, event): 
    325326        """ 
    326327        """ 
    327328        item = event.GetItem() 
    328         name = self.tree_ctrl.GetItemText(item) 
    329      
     329        item.Check(not item.IsChecked())  
     330        self.enable_button(item) 
     331        event.Skip() 
     332         
     333    def enable_button(self, item): 
     334        """ 
     335        """ 
     336        _, data_class, _= self.tree_ctrl.GetItemPyData(item)  
     337        if item.IsChecked(): 
     338            self.all_data1d &= (data_class != "Data2D") 
     339            if self.all_data1d: 
     340                self.bt_freeze.Enable() 
     341            else: 
     342                self.bt_freeze.Disable() 
     343        else: 
     344            self.all_data1d |= True 
     345            self.all_data1d &= (data_class != "Data2D") 
     346            if self.all_data1d: 
     347                self.bt_freeze.Enable() 
     348            else: 
     349                self.bt_freeze.Disable() 
     350                
    330351    def load_data_list(self, list): 
    331352        """ 
     
    356377                                     data=(data_id, data_class, state_id)) 
    357378                data_c.Check(True) 
     379                self.enable_button(data_c) 
    358380                d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 
    359381                i_c_c = self.tree_ctrl.AppendItem(d_i_c,  
     
    388410                                                      process.__str__()) 
    389411            self.append_theory(state_id, theory_list) 
    390                    
     412             
    391413    
    392414    def append_theory(self, state_id, theory_list): 
     
    420442                    theory_class = theory_data.__class__.__name__ 
    421443                    theory_id = theory_data.id 
    422                     if theory_state is not None: 
    423                         name = theory_state.model.name 
     444                    #if theory_state is not None: 
     445                    #    name = theory_state.model.name 
    424446                    temp = (theory_id, theory_class, state_id) 
    425447                if theory_id not in theory_list_ctrl: 
     
    435457                        i_t_c = self.tree_ctrl.AppendItem(t_p_c, 
    436458                                                          process.__str__()) 
     459                    t_child.Bind(wx.EVT_TREE_CHECK, self.check_item) 
    437460                    theory_list_ctrl[theory_id] = [t_child,  
    438461                                                   i_c_c,  
     
    458481                    theory_class = theory_data.__class__.__name__ 
    459482                    theory_id = theory_data.id 
    460                     if theory_state is not None: 
    461                         name = theory_state.model.name  
     483                    #if theory_state is not None: 
     484                    #    name = theory_state.model.name  
    462485                    temp = (theory_id, theory_class, state_id) 
    463486                    t_child = self.tree_ctrl.AppendItem(theory_child, 
     
    476499            self.list_cb_theory[data_id] = theory_list_ctrl 
    477500             
    478      
     501    
    479502    def set_data_helper(self): 
    480503        """ 
     
    563586        """ 
    564587        _, theory_id, state_id = self.set_data_helper() 
    565         self.parent.freeze(state_id=state_id, theory_id=theory_id) 
     588        self.parent.freeze(data_id=state_id, theory_id=theory_id) 
    566589         
    567590    def set_active_perspective(self, name): 
     
    648671        data_list = {} 
    649672        # state 1 
    650         data = Data1D() 
    651         data.name = "data1" 
     673        data = Data2D() 
     674        data.name = "data2" 
    652675        data.id = 1 
    653676        data.append_empty_process() 
    654677        process = data.process[len(data.process)-1] 
    655678        process.data = "07/01/2010" 
    656         theory = Theory1D() 
     679        theory = Data2D() 
    657680        theory.id = 34 
    658681        theory.name = "theory1" 
     
    661684        data_list['1']=set_data_state(data, path,theory, state) 
    662685        #state 2 
    663         data = Data1D() 
     686        data = Data2D() 
    664687        data.name = "data2" 
    665688        data.id = 76 
    666         theory = Theory1D() 
     689        theory = Data2D() 
    667690        theory.id = 78 
    668691        theory.name = "CoreShell 07/24/25" 
  • guiframe/gui_manager.py

    re88ebfd ree2b492  
    455455         
    456456        self._data_panel.load_data_list(list=data_state_list) 
    457         for data_state in data_state_list: 
    458             theory_list = data_state.get_theory() 
    459             for new_plot in theory_list: 
    460                 wx.PostEvent(self, NewplotEvent(plot=new_plot, 
     457        for data_state in data_state_list.values(): 
     458            new_plot = data_state.get_data() 
     459            wx.PostEvent(self, NewPlotEvent(plot=new_plot, 
    461460                                             title=new_plot.title)) 
    462461         
     
    13401339        for new_plot in data_list: 
    13411340            if append: 
    1342                 if self.panel_on_focus is None or \ 
    1343                     not self.enable_add_data(new_plot): 
     1341                if self.panel_on_focus is None: 
    13441342                    message = "cannot append plot. No plot panel on focus!" 
    13451343                    message += "please click on any available plot to set focus" 
     
    14681466        Enable append data on a plot panel 
    14691467        """ 
     1468        if self.panel_on_focus not in self._plotting_plugin.plot_panels.values(): 
     1469            return 
    14701470        is_theory = len(self.panel_on_focus.plots) <= 1 and \ 
    14711471            self.panel_on_focus.plots.values()[0].__class__.__name__ == "Theory1D" 
Note: See TracChangeset for help on using the changeset viewer.