Changeset 09e0c32 in sasview


Ignore:
Timestamp:
Nov 16, 2018 6:44:40 AM (4 weeks ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Invariant, ESS_GUI_batch_fitting, ESS_GUI_ordering
Children:
64b9e61
Parents:
ecc5d043
Message:

Added tooltip on COnstraints table.
Added "validate" parameter to Constraint, allowing for looser validation
of complex, multi-fitpage setups.

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py

    recc5d043 r09e0c32  
    8282        ttip = "Add constraints between all identically named parameters in both fitpages" 
    8383        self.actionAddAll.setToolTip(ttip) 
    84         #self.actionAddAll.setStatusTip(ttip) 
    8584        self.actionAddAll.triggered.connect(self.onSetAll) 
    8685        all_menu.addAction(self.actionAddAll) 
  • src/sas/qtgui/Perspectives/Fitting/Constraint.py

    recc5d043 r09e0c32  
    1212        self._value_ex = value_ex 
    1313        self._func = func 
    14         self.active = True 
    1514        self._min = min 
    1615        self._max = max 
    1716        self._operator = operator 
     17        self.validate = True 
     18        self.active = True 
    1819 
    1920    @property 
  • src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py

    recc5d043 r09e0c32  
    7979        self.tblConstraints.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch) 
    8080        self.tblConstraints.setEnabled(False) 
     81        header = self.tblConstraints.horizontalHeaderItem(0) 
     82        header.setToolTip("Double click to edit.") 
    8183 
    8284        self.tblConstraints.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) 
     
    307309        # No check on function here - trust the user (R) 
    308310        if function != constraint.func: 
    309             #from sas.sascalc.fit.expression import compile_constraints 
     311            # This becomes rather difficult to validate now. 
     312            # Turn off validation for Edit Constraint 
    310313            constraint.func = function 
     314            constraint.validate = False 
    311315 
    312316    def onTabCellEntered(self, row, column): 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    recc5d043 r09e0c32  
    714714        # what is the parameter to constraint to? 
    715715        constraint.value = param_used 
     716 
     717        # Should the new constraint be validated? 
     718        constraint.validate = mc_widget.validate 
    716719 
    717720        # Create a new item and add the Constraint object as a child 
     
    843846        constraint.value_ex = updated_param_used 
    844847        constraint.value = param_used 
     848        # Should the new constraint be validated? 
     849        constraint.validate = mc_widget.validate 
    845850 
    846851        # Which row is the constrained parameter in? 
     
    36843689                value_ex = constraint.value_ex 
    36853690                param = constraint.param 
    3686  
    3687                 cons = (value, param, value_ex, func) 
    3688  
    3689             param_list.append([param_name, param_checked, param_value, param_error, param_min, param_max, cons]) 
     3691                validate = constraint.validate 
     3692 
     3693                cons = (value, param, value_ex, validate, func) 
     3694 
     3695            param_list.append([param_name, param_checked, param_value,param_error, param_min, param_max, cons]) 
    36903696 
    36913697        def gatherPolyParams(row): 
     
    39353941            # constraints 
    39363942            cons = param_dict[param_name][4+ioffset] 
    3937             if cons is not None and len(cons)==4: 
     3943            if cons is not None and len(cons)==5: 
    39383944                value = cons[0] 
    39393945                param = cons[1] 
    39403946                value_ex = cons[2] 
    3941                 function = cons[3] 
     3947                validate = cons[3] 
     3948                function = cons[4] 
    39423949                constraint = Constraint() 
    39433950                constraint.value = value 
     
    39453952                constraint.param = param 
    39463953                constraint.value_ex = value_ex 
     3954                constraint.validate = validate 
    39473955                self.addConstraintToRow(constraint=constraint, row=row) 
    39483956 
  • src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py

    rbaeac95 r09e0c32  
    3131        self.params = params 
    3232        self.parent = parent 
     33        # Text of the constraint 
    3334        self.function = None 
     35        # Should this constraint be validated? 
     36        self.validate = True 
    3437 
    3538        self.input_constraint = constraint 
    3639        if self.input_constraint is not None: 
    3740            variable = constraint.value 
    38             #variable = func[func.index('.')+1:] 
    3941            self.function = constraint.func 
    4042            self.params.append(variable) 
    4143            self.model_name = constraint.value_ex 
     44            # Passed constraint may be too complex for simple validation 
     45            self.validate = constraint.validate 
    4246        else: 
    4347            self.model_name = self.params[1] 
     
    97101        Add visual cues when formula is incorrect 
    98102        """ 
     103        # Don't validate if requested 
     104        if not self.validate: return 
     105 
    99106        formula_is_valid = False 
    100107        formula_is_valid = self.validateConstraint(self.txtConstraint.text()) 
Note: See TracChangeset for help on using the changeset viewer.