Changeset 3658717e in sasview


Ignore:
Timestamp:
Mar 16, 2011 7:08:41 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:
20b482f
Parents:
d7f727d
Message:

working on delete file

Location:
guiframe
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_panel.py

    rd7f727d r3658717e  
    508508            item, _, _, _, _, _ = value 
    509509            if item.IsChecked(): 
    510                data_id, _, state_id = self.tree_ctrl.GetItemPyData(item)  
    511                data_to_plot.append(data_id) 
    512                if state_id not in state_to_plot: 
    513                    state_to_plot.append(state_id) 
     510                data_id, _, state_id = self.tree_ctrl.GetItemPyData(item) 
     511                data_to_plot.append(data_id) 
     512                if state_id not in state_to_plot: 
     513                    state_to_plot.append(state_id) 
     514            
    514515        for theory_dict in self.list_cb_theory.values(): 
    515516            for key, value in theory_dict.iteritems(): 
     
    535536    def on_remove(self, event): 
    536537        """ 
    537         remove data from application 
     538        Get a list of item checked and remove them from the treectrl 
     539        Ask the parent to remove reference to this item  
    538540        """ 
    539541        data_to_remove, theory_to_remove, _ = self.set_data_helper() 
    540542        data_key = [] 
    541543        theory_key = [] 
    542         for key, item in self.list_cb_data.iteritems(): 
     544        #remove  data from treectrl 
     545        for d_key, item in self.list_cb_data.iteritems(): 
    543546            data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = item 
    544547            if data_c.IsChecked(): 
    545548                self.tree_ctrl.Delete(data_c) 
    546                 data_key.append(key) 
    547                  
    548         for key, theory_dict in self.list_cb_theory.iteritems(): 
    549             for  value in theory_dict.values(): 
     549                data_key.append(d_key) 
     550                if d_key in self.list_cb_theory.keys(): 
     551                    theory_list_ctrl = self.list_cb_theory[d_key] 
     552                    theory_to_remove += theory_list_ctrl.keys() 
     553        # Remove theory from treectrl        
     554        for t_key, theory_dict in self.list_cb_theory.iteritems(): 
     555            for  key, value in theory_dict.iteritems(): 
    550556                item, _, _ = value 
    551557                if item.IsChecked(): 
    552558                    self.tree_ctrl.Delete(item) 
    553559                    theory_key.append(key) 
     560        #Remove data and related theory references 
    554561        for key in data_key: 
    555562            del self.list_cb_data[key] 
     563            if key in theory_key: 
     564                del self.list_cb_theory[key] 
     565        #remove theory  references independently of data 
    556566        for key in theory_key: 
    557             del self.list_cb_theory[key] 
     567            for t_key, theory_dict in self.list_cb_theory.iteritems(): 
     568                del theory_dict[key] 
     569             
    558570        self.parent.remove_data(data_id=data_to_remove, 
    559571                                  theory_id=theory_to_remove) 
  • guiframe/gui_manager.py

    rd7f727d r3658717e  
    13831383        else delete theory 
    13841384        """ 
     1385        for plug in self.plugins: 
     1386            plug.delete_data(data_id) 
     1387        total_plot_list = [] 
     1388        data_list, _ = self._data_manager.get_by_id(data_id) 
     1389        _, temp_list_theory = self._data_manager.get_by_id(theory_id) 
     1390        total_plot_list = data_list.values() 
     1391        for item in temp_list_theory.values(): 
     1392            theory_data, theory_state = item 
     1393            total_plot_list.append(theory_data) 
     1394        for new_plot in total_plot_list: 
     1395            id = new_plot.id 
     1396            for group_id in new_plot.list_group_id: 
     1397                wx.PostEvent(self, NewPlotEvent(id=id, 
     1398                                                   group_id=group_id, 
     1399                                                   action='remove')) 
    13851400        self._data_manager.delete_data(data_id=data_id,  
    13861401                                       theory_id=theory_id) 
    1387         for plug in self.plugins: 
    1388             plug.delete_data(data_id) 
    13891402             
    13901403         
  • guiframe/local_perspectives/plotting/plotting.py

    rdf22224 r3658717e  
    177177            raise ValueError, msg 
    178178        else: 
     179            if panel.group_id not in data.list_group_id: 
     180                data.list_group_id.append(panel.group_id) 
    179181            panel.plot_data( data) 
    180182            self.parent.show_panel(panel.uid)    
     
    240242                new_panel = self.create_2d_panel(data, group_id) 
    241243            self.create_panel_helper(new_panel, data, group_id, title) 
    242              
     244        print "_on_plot_event", data.list_group_id 
    243245        return 
    244246    
  • guiframe/plugin_base.py

    re88ebfd r3658717e  
    7070        return True 
    7171     
     72    def is_in_use(self, data_id): 
     73        """ 
     74        get a  data id and return true or false if the data  
     75        is currently in use the current plugin 
     76        """ 
     77        return False 
     78     
    7279    def delete_data(self, data_id): 
    7380        """ 
Note: See TracChangeset for help on using the changeset viewer.