Changeset 9b18735 in sasview for sansview/perspectives


Ignore:
Timestamp:
Aug 11, 2010 5:35:03 PM (14 years ago)
Author:
Jae Cho <jhjcho@…>
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:
b63dc6e
Parents:
3eb2811
Message:

now all panels are reset when opening svs files: except prview

Location:
sansview/perspectives/fitting
Files:
3 edited

Legend:

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

    r8897d66 r9b18735  
    187187        self.Bind(basepage.EVT_NEXT_STATE, self._onRedo) 
    188188         
    189         #add default page 
    190         from hint_fitpage import HintFitPage 
    191         self.hint_page = HintFitPage(self)  
    192         self.AddPage(page=self.hint_page, caption="Hint") 
    193          
    194          
    195              
    196         #Add the first fit page 
    197         self.add_empty_page() 
     189        #add default pages 
     190        self.add_default_pages() 
    198191         
    199192        # increment number for model name 
     
    203196        self.Center() 
    204197         
     198    def add_default_pages(self): 
     199        """ 
     200        Add default pages such as a hint page and an empty fit page 
     201        """ 
     202        #add default page 
     203        from hint_fitpage import HintFitPage 
     204        self.hint_page = HintFitPage(self)  
     205        self.AddPage(page=self.hint_page, caption="Hint") 
     206          
     207        #Add the first fit page 
     208        self.add_empty_page() 
     209 
     210     
    205211    def close_all(self): 
    206212        """ 
     
    241247                    panel.reset_page(state=state) 
    242248                     
     249    def clear_panel(self, format='.svs'): 
     250        """ 
     251        Clear and close all panels, used by guimanager 
     252        """ 
     253        if format == '.svs': 
     254            #close all panels only when svs file opened 
     255            self.close_all() 
     256            self.manager.mypanels = [] 
     257                        
    243258    def on_close_page(self, event=None): 
    244259        """ 
     
    438453            panel = self.add_page(page_info=page_info) 
    439454            return panel 
    440      
     455         
    441456    def  _onGetstate(self, event): 
    442457        """ 
  • sansview/perspectives/fitting/fitting.py

    r3eb2811 r9b18735  
    261261        loader.associate_file_reader(".fitv", self.state_reader) 
    262262        loader.associate_file_reader(".svs", self.state_reader) 
    263         self.format = None 
     263 
    264264        #Send the fitting panel to guiframe 
    265265        self.mypanels.append(self.fit_panel) 
     
    295295        pass 
    296296     
    297     def set_state(self, state, datainfo=None, format=None): 
     297    def set_state(self, state, datainfo=None): 
    298298        """ 
    299299        Call-back method for the fit page state reader. 
     
    302302        : param state: PageState object 
    303303        : param datainfo: data 
    304         : param format: file extension in lower case with dot in front 
    305304        """ 
    306305        # store fitting state in temp_state 
     
    308307        # index to start with for a new set_state 
    309308        self.state_index = 0 
    310         #file format (extension of the file) opened 
    311         self.format = format 
    312309 
    313310    def  on_set_state_helper(self,event=None): 
     
    315312        Set_state_helper. This actually sets state after plotting data from state file. 
    316313         
    317         : event: FitStateUpdateEvent called by plot_data from guiframe, data_loader 
     314        : event: FitStateUpdateEvent called by dataloader.plot_data from guiframe 
    318315        """ 
    319316        if self.temp_state == None or len(self.temp_state) == 0: 
     317            if self.state_index==0 and len(self.mypanels) <= 0: 
     318                self.fit_panel.add_default_pages() 
    320319            return 
    321320         
    322321        try: 
    323             #close all panels only when svs file opened 
    324             if self.format == '.svs': 
    325                 self.fit_panel.close_all() 
    326322            # Load fitting state 
    327323            state = self.temp_state[self.state_index] 
     
    333329                #just set data because set_state won't work 
    334330                page_info = self.fit_panel.get_page_info(data=state.data) 
    335                 self.fit_panel.add_page(page_info) 
     331                panel = self.fit_panel.add_page(page_info) 
     332                self.store_page(page=panel, data=state.data) 
    336333                 
    337             # get ready for the next set state 
     334            # get ready for the next set_state 
    338335            self.state_index += 1 
    339              
     336 
    340337            #reset state variables to default when all set_state is finished.  
    341338            if len(self.temp_state) == self.state_index: 
     339                 
    342340                self.temp_state = [] 
    343341                # Make sure the user sees the fitting panel after loading 
     
    345343        except: 
    346344            self.temp_state = [] 
    347             self.format = None  
    348345            raise 
    349346                  
  • sansview/perspectives/fitting/pagestate.py

    r8897d66 r9b18735  
    11581158                    state.data.group_id = name 
    11591159                    #store state in fitting 
    1160                     self.call_back(state=state, datainfo=output[ind], format=extension.lower()) 
     1160                    self.call_back(state=state, datainfo=output[ind]) 
    11611161                     
    11621162                return output 
Note: See TracChangeset for help on using the changeset viewer.