Changeset 75fbd17 in sasview for prview/perspectives


Ignore:
Timestamp:
Feb 9, 2011 2:04:24 AM (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:
c83a5af
Parents:
8240eab
Message:

working on save state

Location:
prview/perspectives/pr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/inversion_state.py

    r3e41f43 r75fbd17  
    374374        ## CanSAS format flag 
    375375        self.cansas = cansas 
     376        self.state = None 
    376377         
    377378    def read(self, path): 
     
    404405         
    405406        # Call back to post the new state 
    406         self.call_back(state) 
     407        self.state = state 
     408        #self.call_back(state) 
    407409        return None 
    408410     
     411    def get_state(self): 
     412        return self.state 
    409413    def _parse_prstate(self, entry): 
    410414        """ 
     
    482486        elif len(output) == 1: 
    483487            # Call back to post the new state 
    484             self.call_back(output[0].meta_data['prstate'], datainfo = output[0]) 
     488            #self.call_back(output[0].meta_data['prstate'], datainfo = output[0]) 
     489            self.state = output[0].meta_data['prstate'] 
    485490            return output[0] 
    486491        else: 
  • prview/perspectives/pr/pr.py

    r6d3d5ff r75fbd17  
    121121        return self.current_plottable 
    122122     
    123     def set_state(self, state, datainfo=None): 
     123    def set_state(self, state=None, datainfo=None): 
    124124        """ 
    125125        Call-back method for the inversion state reader. 
     
    131131        """ 
    132132        try: 
    133             if datainfo is None: 
     133            if datainfo.__class__.__name__ == 'list': 
     134                if len(datainfo) == 1: 
     135                    data = datainfo[0] 
     136            if data is None: 
    134137                raise RuntimeError, "Pr.set_state: datainfo parameter cannot be None in standalone mode" 
    135  
     138            """ 
    136139            # Ensuring that plots are coordinated correctly 
    137             t = time.localtime(datainfo.meta_data['prstate'].timestamp) 
     140            t = time.localtime(data.meta_data['prstate'].timestamp) 
    138141            time_str = time.strftime("%b %d %H:%M", t) 
    139142             
    140143            # Check that no time stamp is already appended 
    141             max_char = datainfo.meta_data['prstate'].file.find("[") 
     144            max_char = data.meta_data['prstate'].file.find("[") 
    142145            if max_char < 0: 
    143                 max_char = len(datainfo.meta_data['prstate'].file) 
    144              
    145             datainfo.meta_data['prstate'].file = datainfo.meta_data['prstate'].file[0:max_char] +' [' + time_str + ']' 
    146             datainfo.filename = datainfo.meta_data['prstate'].file 
    147                  
    148             self.current_plottable = datainfo 
    149             self.current_plottable.group_id = datainfo.meta_data['prstate'].file 
     146                max_char = len(data.meta_data['prstate'].file) 
     147             
     148            data.meta_data['prstate'].file = data.meta_data['prstate'].file[0:max_char] +' [' + time_str + ']' 
     149            data.filename = data.meta_data['prstate'].file 
     150             """    
     151            self.current_plottable = data 
     152            # self.current_plottable.group_id = data.meta_data['prstate'].file 
     153             
     154            # Make sure the user sees the P(r) panel after loading 
     155            #self.parent.set_perspective(self.perspective)   
     156            self.on_perspective(event=None)    
    150157             
    151158            # Load the P(r) results 
     159            state = self.state_reader.get_state() 
     160            wx.PostEvent(self.parent, NewPlotEvent(plot=self.current_plottable, 
     161                                        title=self.current_plottable.title)) 
    152162            self.control_panel.set_state(state) 
    153                          
    154             # Make sure the user sees the P(r) panel after loading 
    155             self.parent.set_perspective(self.perspective)             
    156  
    157163        except: 
    158             logging.error("prview.set_state: %s" % sys.exc_value) 
     164            raise 
     165            #logging.error("prview.set_state: %s" % sys.exc_value) 
    159166 
    160167   
     
    391398        new_plot.title = "P(r) fit" 
    392399        # Make sure that the plot is linear 
    393         new_plot.xtransform="x" 
    394         new_plot.ytransform="y"                  
     400        new_plot.xtransform = "x" 
     401        new_plot.ytransform = "y"                  
    395402        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="P(r) fit")) 
    396403         
Note: See TracChangeset for help on using the changeset viewer.