Changes in src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py [305114c:09e0c32] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py
r305114c r09e0c32 20 20 Logic class for interacting with MultiConstrainedUI view 21 21 """ 22 def __init__(self, parent=None, params=None ):22 def __init__(self, parent=None, params=None, constraint=None): 23 23 """ 24 24 parent: ConstraintWidget object … … 31 31 self.params = params 32 32 self.parent = parent 33 # Text of the constraint 34 self.function = None 35 # Should this constraint be validated? 36 self.validate = True 37 38 self.input_constraint = constraint 39 if self.input_constraint is not None: 40 variable = constraint.value 41 self.function = constraint.func 42 self.params.append(variable) 43 self.model_name = constraint.value_ex 44 # Passed constraint may be too complex for simple validation 45 self.validate = constraint.validate 46 else: 47 self.model_name = self.params[1] 33 48 34 49 self.setupLabels() … … 36 51 37 52 # Set param text control to the second parameter passed 38 self.txtConstraint.setText(self.params[1]) 39 53 if self.input_constraint is None: 54 self.txtConstraint.setText(self.params[1]) 55 else: 56 self.txtConstraint.setText(self.function) 40 57 self.cmdOK.clicked.connect(self.accept) 41 58 self.cmdHelp.clicked.connect(self.onHelp) … … 52 69 # Switch parameters 53 70 self.params[1], self.params[0] = self.params[0], self.params[1] 71 # change fully qualified param name (e.g. M1.sld -> M1.sld_solvent) 72 self.model_name = self.model_name.replace(self.params[0], self.params[1]) 54 73 # Try to swap parameter names in the line edit 55 74 current_text = self.txtConstraint.text() … … 64 83 Setup labels based on current parameters 65 84 """ 66 l1 = s elf.params[0]67 l2 = s elf.params[1]85 l1 = str(self.params[0]) 86 l2 = str(self.params[1]) 68 87 self.txtParam1.setText(l1) 69 88 self.txtParam1_2.setText(l1) … … 82 101 Add visual cues when formula is incorrect 83 102 """ 103 # Don't validate if requested 104 if not self.validate: return 105 84 106 formula_is_valid = False 85 107 formula_is_valid = self.validateConstraint(self.txtConstraint.text()) … … 99 121 return False 100 122 101 param_str = str(self.params[1]) 102 constraint_text = constraint_text.strip() 123 param_str = self.model_name 103 124 104 125 # 1. just the parameter
Note: See TracChangeset
for help on using the changeset viewer.