Ignore:
Timestamp:
Jan 13, 2009 5:52:02 PM (16 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:
e8d1066
Parents:
e4032d64
Message:

model page change on interface

File:
1 edited

Legend:

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

    rdb709e4 rd15c0202  
    181181        self.model_list_box={} 
    182182        self.data = data 
    183          
     183        ## Q range 
     184        self.qmin= 0.001 
     185        self.qmax= 0.1 
    184186        """ 
    185187        bs = wx.BoxSizer(wx.VERTICAL) 
     
    536538        print "went here",len(self.parameters) ,self.model 
    537539        if len(self.parameters) !=0 and self.model !=None: 
     540            # Flag to register when a parameter has changed. 
     541            is_modified = False 
    538542            for item in self.parameters: 
    539543                try: 
     
    543547                    name=str(item[0].GetLabelText()) 
    544548                    value= float(item[1].GetValue()) 
    545                     self.model.setParam(name,value)  
     549                    # If the value of the parameter has changed, 
     550                    # update the model and set the is_modified flag 
     551                    if value != self.model.getParam(name): 
     552                        self.model.setParam(name,value) 
     553                        is_modified = True  
    546554                except: 
    547555                     wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 
    548556                            "Drawing  Error:wrong value entered : %s"% sys.exc_value)) 
    549             
    550                 is_modified = False 
    551                 if self.xmin.IsModified(): 
    552                     is_modified = True 
    553                 if self.xmax.IsModified(): 
    554                     is_modified = True 
    555                  
    556                 try:  
    557                      
    558                     if item[1].IsModified() or is_modified: 
    559                         print str(item[0].GetLabelText()),item[1].IsModified() 
    560                         item[1].SetModified(False) 
    561                         name=str(item[0].GetLabelText()) 
    562                         value= float(item[1].GetValue()) 
    563                         self.model.setParam(name,value) 
    564                         self.xmin.SetModified(False) 
    565                         self.xmax.SetModified(False) 
    566                         is_modified=False 
    567                          
    568                         self.manager.redraw_model( 
    569                         float(self.xmin.GetValue()), 
    570                         float(self.xmax.GetValue())  )     
    571              
    572                 except: 
    573                      wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 
    574                             "Model Drawing  Error:wrong value entered : %s"% sys.exc_value)) 
    575              
     557            # Here we should check whether the boundaries have been modified. 
     558            # If qmin and qmax have been modified, update qmin and qmax and  
     559            # set the is_modified flag to True 
     560            if float(self.xmin.GetValue()) != self.qmin: 
     561                self.qmin = float(self.xmin.GetValue()) 
     562                is_modified = True 
     563            if float(self.xmax.GetValue()) != self.qmax: 
     564                self.qmax = float(self.xmax.GetValue()) 
     565                is_modified = True 
     566             
     567            if is_modified: 
     568                self.manager.redraw_model( 
     569                                        qmin=self.qmin, qmax=self.qmax, 
     570                                        ) 
     571            #self.manager.draw_model(self,model,description=None, 
     572            # enable1D=True,qmin=None,qmax=None, qstep=None) 
    576573            
    577574    def select_all_param(self,event):  
Note: See TracChangeset for help on using the changeset viewer.