Changeset 3c44c66 in sasview for sansview/perspectives


Ignore:
Timestamp:
Jul 20, 2010 2:36:35 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:
cb19af9f
Parents:
1b17a64
Message:

working on guiframe

Location:
sansview/perspectives/fitting
Files:
4 edited

Legend:

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

    re3d1423 r3c44c66  
    4444        #Set window's font size  
    4545        self.SetWindowVariant(variant=FONT_VARIANT) 
     46        
    4647        ## parent of the page 
    4748        self.parent = parent 
     
    160161        ## layout 
    161162        self.set_layout() 
    162         
     163         
    163164    class ModelTextCtrl(wx.TextCtrl): 
    164165        """ 
     
    233234        def _silent_kill_focus(self,event): 
    234235            """ 
    235             do nothing to kill focus 
     236            Save the state of the page 
    236237            """ 
     238             
    237239            event.Skip() 
    238240            pass 
     
    803805        self._copy_parameters_state(self.fittable_param, self.state.fittable_param) 
    804806        self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 
    805      
    806  
     807        #save chisqr 
     808        self.state.tcChi = self.tcChi.GetValue() 
     809         
    807810    def save_current_state_fit(self): 
    808811        """ 
     
    10081011        ## draw the model with previous parameters value 
    10091012        self._onparamEnter_helper() 
     1013        #reset the value of chisqr when not consistent with the value computed 
     1014        self.tcChi.SetValue(str(self.state.tcChi)) 
    10101015        ## reset context menu items 
    10111016        self._reset_context_menu() 
     1017         
    10121018        ## set the value of the current state to the state given as parameter 
    10131019        self.state = state.clone()  
  • sansview/perspectives/fitting/fitpage.py

    r0b12abb5 r3c44c66  
    19361936            self.tcChi.SetValue(str(format_number(output))) 
    19371937 
    1938             self.state.tcChi =self.tcChi 
     1938            self.state.tcChi = self.tcChi.GetValue() 
    19391939        except: 
    19401940            pass   
  • sansview/perspectives/fitting/fitpanel.py

    r0b12abb5 r3c44c66  
    200200        self.Center() 
    201201         
     202    def set_data(self, list=[]): 
     203        """ 
     204        Receive a list of data and create new  
     205        """ 
     206        if list==[]: 
     207            msg = "Please select data for Fitting perspective.\n" 
     208            dial = wx.MessageDialog(None, msg, 'Error Loading File',  
     209                                    wx.OK | wx.ICON_EXCLAMATION) 
     210            dial.ShowModal()  
     211            return  
     212        for data, path in list: 
     213            self.manager.add_fit_page(data=data) 
     214             
    202215    def set_state(self, state): 
    203216        """ 
     
    415428                return panel  
    416429            else: 
    417                 for name, panel in self.opened_pages.values(): 
    418                     #Don't return any panel is the exact same page is created 
    419                     if name == page_info.window_name: 
     430                for value in self.opened_pages.values(): 
     431                    if page_info.window_name == str(value[0]): 
     432                        #Don't return any panel is the exact same page is created 
    420433                        return None 
    421                     else: 
    422                         panel = self.add_page(page_info=page_info) 
    423                         return panel         
     434                panel = self.add_page(page_info=page_info) 
     435                return panel         
    424436        else: 
    425437            #a new type of page is created 
  • sansview/perspectives/fitting/pagestate.py

    r3ad91de r3c44c66  
    362362        rep += "model  : %s\n\n"% str(self.model) 
    363363        rep += "number parameters(self.parameters): %s\n"%len(self.parameters) 
    364         rep += self._repr_helper( list=self.parameters, rep=rep) 
     364        rep = self._repr_helper( list=self.parameters, rep=rep) 
    365365        rep += "number orientation parameters" 
    366366        rep += "(self.orientation_params): %s\n"%len(self.orientation_params) 
    367         rep += self._repr_helper( list=self.orientation_params, rep=rep) 
     367        rep = self._repr_helper( list=self.orientation_params, rep=rep) 
    368368        rep += "number dispersity parameters" 
    369369        rep += "(self.orientation_params_disp): %s\n"%len(self.orientation_params_disp) 
    370         rep += self._repr_helper( list=self.orientation_params_disp, rep=rep) 
     370        rep = self._repr_helper( list=self.orientation_params_disp, rep=rep) 
    371371         
    372372        return rep 
     
    11381138                output[0].filename = state.file 
    11391139                state.data = output[0] 
    1140                 state.data.name = state.data_name 
     1140                state.data.name = output[0].filename #state.data_name 
    11411141                state.data.id = state.data_id 
    11421142                state.data.id = state.data_id 
     
    11821182            fitstate.toXML(file=filename) 
    11831183         
    1184 """      
    1185 Example: :: 
     1184 
    11861185   
    1187     if __name__ == "__main__": 
    1188         state = PageState(parent=None) 
    1189         state.toXML() 
    1190         print "state", state 
     1186if __name__ == "__main__": 
     1187    state = PageState(parent=None) 
     1188    #state.toXML() 
     1189    """ 
    11911190     
    1192 """ 
     1191    file = open("test_state", "w") 
     1192    pickle.dump(state, file) 
     1193    print pickle.dumps(state) 
     1194    state.data_name = "hello---->" 
     1195    pickle.dump(state, file) 
     1196    file = open("test_state", "r") 
     1197    new_state= pickle.load(file) 
     1198    print "new state", new_state 
     1199    new_state= pickle.load(file) 
     1200    print "new state", new_state 
     1201    #print "state", state 
     1202    """ 
     1203    import bsddb 
     1204    import pickle 
     1205    db= bsddb.btopen('file_state.db', 'c') 
     1206    val = (pickle.dumps(state), "hello", "hi") 
     1207    db['state1']= pickle.dumps(val) 
     1208    print pickle.loads(db['state1']) 
     1209    state.data_name = "hello---->22" 
     1210    db['state2']= pickle.dumps(state) 
     1211    state.data_name = "hello---->2" 
     1212    db['state3']= pickle.dumps(state) 
     1213    del db['state3'] 
     1214    state.data_name = "hello---->3" 
     1215    db['state4']= pickle.dumps(state) 
     1216    new_state = pickle.loads(db['state1']) 
     1217    #print db.last() 
     1218    db.set_location('state2') 
     1219    state.data_name = "hello---->5" 
     1220    db['aastate5']= pickle.dumps(state) 
     1221    db.keys().sort() 
     1222    print pickle.loads(db['state2']) 
     1223   
     1224    db.close() 
Note: See TracChangeset for help on using the changeset viewer.