Changeset fde5bcd in sasview for src/sas/qtgui/Perspectives
- Timestamp:
- Feb 28, 2018 6:04:56 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:
- 91ad45c
- Parents:
- c3eb858
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r4992ff2 rfde5bcd 1 from copy import deepcopy1 import copy 2 2 3 3 from PyQt5 import QtCore … … 159 159 model.setHeaderData(i, QtCore.Qt.Horizontal, item) 160 160 161 model.header_tooltips = model_header_tooltips161 model.header_tooltips = copy.copy(model_header_tooltips) 162 162 163 163 def addErrorHeadersToModel(model): … … 165 165 Adds predefined headers to the model 166 166 """ 167 model_header_error_captions = model_header_captions167 model_header_error_captions = copy.copy(model_header_captions) 168 168 model_header_error_captions.insert(2, header_error_caption) 169 169 for i, item in enumerate(model_header_error_captions): 170 170 model.setHeaderData(i, QtCore.Qt.Horizontal, item) 171 171 172 model_header_error_tooltips = model_header_tooltips172 model_header_error_tooltips = copy.copy(model_header_tooltips) 173 173 model_header_error_tooltips.insert(2, error_tooltip) 174 model.header_tooltips = model_header_error_tooltips174 model.header_tooltips = copy.copy(model_header_error_tooltips) 175 175 176 176 def addPolyHeadersToModel(model): … … 181 181 model.setHeaderData(i, QtCore.Qt.Horizontal, item) 182 182 183 model.header_tooltips = poly_header_tooltips183 model.header_tooltips = copy.copy(poly_header_tooltips) 184 184 185 185 … … 188 188 Adds predefined headers to the model 189 189 """ 190 poly_header_error_captions = poly_header_captions190 poly_header_error_captions = copy.copy(poly_header_captions) 191 191 poly_header_error_captions.insert(2, header_error_caption) 192 192 for i, item in enumerate(poly_header_error_captions): 193 193 model.setHeaderData(i, QtCore.Qt.Horizontal, item) 194 194 195 poly_header_error_tooltips = poly_header_tooltips195 poly_header_error_tooltips = copy.copy(poly_header_tooltips) 196 196 poly_header_error_tooltips.insert(2, error_tooltip) 197 model.header_tooltips = poly_header_error_tooltips197 model.header_tooltips = copy.copy(poly_header_error_tooltips) 198 198 199 199 def addShellsToModel(parameters, model, index): … … 271 271 ## Set consistently w/AbstractFitengine: 272 272 # But this should be corrected later. 273 dy = deepcopy(current_data.dy)273 dy = copy.deepcopy(current_data.dy) 274 274 dy[dy == 0] = 1 275 275 fn = current_data.y[index] … … 369 369 Create Data1D/Data2D with residuals, ready for plotting 370 370 """ 371 data_copy = deepcopy(current_data)371 data_copy = copy.deepcopy(current_data) 372 372 # Get data: data I, theory I, and data dI in order 373 373 method_name = current_data.__class__.__name__ -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rc3eb858 rfde5bcd 1320 1320 1321 1321 # switch off reponse to model change 1322 self._model_model.blockSignals(True)1323 1322 self._model_model.insertColumn(2, error_column) 1324 self._model_model.blockSignals(False)1325 1323 FittingUtilities.addErrorHeadersToModel(self._model_model) 1326 1324 # Adjust the table cells width. -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingUtilitiesTest.py
r53c771e rfde5bcd 1 1 import sys 2 2 import unittest 3 from PyQt5 import QtGui 3 from PyQt5 import QtGui, QtCore 4 4 5 5 from sas.qtgui.Plotting.PlotterData import Data1D … … 266 266 chi = FittingUtilities.calculateChi2(reference_data, current_data) 267 267 268 def notestAddHeadersToModel(self): 269 '''Check to see if headers are correctly applied''' 270 #test model 271 model = QtGui.QStandardItemModel() 272 FittingUtilities.addHeadersToModel(model) 273 274 # Assure we have properly named columns 275 names = FittingUtilities.model_header_captions 276 names_from_model = [model.headerData(i, QtCore.Qt.Horizontal) for i in range(len(names))] 277 self.assertEqual(names, names_from_model) 278 279 # Add another model 280 model2 = QtGui.QStandardItemModel() 281 # Add headers again 282 FittingUtilities.addHeadersToModel(model2) 283 # We still should have only the original names 284 names_from_model2 = [model2.headerData(i, QtCore.Qt.Horizontal) for i in range(len(names))] 285 self.assertEqual(names, names_from_model2) 286 287 268 288 if __name__ == "__main__": 269 289 unittest.main() -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
rd6b8a1d rfde5bcd 84 84 editor.setValidator(validator) 85 85 return editor 86 if index.column() in [self.param_property, self.param_error ]:86 if index.column() in [self.param_property, self.param_error, self.param_unit]: 87 87 # Set some columns uneditable 88 88 return None
Note: See TracChangeset
for help on using the changeset viewer.