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

Location:
src/sas/sasgui/guiframe/local_perspectives/plotting
Files:
3 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): 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/AzimutSlicer.py

    rd85c194 r161713c  
    182182                     NewPlotEvent(plot=new_plot, title=str(new_sector.__name__))) 
    183183 
     184 
     185    def validate(self, param_name, param_value): 
     186        """ 
     187        Test the proposed new value "value" for row "row" of parameters 
     188        """ 
     189        # Here, always return true 
     190        return True 
     191 
    184192    def moveend(self, ev): 
    185193        #TODO: why is this empty? 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py

    r57b7ee2 r161713c  
    176176        self.draw() 
    177177 
     178    def validate(self, param_name, param_value): 
     179        """ 
     180        Test the proposed new value "value" for row "row" of parameters 
     181        """ 
     182        MIN_DIFFERENCE = 0.01 
     183        isValid = True 
     184 
     185        if param_name == 'Delta_Phi [deg]': 
     186            # First, check the closeness 
     187            if numpy.fabs(param_value) < MIN_DIFFERENCE: 
     188                print("Sector angles too close. Please adjust.") 
     189                isValid = False 
     190        elif param_name == 'nbins': 
     191            # Can't be 0 
     192            if param_value < 1: 
     193                print("Number of bins cannot be less than or equal to 0. Please adjust.") 
     194                isValid = False 
     195        return isValid 
     196 
    178197    def moveend(self, ev): 
    179198        """ 
Note: See TracChangeset for help on using the changeset viewer.