Changeset 8f2548c in sasview for src/sas/qtgui/Perspectives/Fitting
- Timestamp:
- Sep 20, 2017 4:19:54 AM (7 years ago)
- 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:
- adc49fc
- Parents:
- e694f0f
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r8a32a6ff r8f2548c 871 871 872 872 error_column = [] 873 self.lstParams.itemDelegate().addErrorColumn() 873 874 self.iterateOverModel(createErrorColumn) 874 875 … … 1269 1270 return 1270 1271 parameter_name = str(self._model_model.data(name_index).toPyObject()) # sld, background etc. 1271 property_index = self._model_model.headerData(1, model_column).toInt()[0]-1 # Value, min, max, etc.1272 1272 1273 1273 # Update the parameter value - note: this supports +/-inf as well … … 1275 1275 1276 1276 # Update the parameter value - note: this supports +/-inf as well 1277 if model_column == 0: 1277 param_column = self.lstParams.itemDelegate().param_value 1278 min_column = self.lstParams.itemDelegate().param_min 1279 max_column = self.lstParams.itemDelegate().param_max 1280 if model_column == param_column: 1278 1281 self.kernel_module.setParam(parameter_name, value) 1282 elif model_column == min_column: 1283 # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] 1284 self.kernel_module.details[parameter_name][1] = value 1285 elif model_column == max_column: 1286 self.kernel_module.details[parameter_name][2] = value 1279 1287 else: 1280 # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf]1281 self.kernel_module.details[parameter_name][property_index] = value1288 # don't update the chart 1289 return 1282 1290 1283 1291 # TODO: magnetic params in self.kernel_module.details['M0:parameter_name'] = value -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
re43fc91 r8f2548c 8 8 Custom delegate for appearance and behavior control of the model view 9 9 """ 10 # Main parameter table view columns 11 PARAM_PROPERTY=0 12 PARAM_VALUE=1 13 PARAM_MIN=2 14 PARAM_MAX=3 15 PARAM_UNIT=4 10 def __init__(self, parent=None): 11 """ 12 Overwrite generic constructor to allow for some globals 13 """ 14 super(QtGui.QStyledItemDelegate, self).__init__() 15 16 # Main parameter table view columns 17 self.param_error=-1 18 self.param_property=0 19 self.param_value=1 20 self.param_min=2 21 self.param_max=2 22 self.param_unit=2 23 24 def editableParameters(self): 25 return [self.param_value, self.param_min, self.param_max] 26 27 def addErrorColumn(self): 28 """ 29 Modify local column pointers 30 Note: the reverse is never required! 31 """ 32 self.param_property=0 33 self.param_value=1 34 self.param_error=2 35 self.param_min=3 36 self.param_max=4 37 self.param_unit=5 16 38 17 39 def paint(self, painter, option, index): … … 19 41 Overwrite generic painter for certain columns 20 42 """ 21 if index.column() in (self.PARAM_UNIT, self.PARAM_MIN, self.PARAM_MAX):43 if index.column() in self.editableParameters(): 22 44 # Units - present in nice HTML 23 45 options = QtGui.QStyleOptionViewItemV4(option) … … 56 78 if not index.isValid(): 57 79 return 0 58 if index.column() == self. PARAM_VALUE: #only in the value column80 if index.column() == self.param_value: #only in the value column 59 81 editor = QtGui.QLineEdit(widget) 60 82 validator = QtGui.QDoubleValidator() 61 83 editor.setValidator(validator) 62 84 return editor 63 if index.column() in [self. PARAM_PROPERTY, self.PARAM_UNIT]:85 if index.column() in [self.param_property, self.param_error]: 64 86 # Set some columns uneditable 65 87 return None … … 71 93 Overwrite generic model update method for certain columns 72 94 """ 73 if index.column() in (self. PARAM_MIN, self.PARAM_MAX):95 if index.column() in (self.param_min, self.param_max): 74 96 try: 75 97 value_float = float(editor.text()) … … 86 108 """ 87 109 POLYDISPERSE_FUNCTIONS = ['rectangle', 'array', 'lognormal', 'gaussian', 'schulz'] 88 #POLYDISPERSE_FUNCTIONS = ['rectangle', 'lognormal', 'gaussian', 'schulz']89 110 90 111 combo_updated = QtCore.pyqtSignal(str, int)
Note: See TracChangeset
for help on using the changeset viewer.