Changeset f83b94a in sasview


Ignore:
Timestamp:
May 24, 2010 5:33:44 PM (15 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:
7f69d4d
Parents:
5536035
Message:

working on save state

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/basepage.py

    r9c38ed4 rf83b94a  
    21432143        sizer_save.Add(self.btSave_title)   
    21442144        sizer_save.Add((20,20),0, wx.LEFT|wx.RIGHT|wx.EXPAND,80)   
    2145               
    21462145        sizer_save.Add(self.btSave)      
    2147          
    21482146        boxsizer1.Add(sizer_save) 
    21492147        self.sizer6.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) 
  • sansview/perspectives/fitting/fitting.py

    r5536035 rf83b94a  
    1919from copy import deepcopy 
    2020 
     21import models 
     22import fitpage 
     23 
    2124from DataLoader import Loader 
    2225 
     
    3639from fitpanel import FitPanel 
    3740from fit_thread import FitThread 
    38 import models 
    39 import fitpage 
     41from pagestate import Reader 
    4042 
    4143DEFAULT_BEAM = 0.005 
     
    7678        self.perspective = [] 
    7779        #list of panel to send to guiframe 
    78         self.mypanels=[] 
     80        self.mypanels = [] 
    7981        # reference to the current running thread 
    80         self.calc_2D= None 
    81         self.calc_1D= None 
    82         self.calc_fit= None 
     82        self.calc_2D = None 
     83        self.calc_1D = None 
     84        self.calc_fit = None 
    8385         
    8486        # Start with a good default 
     
    8991        self.fitproblem_count = None 
    9092        #Flag to let the plug-in know that it is running stand alone 
    91         self.standalone=True 
     93        self.standalone = True 
    9294        ## dictionary of page closed and id  
    93         self.closed_page_dict ={} 
     95        self.closed_page_dict = {} 
    9496        ## Fit engine 
    9597        self._fit_engine = 'scipy' 
    9698        #List of selected data 
    97         self.selected_data_list=[] 
     99        self.selected_data_list = [] 
    98100        ## list of slicer panel created to display slicer parameters and results 
    99         self.slicer_panels=[] 
    100         # Log startup 
    101         logging.info("Fitting plug-in started")    
     101        self.slicer_panels = [] 
    102102        # model 2D view 
    103         self.model2D_id=None 
     103        self.model2D_id = None 
    104104        #keep reference of the simultaneous fit page 
    105         self.sim_page=None 
     105        self.sim_page = None 
    106106        #dictionary containing data name and error on dy of that data  
    107107        self.err_dy = {} 
    108         self.theory_data = None       
    109     
     108        self.theory_data = None   
     109        #Create a reader for fit page's state 
     110        self.state_reader = Reader(self.set_state)    
     111        #append that reader to list of available reader  
     112        loader = Loader() 
     113        loader.associate_file_reader(".fitv", self.state_reader) 
     114        # Log startup 
     115        logging.info("Fitting plug-in started")  
    110116         
    111117    def populate_menu(self, id, owner): 
     
    275281            Post initialization call back to close the loose ends 
    276282        """ 
    277         # Do not show the fitting perspective immediately and  
    278         # let the application show the Welcome Page. 
    279         #self.parent.set_perspective(self.perspective) 
    280283        pass 
    281  
     284     
     285    def set_state(self, state, datainfo=None): 
     286        """ 
     287            Call-back method for the fit page state reader. 
     288            This method is called when a .fitv file is loaded. 
     289            @param state: PageState object 
     290        """ 
     291        try:  
     292            # Load fitting state 
     293            page = self.fit_panel.set_state(state)    
     294            # Make sure the user sees the fitting panel after loading 
     295            self.parent.set_perspective(self.perspective)    
     296                    
     297        except: 
     298            raise 
     299         
     300    def save_fit_state(self, filepath, fitstate):   
     301        """ 
     302            save fit page state into file 
     303        """ 
     304        self.state_reader.write(filename=filepath, fitstate=fitstate) 
     305         
    282306    def copy_data(self, item, dy=None): 
    283307        """ 
Note: See TracChangeset for help on using the changeset viewer.