Changeset be8f4b0 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- Jan 16, 2018 2:50:31 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:
- 47d7d2d
- Parents:
- 676f137
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r676f137 rbe8f4b0 82 82 Main widget for selecting form and structure factor models 83 83 """ 84 #constraintAddedSignal = QtCore.pyqtSignal(list) 84 constraintAddedSignal = QtCore.pyqtSignal(list) 85 newModelSignal = QtCore.pyqtSignal() 85 86 def __init__(self, parent=None, data=None, tab_id=1): 86 87 … … 574 575 row = self.rowFromName(constraint.param) 575 576 self._model_model.item(row, 1).setChild(0, item) 576 #self.constraintAddedSignal.emit([row])577 self.constraintAddedSignal.emit([row]) 577 578 578 579 # Show visual hints for the constraint … … 626 627 max = self._model_model.item(row, max_col).text() 627 628 # Create a Constraint object 628 constraint = Constraint(param=param, value=value, min=min, max=max )629 constraint = Constraint(param=param, value=value, min=min, max=max, func=value) 629 630 # Create a new item and add the Constraint object as a child 630 631 item = QtGui.QStandardItem() … … 634 635 self._model_model.item(row, min_col).setText(value) 635 636 self._model_model.item(row, max_col).setText(value) 636 #self.constraintAddedSignal.emit([row])637 self.constraintAddedSignal.emit([row]) 637 638 # Show visual hints for the constraint 638 639 font = QtGui.QFont() … … 647 648 Delete constraints from selected parameters. 648 649 """ 650 self.deleteConstraintOnParameter(param=None) 651 652 def deleteConstraintOnParameter(self, param=None): 653 """ 654 Delete the constraint on model parameter 'param' 655 """ 649 656 min_col = self.lstParams.itemDelegate().param_min 650 657 max_col = self.lstParams.itemDelegate().param_max 651 for row in self.selectedParameters():658 for row in range(self._model_model.rowCount()): 652 659 # Get the Constraint object from of the model item 653 660 item = self._model_model.item(row, 1) … … 659 666 if not isinstance(constraint, Constraint): 660 667 continue 668 if param and constraint.param != param: 669 continue 670 # Now we got the right row. Delete the constraint and clean up 661 671 # Retrieve old values and put them on the model 662 672 if constraint.min is not None: … … 666 676 # Remove constraint item 667 677 item.removeRow(0) 668 #self.constraintAddedSignal.emit([row])678 self.constraintAddedSignal.emit([row]) 669 679 self.modifyViewOnRow(row) 680 break 681 670 682 self.communicate.statusBarUpdateSignal.emit('Constraint removed') 671 683 pass 684 672 685 673 686 def getConstraintForRow(self, row): … … 687 700 """ 688 701 item = self._model_model.item(row,1) 689 return True if (item.hasChildren() and isinstance(item.child(0).data(), Constraint)) else False 702 if item.hasChildren(): 703 c = item.child(0).data() 704 if isinstance(c, Constraint) and c.func: 705 return True 706 return False 707 #return True if (item.hasChildren() and isinstance(item.child(0).data(), Constraint)) else False 690 708 691 709 def selectParameters(self): … … 726 744 self.kernel_module.name = model_name 727 745 param_number = self._model_model.rowCount() 746 def preamble(s): 747 func = self._model_model.item(s, 1).child(0).data().func 748 value = self._model_model.item(s, 1).child(0).data().value 749 if func == value: 750 return "" 751 return model_name + "." 728 752 params = [(self._model_model.item(s, 0).text(), 729 model_name+"."+self._model_model.item(s, 1).child(0).data().func)753 preamble(s) +self._model_model.item(s, 1).child(0).data().func) 730 754 for s in range(param_number) if self.rowHasConstraint(s)] 731 755 return params … … 806 830 # Update state stack 807 831 self.updateUndo() 832 833 # Let others know 834 self.newModelSignal.emit() 808 835 809 836 def onSelectCategory(self): … … 1523 1550 # Now we claim the model has been loaded 1524 1551 self.model_is_loaded = True 1552 # Change the model name to a monicker 1553 self.kernel_module.name = self.modelName() 1525 1554 1526 1555 # (Re)-create headers
Note: See TracChangeset
for help on using the changeset viewer.