Ignore:
Timestamp:
Apr 2, 2009 12:28:34 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:
7fff5cd
Parents:
05f14dd
Message:

add fit with parameter range when selecting park only

File:
1 edited

Legend:

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

    r376916c r77e23a2  
    99from sans.guicomm.events import StatusEvent    
    1010from sans.guiframe.utils import format_number 
     11 
    1112(ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent() 
     13(FitterTypeEvent, EVT_FITTER_TYPE)   = wx.lib.newevent.NewEvent() 
    1214_BOX_WIDTH = 80 
    1315 
     
    4345        self.page_info.model= self.model 
    4446        self._on_select_model(event=None) 
    45              
    46          
     47        self.Bind(EVT_FITTER_TYPE,self._on_engine_change) 
     48     
     49     
     50    def _on_engine_change(self, event): 
     51        """ 
     52            get an event containing the current name of the fit engine type 
     53            @param event: FitterTypeEvent containing  the name of the current engine 
     54        """ 
     55        if len(self.parameters)==0: 
     56            return 
     57        for item in self.parameters: 
     58            if event.type =="scipy": 
     59                item[5].SetValue(format_number("")) 
     60                item[5].Hide() 
     61                item[6].SetValue(format_number("")) 
     62                item[6].Hide() 
     63                self.text2_min.Hide() 
     64                self.text2_max.Hide() 
     65            else: 
     66                item[5].Show(True) 
     67                item[6].Show(True) 
     68                self.text2_min.Show(True) 
     69                self.text2_max.Show(True) 
     70                 
     71        self.sizer3.Layout() 
     72        self.SetScrollbars(20,20,200,100) 
     73             
     74             
    4775    def _on_display_description(self, event): 
    4876        """ 
     
    261289                    ctl1.SetValue(str (format_number(value))) 
    262290                    ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
     291                    ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 
    263292                    ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 
    264293                    self.sizer4_4.Add(ctl1, (iy,ix),(1,1),wx.EXPAND) 
     
    286315                        Tctl.SetValue(str (format_number(value))) 
    287316                        Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
     317                        Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 
    288318                        Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 
    289319                        self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 
     
    300330                        Tctl.SetValue(str (format_number(value))) 
    301331                        Tctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
     332                        Tctl.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 
    302333                        Tctl.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 
    303334                        self.sizer4_4.Add(Tctl, (iy,ix),(1,1), 
     
    344375        self.manager.set_fit_range(page= self,qmin= self.qmin_x, qmax= self.qmax_x) 
    345376        #single fit  
    346         #self.manager.on_single_fit(qmin=self.qmin_x,qmax=self.qmax_x) 
    347377        self.manager.onFit() 
    348378             
     
    373403            when enter value on panel redraw model according to changed 
    374404        """ 
    375          
    376405        self._onparamEnter_helper() 
    377406        self.compute_chisqr() 
     
    660689         
    661690         
    662     def set_model_param_sizer(self, model, engine_type="park"): 
     691    def set_model_param_sizer(self, model): 
    663692        """ 
    664693            Build the panel from the model content 
     
    719748                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
    720749        self.text2_4.Hide() 
    721         if  engine_type == "park": 
    722             self.text2_max.Show(True) 
    723             self.text2_min.Show(True) 
     750         
    724751 
    725752        for item in keys: 
     
    739766                                    style=wx.TE_PROCESS_ENTER) 
    740767                 
    741                 ctl1.SetValue(str (format_number(value))) 
     768                ctl1.SetValue(format_number(value)) 
     769                ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
    742770                ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 
    743771                ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 
     
    755783                ctl2.Hide() 
    756784                 
     785                param_min, param_max= self.model.details[item][1:] 
    757786                ix += 1 
    758787                ctl3 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER) 
     788                ctl3.SetValue(format_number(param_min)) 
     789                ctl3.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
    759790                ctl3.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 
    760791                ctl3.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 
    761792                sizer.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    762793                ctl3.Hide() 
    763                  
     794         
    764795                ix += 1 
    765796                ctl4 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER) 
     797                ctl4.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
    766798                ctl4.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 
    767799                ctl4.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 
    768800                sizer.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     801                ctl4.SetValue(format_number(param_max)) 
    769802                ctl4.Hide() 
    770                 if  engine_type == "park": 
    771                     ctl3.Show(True) 
    772                     ctl4.Show(True) 
    773                      
     803               
    774804                ix +=1 
    775805                # Units 
Note: See TracChangeset for help on using the changeset viewer.