Changeset 31b0c47 in sasview for sansview/perspectives


Ignore:
Timestamp:
May 24, 2010 5:50:10 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:
bb70474
Parents:
232c3db
Message:

working on save fit page state

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

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

    r784e2fa r31b0c47  
    170170        self.Update() 
    171171        self.Center() 
    172    
     172         
     173    def set_state(self, state): 
     174        """ 
     175            Restore state of the panel 
     176        """ 
     177        page_is_opened = False 
     178        if state is not None: 
     179            page_info = self.get_page_info(data=state.data) 
     180            for name, panel in self.opened_pages.values(): 
     181                #Don't return any panel is the exact same page is created 
     182                if name == page_info.window_name: 
     183                    # the page is still opened 
     184                    panel.reset_page(state=state) 
     185                    page_is_opened = True 
     186            if not page_is_opened: 
     187                panel = self.add_fit_page(data=state.data) 
     188                # add data associated to the page created 
     189                if panel is not None:   
     190                    self.manager.store_page(page=panel, data=state.data) 
     191                    panel.reset_page(state=state) 
     192                     
    173193    def on_close_page(self, event): 
    174194        """ 
  • sansview/perspectives/fitting/fitting.py

    r232c3db r31b0c47  
    617617        return new_data 
    618618            
     619    def store_page(self, page, data): 
     620        """ 
     621            Helper to save page reference into the plug-in 
     622            @param page: page to store 
     623        """ 
     624        page.set_data(data)  
     625        #create a fitproblem storing all link to data,model,page creation 
     626        if not page in self.page_finder.keys(): 
     627            self.page_finder[page] = FitProblem() 
     628        self.page_finder[page].add_fit_data(data) 
     629         
    619630    def add_fit_page(self, data): 
    620631        """ 
     
    626637            # add data associated to the page created 
    627638            if page != None:   
    628                 page.set_data(data)  
    629                 #create a fitproblem storing all link to data,model,page creation 
    630                 if not page in self.page_finder.keys(): 
    631                     self.page_finder[page]= FitProblem() 
    632                 ## item is almost the same as data but contains 
    633                 ## axis info for plotting  
    634                 #self.page_finder[page].add_plotted_data(item) 
    635                 self.page_finder[page].add_fit_data(data) 
    636  
     639                self.store_page(page=page, data=data) 
    637640                wx.PostEvent(self.parent, StatusEvent(status="Page Created", 
    638                                                                 info="info")) 
     641                                               info="info")) 
    639642            else: 
    640643                msg = "Page was already Created" 
     
    643646            msg = "Creating Fit page: %s"%sys.exc_value 
    644647            wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 
    645             return 
    646  
    647          
     648        
    648649    def _onEVT_SLICER_PANEL(self, event): 
    649650        """ 
Note: See TracChangeset for help on using the changeset viewer.