Changeset d7ff531 in sasview for src/sas/qtgui/Perspectives
- Timestamp:
- Apr 6, 2017 12:47:31 PM (8 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:
- 9c391946
- Parents:
- 2155824
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r454670d rd7ff531 143 143 if data is not None: 144 144 self.data = data 145 # Update Q Ranges146 #self.updateQRange()147 145 148 146 @property … … 166 164 self.updateQRange() 167 165 self.cmdFit.setEnabled(True) 168 print "set to ", self.cmdFit.isEnabled()169 166 170 167 def acceptsData(self): … … 259 256 # Reset parameters to fit 260 257 self.parameters_to_fit = None 258 self.has_error_column = False 261 259 262 260 # SasModel -> QModel … … 397 395 398 396 #disable the Fit button 399 self.cmdFit.setText("Calculating...") 397 self.cmdFit.setText('Calculating...') 398 self.communicate.statusBarUpdateSignal.emit('Fitting started...') 400 399 self.cmdFit.setEnabled(False) 401 400 … … 414 413 self.cmdFit.setText("Fit") 415 414 self.cmdFit.setEnabled(True) 415 416 assert result is not None 417 416 418 res_list = result[0] 417 419 res = res_list[0] … … 440 442 self.updateModelFromList(param_dict) 441 443 444 # update charts 445 self.onPlot() 446 442 447 # Read only value - we can get away by just printing it here 443 448 chi2_repr = GuiUtils.formatNumber(fitness, high=True) 444 449 self.lblChi2Value.setText(chi2_repr) 445 450 446 # Generate charts447 448 451 def iterateOverModel(self, func): 449 452 """ … … 462 465 return 463 466 464 def update Values(row_i):467 def updateFittedValues(row_i): 465 468 # Utility function for main model update 469 # internal so can use closure for param_dict 466 470 param_name = str(self._model_model.item(row_i, 0).text()) 467 471 if param_name not in param_dict.keys(): … … 474 478 self._model_model.item(row_i, 2).setText(error_repr) 475 479 476 def create Column(row_i):480 def createErrorColumn(row_i): 477 481 # Utility function for error column update 478 482 item = QtGui.QStandardItem() … … 484 488 error_column.append(item) 485 489 486 self.iterateOverModel(update Values)490 self.iterateOverModel(updateFittedValues) 487 491 488 492 if self.has_error_column: … … 490 494 491 495 error_column = [] 492 self.iterateOverModel(createColumn) 496 self.iterateOverModel(createErrorColumn) 497 498 # switch off reponse to model change 499 self._model_model.blockSignals(True) 500 self._model_model.insertColumn(2, error_column) 501 self._model_model.blockSignals(False) 502 FittingUtilities.addErrorHeadersToModel(self._model_model) 503 # Adjust the table cells width. 504 # TODO: find a way to dynamically adjust column width while resized expanding 505 self.lstParams.resizeColumnToContents(0) 506 self.lstParams.resizeColumnToContents(4) 507 self.lstParams.resizeColumnToContents(5) 508 self.lstParams.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) 493 509 494 510 self.has_error_column = True 495 self._model_model.insertColumn(2, error_column)496 FittingUtilities.addErrorHeadersToModel(self._model_model)497 511 498 512 def onPlot(self): … … 710 724 711 725 self.kernel_module.params[parameter_name] = value 726 print "UPDATED %s / %s with %0.3f." %(parameter_name, property_name, value) 712 727 713 728 # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] … … 715 730 # multishell params in self.kernel_module.details[??] = value 716 731 717 # Force the chart update 718 self.onPlot() 732 # Force the chart update when actual parameters changed 733 if model_column == 1: 734 self.onPlot() 719 735 720 736 def checkboxSelected(self, item): … … 860 876 # Update the control 861 877 chi2_repr = "---" if chi2 is None else GuiUtils.formatNumber(chi2, high=True) 862 #self.lblChi2Value.setText(GuiUtils.formatNumber(chi2, high=True))863 878 self.lblChi2Value.setText(chi2_repr) 864 879
Note: See TracChangeset
for help on using the changeset viewer.