Changeset 8897d66 in sasview


Ignore:
Timestamp:
Aug 10, 2010 3:09:40 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:
3eb2811
Parents:
ac2dc0e
Message:

added ability to reset the panels when a new svs file is opened

Location:
sansview/perspectives/fitting
Files:
3 edited

Legend:

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

    rac2dc0e r8897d66  
    205205    def close_all(self): 
    206206        """ 
    207         remove all pages 
    208         """ 
    209         for index in range(self.GetPageCount()): 
    210             self.DeletePage(index) 
    211         self.model_list_box = {} 
     207        remove all pages, used when a svs file is opened 
     208        """ 
     209        #get number of pages 
     210        nop = self.GetPageCount() 
     211        #use while-loop, for-loop will not do the job well. 
     212        while (nop>0): 
     213            #delete the first page until no page exists 
     214            page = self.GetPage(0) 
     215            self._close_helper(selected_page=page) 
     216            self.DeletePage(0) 
     217            nop = nop - 1 
    212218        ## save the title of the last page tab added 
    213219        self.fit_page_name = {} 
  • sansview/perspectives/fitting/fitting.py

    ref16f59 r8897d66  
    261261        loader.associate_file_reader(".fitv", self.state_reader) 
    262262        loader.associate_file_reader(".svs", self.state_reader) 
     263        self.format = None 
    263264        #Send the fitting panel to guiframe 
    264265        self.mypanels.append(self.fit_panel) 
     
    294295        pass 
    295296     
    296     def set_state(self, state, datainfo=None): 
     297    def set_state(self, state, datainfo=None, format=None): 
    297298        """ 
    298299        Call-back method for the fit page state reader. 
    299         This method is called when a .fitv file is loaded. 
    300          
    301         :param state: PageState object 
    302          
     300        This method is called when a .fitv/.svs file is loaded. 
     301         
     302        : param state: PageState object 
     303        : param datainfo: data 
     304        : param format: file extension in lower case with dot in front 
    303305        """ 
    304306        # store fitting state in temp_state 
     
    306308        # index to start with for a new set_state 
    307309        self.state_index = 0 
     310        #file format (extension of the file) opened 
     311        self.format = format 
    308312 
    309313    def  on_set_state_helper(self,event=None): 
    310314        """ 
    311         Set_state_helper. This acutally sets state after plotting data from state file. 
     315        Set_state_helper. This actually sets state after plotting data from state file. 
    312316         
    313317        : event: FitStateUpdateEvent called by plot_data from guiframe, data_loader 
     
    316320            return 
    317321        try: 
     322            #close all panels only when svs file opened 
     323            if self.format == '.svs': 
     324                self.fit_panel.close_all() 
    318325            # Load fitting state 
    319326            state = self.temp_state[self.state_index] 
     
    329336                self.parent.set_perspective(self.perspective)  
    330337        except: 
    331             self.temp_state = []  
     338            self.temp_state = [] 
     339            self.format = None  
    332340            raise 
    333341                  
  • sansview/perspectives/fitting/pagestate.py

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