Ignore:
Timestamp:
Feb 14, 2017 9:14:11 AM (8 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
4c7dd9f
Parents:
7b8485f
Message:

Validate Table View entries in 2D slicer parameter editor - prototype for future use in fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/local_perspectives/plotting/AnnulusSlicer.py

    r3bdbfcc r161713c  
    154154        self.draw() 
    155155 
     156    def validate(self, param_name, param_value): 
     157        """ 
     158        Test the proposed new value "value" for row "row" of parameters 
     159        """ 
     160        MIN_DIFFERENCE = 0.01 
     161        isValid = True 
     162 
     163        if param_name == 'inner_radius': 
     164            # First, check the closeness 
     165            if numpy.fabs(param_value - self.getParams()['outer_radius']) < MIN_DIFFERENCE: 
     166                print("Inner and outer radii too close. Please adjust.") 
     167                isValid = False 
     168            elif param_value > self.qmax: 
     169                print("Inner radius exceeds maximum range. Please adjust.") 
     170                isValid = False 
     171        elif param_name == 'outer_radius': 
     172            # First, check the closeness 
     173            if numpy.fabs(param_value - self.getParams()['inner_radius']) < MIN_DIFFERENCE: 
     174                print("Inner and outer radii too close. Please adjust.") 
     175                isValid = False 
     176            elif param_value > self.qmax: 
     177                print("Outer radius exceeds maximum range. Please adjust.") 
     178                isValid = False 
     179        elif param_name == 'nbins': 
     180            # Can't be 0 
     181            if param_value < 1: 
     182                print("Number of bins cannot be less than or equal to 0. Please adjust.") 
     183                isValid = False 
     184 
     185        return isValid 
    156186 
    157187    def moveend(self, ev): 
Note: See TracChangeset for help on using the changeset viewer.