Changeset 6f1f129 in sasview for prview/perspectives


Ignore:
Timestamp:
May 25, 2009 2:52:15 PM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
f68b14a
Parents:
5d98370
Message:

prview: allow to save/load a pr inversion state. removed the load button from the panel.

Location:
prview/perspectives/pr
Files:
1 added
1 edited

Legend:

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

    rff7acff r6f1f129  
    8585        self._default_Iq  = {} 
    8686         
     87        # Associate the inversion state reader with .prv files 
     88        from DataLoader.loader import Loader 
     89        from inversion_state import Reader 
     90          
     91        reader = Reader(self.set_state) 
     92        l = Loader() 
     93        l.associate_file_reader('.prv', reader) 
     94                 
    8795        # Log startup 
    8896        logging.info("Pr(r) plug-in started") 
    8997         
    90          
     98    def set_state(self, state): 
     99        """ 
     100            Call-back method for the inversion state reader. 
     101            This method is called when a .prv file is loaded. 
     102             
     103            @param state: InversionState object 
     104        """ 
     105        self.control_panel.set_state(state) 
     106        #print state 
    91107 
    92108    def populate_menu(self, id, owner): 
     
    332348         
    333349         
    334     def choose_file(self): 
     350    def choose_file(self, path=None): 
    335351        """ 
    336352         
    337353        """ 
    338354        #TODO: this should be in a common module 
    339         return self.parent.choose_file() 
     355        return self.parent.choose_file(path=path) 
    340356                 
    341357                 
     
    374390                wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    375391            else: 
     392                if dataread is None: 
     393                    return x, y, err 
    376394                raise RuntimeError, "This tool can only read 1D data" 
    377395         
     
    774792            try: 
    775793                pr = self._create_file_pr(path) 
     794                 
     795                # If the file contains nothing, just return 
     796                if pr is None: 
     797                    return 
     798                 
    776799                self.pr = pr 
    777800            except:   
     
    930953                wx.PostEvent(self.parent, StatusEvent(status='')) 
    931954                x, y, err = self.load(path) 
     955                 
     956                # If the file contains no data, just return 
     957                #TODO: clean this up: we need a way to recognize that not all P(r) files are data 
     958                if x is None: 
     959                    return None 
    932960             
    933961            # If we have not errors, add statistical errors 
Note: See TracChangeset for help on using the changeset viewer.