Changeset 85b3971 in sasview for sansview


Ignore:
Timestamp:
Dec 18, 2009 11:07:28 PM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
e051c8d
Parents:
6e74ee4
Message:

sansview: got rid of bad util call

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

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

    r12eac73 r85b3971  
    77import math 
    88import string 
    9 from sans.guiframe.utils import format_number,check_float,check_value  
     9from sans.guiframe.utils import format_number,check_float 
    1010from sans.guicomm.events import StatusEvent 
    1111import pagestate 
     
    935935            # If qmin and qmax have been modified, update qmin and qmax and  
    936936            # set the is_modified flag to True 
    937             if check_value( self.qmin, self.qmax): 
     937            if self._validate_qrange(self.qmin, self.qmax): 
    938938                tempmin = float(self.qmin.GetValue()) 
    939939                if tempmin != self.qmin_x: 
     
    984984            # If qmin and qmax have been modified, update qmin and qmax and  
    985985            # set the is_modified flag to True 
    986             if check_value( self.qmin, self.qmax): 
     986            if self._validate_qrange(self.qmin, self.qmax): 
    987987                tempmin = float(self.qmin.GetValue()) 
    988988                if tempmin != self.qmin_x: 
     
    15301530        self.Layout()      
    15311531         
    1532                
     1532    def _validate_qrange(self, qmin_ctrl, qmax_ctrl): 
     1533        """ 
     1534            Verify that the Q range controls have valid values 
     1535            and that Qmin < Qmax. 
     1536             
     1537            @param qmin_ctrl: text control for Qmin 
     1538            @param qmax_ctrl: text control for Qmax 
     1539            @return: True is the Q range is value, False otherwise  
     1540        """ 
     1541        qmin_validity = check_float(qmin_ctrl) 
     1542        qmax_validity = check_float(qmax_ctrl) 
     1543        if not (qmin_validity and qmax_validity): 
     1544            return False 
     1545        else: 
     1546            qmin = float(qmin_ctrl.GetValue()) 
     1547            qmax = float(qmax_ctrl.GetValue()) 
     1548            if qmin < qmax: 
     1549                #Make sure to set both colours white.   
     1550                qmin_ctrl.SetBackgroundColour(wx.WHITE) 
     1551                qmin_ctrl.Refresh() 
     1552                qmax_ctrl.SetBackgroundColour(wx.WHITE) 
     1553                qmax_ctrl.Refresh() 
     1554            else: 
     1555                qmin_ctrl.SetBackgroundColour("pink") 
     1556                qmin_ctrl.Refresh() 
     1557                qmax_ctrl.SetBackgroundColour("pink") 
     1558                qmax_ctrl.Refresh() 
     1559                msg= "Invalid Q range: Q min must be smaller than Q max" 
     1560                wx.PostEvent(self.parent.parent, StatusEvent(status = msg)) 
     1561                return False 
     1562        return True 
     1563 
    15331564    def _check_value_enter(self, list, modified): 
    15341565        """ 
     
    15901621 
    15911622                if param_min != None and param_max !=None: 
    1592                     if not check_value(item[5], item[6]): 
     1623                    if not self._validate_qrange(item[5], item[6]): 
    15931624                        msg= "Wrong Fit range entered for parameter " 
    15941625                        msg+= "name %s of model %s "%(name, self.model.name) 
  • sansview/perspectives/fitting/fitpage.py

    r12eac73 r85b3971  
    1111 
    1212from sans.guicomm.events import StatusEvent    
    13 from sans.guiframe.utils import format_number,check_float,check_value 
     13from sans.guiframe.utils import format_number,check_float 
    1414  
    1515## event to post model to fit to fitting plugins 
     
    571571        #make sure all parameter values are updated. 
    572572        
    573         flag = self._update_paramv_on_fit() #check_value( self.qmin, self.qmax)  
     573        flag = self._update_paramv_on_fit()  
    574574                 
    575575        if not flag: 
     
    745745 
    746746                # If qmin and qmax have been modified, update qmin and qmax 
    747                 if check_value( self.qmin, self.qmax): 
     747                if self._validate_qrange( self.qmin, self.qmax): 
    748748                    tempmin = float(self.qmin.GetValue()) 
    749749                    if tempmin != self.qmin_x: 
     
    11381138            to the tcChi txtcrl 
    11391139        """ 
    1140         flag = check_value( self.qmin, self.qmax) 
     1140        flag = self._validate_qrange( self.qmin, self.qmax) 
    11411141        if flag== True: 
    11421142            try: 
Note: See TracChangeset for help on using the changeset viewer.