Changeset c8deee5 in sasview for sansview/perspectives


Ignore:
Timestamp:
Feb 2, 2011 5:53:14 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:
35f2f49
Parents:
6d3d5ff
Message:

working on save state fitting

Location:
sansview/perspectives/fitting
Files:
3 edited

Legend:

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

    r3f6508f rc8deee5  
    356356        self.state.event_owner = owner 
    357357         
     358    def get_state(self): 
     359        """ 
     360        """ 
     361        return self.state 
    358362    def get_data(self): 
    359363        """ 
  • sansview/perspectives/fitting/fitpanel.py

    r340c2b3 rc8deee5  
    137137        self.data = data 
    138138        self.model= model 
    139         self.manager= manager 
     139        self._manager= manager 
    140140        self.event_owner= event_owner 
    141141        self.model_list_box = model_list_box 
     
    169169        PanelBase.__init__(self) 
    170170     
    171         self.manager = None 
     171        self._manager = None 
    172172        self.parent = parent 
    173173        self.event_owner = None 
     
    198198        self.Center() 
    199199         
     200    def get_data(self): 
     201        """ 
     202        get the data in the current page 
     203        """ 
     204        pos = self.GetSelection() 
     205        selected_page = self.GetPage(pos) 
     206        return selected_page.get_data() 
     207     
     208    def get_state(self): 
     209        """ 
     210         return the state of the current selected page 
     211        """ 
     212        pos = self.GetSelection() 
     213        selected_page = self.GetPage(pos) 
     214        return selected_page.get_state() 
     215     
    200216    def add_default_pages(self): 
    201217        """ 
     
    247263                # add data associated to the page created 
    248264                if panel is not None:   
    249                     self.manager.store_page(page=panel, data=state.data) 
     265                    self._manager.store_page(page=panel, data=state.data) 
    250266                    panel.reset_page(state=state) 
    251267                    panel.save_current_state() 
     
    258274            #close all panels only when svs file opened 
    259275            self.close_all() 
    260             self.manager.mypanels = [] 
     276            self._manager.mypanels = [] 
    261277                        
    262278    def on_close_page(self, event=None): 
     
    299315         
    300316        """ 
    301         self.manager = manager 
     317        self._manager = manager 
    302318 
    303319         
     
    332348        """ 
    333349        from simfitpage import SimultaneousFitPage 
    334         page_finder= self.manager.get_page_finder() 
     350        page_finder= self._manager.get_page_finder() 
    335351        self.sim_page = SimultaneousFitPage(self,page_finder=page_finder, id=-1) 
    336352         
    337353        self.AddPage(self.sim_page,caption="Simultaneous Fit",select=True) 
    338         self.sim_page.set_manager(self.manager) 
     354        self.sim_page.set_manager(self._manager) 
    339355        return self.sim_page 
    340356         
     
    358374        page_info = PageInfo(data=data, name=name) 
    359375        page_info.event_owner = self.event_owner  
    360         page_info.manager = self.manager 
     376        page_info.manager = self._manager 
    361377        page_info.window_name = name 
    362378        page_info.window_caption = name 
     
    371387        from fitpage import FitPage 
    372388        panel = FitPage(parent=self, page_info=page_info) 
     389        panel.set_manager(self._manager) 
    373390        self.AddPage(page=panel, caption=page_info.window_name, select=True) 
    374391        self.opened_pages[page_info.type] = [page_info.window_name, panel] 
     
    381398        from fitpage import FitPage 
    382399        panel = FitPage(parent=self, page_info=page_info) 
     400        panel.set_manager(self._manager) 
    383401        self.AddPage(page=panel, caption=page_info.window_name, select=True) 
    384402        index = self.GetPageIndex(panel) 
     
    440458                #delete the previous theory page and add a new one 
    441459                name, panel = self.opened_pages[type] 
    442                 #self.manager.reset_plot_panel(panel.get_data()) 
     460                #self._manager.reset_plot_panel(panel.get_data()) 
    443461                #delete the existing page and replace it 
    444462                index = self.GetPageIndex(panel) 
     
    503521        ## removing sim_page 
    504522        if selected_page == self.sim_page : 
    505             self.manager.sim_page=None  
     523            self._manager.sim_page=None  
    506524            return 
    507525         
     
    509527        state = selected_page.createMemento() 
    510528        page_name = selected_page.window_name 
    511         page_finder = self.manager.get_page_finder()  
     529        page_finder = self._manager.get_page_finder()  
    512530        fitproblem = None 
    513531        ## removing fit page 
     
    524542                if flag and selected_page.window_name == name: 
    525543                    if type.lower() in ['theory1d', 'theory2d']: 
    526                         self.manager.remove_plot(selected_page, theory=True) 
     544                        self._manager.remove_plot(selected_page, theory=True) 
    527545                    else: 
    528                         self.manager.remove_plot(selected_page, theory=False) 
     546                        self._manager.remove_plot(selected_page, theory=False) 
    529547                    break  
    530548            del page_finder[selected_page] 
  • sansview/perspectives/fitting/fitting.py

    rcab076b rc8deee5  
    112112        #Create a reader for fit page's state 
    113113        self.state_reader = None  
     114        self._extensions = '.fitv' 
    114115        self.temp_state = [] 
    115116        self.state_index = 0 
     
    246247        #Create reader when fitting panel are created 
    247248        self.state_reader = Reader(self.set_state)    
     249        
    248250        #append that reader to list of available reader  
    249251        loader = Loader() 
     
    281283            wx.PostEvent(self.parent, NewPlotEvent(plot=data,  
    282284                                                   title=str(data.title))) 
     285    
    283286             
    284287    def set_state(self, state=None, datainfo=None, format=None): 
     
    300303        self.sfile_ext = format 
    301304 
    302     def  on_set_state_helper(self,event=None): 
     305    def on_set_state_helper(self,event=None): 
    303306        """ 
    304307        Set_state_helper. This actually sets state after plotting data from state file. 
Note: See TracChangeset for help on using the changeset viewer.