Changeset e88ebfd in sasview for guiframe/data_panel.py


Ignore:
Timestamp:
Mar 11, 2011 4:39:00 PM (14 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:
ee2b492
Parents:
14cd91b1
Message:

working on guiframe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_panel.py

    rae83ad3 re88ebfd  
    410410 
    411411            for theory_id, item in theory_list.iteritems(): 
    412                 theory_data, _ = item 
     412                theory_data, theory_state = item 
    413413                if theory_data is None: 
    414414                    name = "Unknown" 
     
    420420                    theory_class = theory_data.__class__.__name__ 
    421421                    theory_id = theory_data.id 
     422                    if theory_state is not None: 
     423                        name = theory_state.model.name 
    422424                    temp = (theory_id, theory_class, state_id) 
    423425                if theory_id not in theory_list_ctrl: 
     
    451453            theory_list_ctrl = {} 
    452454            for theory_id, item in theory_list.iteritems(): 
    453                 theory_data, _ = item 
     455                theory_data, theory_state = item 
    454456                if theory_data is not None: 
     457                    name = theory_data.name 
    455458                    theory_class = theory_data.__class__.__name__ 
    456                      
     459                    theory_id = theory_data.id 
     460                    if theory_state is not None: 
     461                        name = theory_state.model.name  
     462                    temp = (theory_id, theory_class, state_id) 
    457463                    t_child = self.tree_ctrl.AppendItem(theory_child, 
    458                             theory_data.name, ct_type=1,  
     464                            name, ct_type=1,  
    459465                            data=(theory_data.id, theory_class, state_id)) 
    460466                    t_i_c = self.tree_ctrl.AppendItem(t_child, 'Info') 
     
    475481        """ 
    476482        data_to_plot = [] 
     483        state_to_plot = [] 
     484        theory_to_plot = [] 
    477485        for value in self.list_cb_data.values(): 
    478486            item, _, _, _, _, _ = value 
    479487            if item.IsChecked(): 
    480                data_id, _, _ = self.tree_ctrl.GetItemPyData(item)  
     488               data_id, _, state_id = self.tree_ctrl.GetItemPyData(item)  
    481489               data_to_plot.append(data_id) 
    482         theory_to_plot = [] 
     490               if state_id not in state_to_plot: 
     491                   state_to_plot.append(state_id) 
    483492        for theory_dict in self.list_cb_theory.values(): 
    484493            for key, value in theory_dict.iteritems(): 
    485494                item, _, _ = value 
    486495                if item.IsChecked(): 
    487                     theory_id, _, _ = self.tree_ctrl.GetItemPyData(item) 
     496                    theory_id, _, state_id = self.tree_ctrl.GetItemPyData(item) 
    488497                    theory_to_plot.append(theory_id) 
    489         return data_to_plot, theory_to_plot 
     498                    if state_id not in state_to_plot: 
     499                        state_to_plot.append(state_id) 
     500        return data_to_plot, theory_to_plot, state_to_plot 
    490501     
    491502    def remove_by_id(self, id): 
     
    524535        Get all select data and set them to the current active perspetive 
    525536        """ 
    526         self.post_helper(plot=False) 
    527         
     537        data_id, theory_id, state_id = self.set_data_helper() 
     538        self.parent.set_data(data_id) 
     539        self.parent.set_data(state_id=state_id, theory_id=theory_id) 
     540         
    528541    def on_append_plot(self, event=None): 
    529542        """ 
    530543        append plot to plot panel on focus 
    531544        """ 
    532         self.post_helper(plot=True, append=True) 
     545        data_id, theory_id, state_id = self.set_data_helper() 
     546        self.parent.plot_data(data_id=data_id,   
     547                              state_id=state_id, 
     548                              theory_id=theory_id, 
     549                              append=True) 
    533550    
    534551    def on_plot(self, event=None): 
     
    536553        Send a list of data names to plot 
    537554        """ 
    538         self.post_helper(plot=True) 
     555        data_id, theory_id, state_id = self.set_data_helper() 
     556        self.parent.plot_data(data_id=data_id,   
     557                              state_id=state_id, 
     558                              theory_id=theory_id, 
     559                              append=False) 
    539560        
    540561    def on_freeze(self, event): 
    541562        """ 
    542563        """ 
    543         data_to_plot, theory_to_plot = self.set_data_helper() 
    544         self.parent.freeze(data_id=data_to_plot, theory_id=theory_to_plot) 
     564        _, theory_id, state_id = self.set_data_helper() 
     565        self.parent.freeze(state_id=state_id, theory_id=theory_id) 
    545566         
    546567    def set_active_perspective(self, name): 
     
    555576        """ 
    556577        self.tctrl_plotpanel.SetLabel(str(name)) 
    557          
    558     def post_helper(self, plot=False, append=False): 
    559         """ 
    560         """ 
    561         data_to_plot, theory_to_plot = self.set_data_helper() 
    562         if self.parent is not None: 
    563             self.parent.get_data_from_panel(data_id=data_to_plot, plot=plot, 
    564                                             append=append) 
    565              
     578  
    566579     
    567580 
Note: See TracChangeset for help on using the changeset viewer.