Ignore:
Timestamp:
Jan 13, 2009 5:52:02 PM (15 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/fitpage2D.py

    rdb709e4 rd15c0202  
    7272        self.vbox.Add(self.sizer4) 
    7373        self.vbox.Add(self.sizer1) 
     74        ## Q range 
     75        self.qmin= 0.001 
     76        self.qmax= 0.1 
    7477         
    7578        id = wx.NewId() 
     
    496499            and the reset model according to paramaters changes 
    497500        """ 
     501        print "went here",len(self.parameters) ,self.model 
    498502        if len(self.parameters) !=0 and self.model !=None: 
     503            # Flag to register when a parameter has changed. 
     504            is_modified = False 
    499505            for item in self.parameters: 
    500                  
    501                 is_modified = False 
    502                 if self.xmin.IsModified(): 
    503                     is_modified = True 
    504                 if self.xmax.IsModified(): 
    505                     is_modified = True 
    506                  
    507                 try:  
    508                      
    509                     if item[1].IsModified() or is_modified: 
    510                         print str(item[0].GetLabelText()),item[1].IsModified() 
    511                         item[1].SetModified(False) 
    512                         name=str(item[0].GetLabelText()) 
    513                         value= float(item[1].GetValue()) 
     506                try: 
     507                    item[2].Hide() 
     508                    item[3].Clear() 
     509                    item[3].Hide() 
     510                    name=str(item[0].GetLabelText()) 
     511                    value= float(item[1].GetValue()) 
     512                    # If the value of the parameter has changed, 
     513                    # update the model and set the is_modified flag 
     514                    if value != self.model.getParam(name): 
    514515                        self.model.setParam(name,value) 
    515                         self.xmin.SetModified(False) 
    516                         self.xmax.SetModified(False) 
    517                         is_modified=False 
    518                          
    519                         self.manager.redraw_model( 
    520                         float(self.xmin.GetValue()), 
    521                         float(self.xmax.GetValue())  )     
    522              
     516                        is_modified = True  
    523517                except: 
    524518                     wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 
    525                             "Model Drawing  Error:wrong value entered : %s"% sys.exc_value)) 
     519                            "Drawing  Error:wrong value entered : %s"% sys.exc_value)) 
     520            # Here we should check whether the boundaries have been modified. 
     521            # If qmin and qmax have been modified, update qmin and qmax and  
     522            # set the is_modified flag to True 
     523            if float(self.xmin.GetValue()) != self.qmin: 
     524                self.qmin = float(self.xmin.GetValue()) 
     525                is_modified = True 
     526            if float(self.xmax.GetValue()) != self.qmax: 
     527                self.qmax = float(self.xmax.GetValue()) 
     528                is_modified = True 
    526529             
     530            if is_modified: 
     531                 
     532                self.manager.redraw_model(  
     533                                        qmin=self.qmin, qmax=self.qmax, 
     534                                        ) 
     535                #self.manager.draw_model(self,model,description=None, 
     536                # enable1D=True,qmin=None,qmax=None, qstep=None) 
    527537            
    528538    def select_all_param(self,event):  
Note: See TracChangeset for help on using the changeset viewer.