Changeset 0595bb7 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- Jan 10, 2018 5:15:53 AM (6 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:
- eae226b
- Parents:
- 7fd20fc
- git-author:
- Piotr Rozyczko <rozyczko@…> (12/24/17 10:42:41)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (01/10/18 05:15:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r7fd20fc r0595bb7 80 80 Main widget for selecting form and structure factor models 81 81 """ 82 constraintAddedSignal = QtCore.pyqtSignal(list) 82 83 def __init__(self, parent=None, data=None, tab_id=1): 83 84 … … 452 453 # Respond to change in parameters from the UI 453 454 self._model_model.itemChanged.connect(self.onMainParamsChange) 455 self.constraintAddedSignal.connect(self.modifyViewOnConstraint) 454 456 self._poly_model.itemChanged.connect(self.onPolyModelChange) 455 457 self._magnet_model.itemChanged.connect(self.onMagnetModelChange) … … 506 508 507 509 # Define the callbacks 508 self.actionConstrain.triggered.connect(self.add Constraint)509 self.actionMutualMultiConstrain.triggered.connect(self.showMultiConstrain )510 self.actionConstrain.triggered.connect(self.addSimpleConstraint) 511 self.actionMutualMultiConstrain.triggered.connect(self.showMultiConstraint) 510 512 self.actionSelect.triggered.connect(self.selectParameters) 511 513 self.actionDeselect.triggered.connect(self.deselectParameters) 512 514 return menu 513 515 514 def showMultiConstrain (self):516 def showMultiConstraint(self): 515 517 """ 516 518 Show the constraint widget and receive the expression 517 519 """ 518 520 from sas.qtgui.Perspectives.Fitting.MultiConstraint import MultiConstraint 519 params_list = [s.data() for s in self.lstParams.selectionModel().selectedRows()] 521 from .Constraints import Constraint 522 selected_rows = self.lstParams.selectionModel().selectedRows() 523 524 params_list = [s.data() for s in selected_rows] 520 525 mc_widget = MultiConstraint(self, params=params_list) 521 526 mc_widget.exec_() 522 constraint = mc_widget.txtConstraint.text() 527 constraint = Constraint() 528 c_text = mc_widget.txtConstraint.text() 523 529 # Pass the constraint to the parser 530 524 531 self.communicate.statusBarUpdateSignal.emit('Constraints added') 532 # Change the colour of the row 525 533 pass 526 534 527 def addConstraint(self): 535 def modifyViewOnConstraint(self, row): 536 """ 537 Add visual cues that the parameter is constrained 538 """ 539 value = self._model_model.item(row, 1).text() 540 # Set min/max to the value constrained 541 self._model_model.item(row,2).setText(value) 542 self._model_model.item(row,3).setText(value) 543 font = QtGui.QFont() 544 font.setItalic(True) 545 brush = QtGui.QBrush(QtGui.QColor('blue')) 546 self._model_model.blockSignals(True) 547 # Modify font and foreground of affected rows 548 for column in range(0, self._model_model.columnCount()): 549 self._model_model.item(row, column).setForeground(brush) 550 self._model_model.item(row, column).setFont(font) 551 self._model_model.item(row, column).setEditable(False) 552 self._model_model.blockSignals(False) 553 554 def addSimpleConstraint(self): 528 555 """ 529 556 Adds a constraint on a single parameter. 530 557 """ 558 from .Constraints import Constraint 559 for row in self.selectedParameters(): 560 param = self._model_model.item(row, 0).text() 561 value = self._model_model.item(row, 1).text() 562 constraint = Constraint(param=param, value=value) 563 item = QtGui.QStandardItem() 564 item.setData(constraint) 565 self._model_model.item(row, 1).setChild(0, item) 566 #self.constraintAddedSignal.emit([row]) 567 self.modifyViewOnConstraint(row) 531 568 self.communicate.statusBarUpdateSignal.emit('Constraint added') 532 569 pass
Note: See TracChangeset
for help on using the changeset viewer.