Changeset 00b7ddf0 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- Sep 4, 2018 5:51:03 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 700b03b
- Parents:
- ef3494b3
- git-author:
- Torin Cooper-Bennun <torin.cooper-bennun@…> (07/25/18 12:01:03)
- git-committer:
- Torin Cooper-Bennun <torin.cooper-bennun@…> (09/04/18 05:51:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
ref3494b3 r00b7ddf0 669 669 Return list of all parameters for the current model 670 670 """ 671 return [self._model_model.item(row).text() for row in range(self._model_model.rowCount())] 671 return [self._model_model.item(row).text() 672 for row in range(self._model_model.rowCount()) 673 if self.isCheckable(row)] 672 674 673 675 def modifyViewOnRow(self, row, font=None, brush=None): … … 697 699 assert isinstance(constraint, Constraint) 698 700 assert 0 <= row <= self._model_model.rowCount() 701 assert self.isCheckable(row) 699 702 700 703 item = QtGui.QStandardItem() … … 717 720 max_col = self.lstParams.itemDelegate().param_max 718 721 for row in self.selectedParameters(): 722 assert(self.isCheckable(row)) 719 723 param = self._model_model.item(row, 0).text() 720 724 value = self._model_model.item(row, 1).text() … … 759 763 max_col = self.lstParams.itemDelegate().param_max 760 764 for row in range(self._model_model.rowCount()): 765 if not self.isCheckable(row): 766 continue 761 767 if not self.rowHasConstraint(row): 762 768 continue … … 787 793 For the given row, return its constraint, if any 788 794 """ 789 try:795 if self.isCheckable(row): 790 796 item = self._model_model.item(row, 1) 791 return item.child(0).data() 792 except AttributeError: 793 # return none when no constraints 794 return None 797 try: 798 return item.child(0).data() 799 except AttributeError: 800 # return none when no constraints 801 pass 802 return None 795 803 796 804 def rowHasConstraint(self, row): … … 798 806 Finds out if row of the main model has a constraint child 799 807 """ 800 item = self._model_model.item(row, 1) 801 if item.hasChildren(): 802 c = item.child(0).data() 803 if isinstance(c, Constraint): 804 return True 808 if self.isCheckable(row): 809 item = self._model_model.item(row, 1) 810 if item.hasChildren(): 811 c = item.child(0).data() 812 if isinstance(c, Constraint): 813 return True 805 814 return False 806 815 … … 809 818 Finds out if row of the main model has an active constraint child 810 819 """ 811 item = self._model_model.item(row, 1) 812 if item.hasChildren(): 813 c = item.child(0).data() 814 if isinstance(c, Constraint) and c.active: 815 return True 820 if self.isCheckable(row): 821 item = self._model_model.item(row, 1) 822 if item.hasChildren(): 823 c = item.child(0).data() 824 if isinstance(c, Constraint) and c.active: 825 return True 816 826 return False 817 827 … … 820 830 Finds out if row of the main model has an active, nontrivial constraint child 821 831 """ 822 item = self._model_model.item(row, 1) 823 if item.hasChildren(): 824 c = item.child(0).data() 825 if isinstance(c, Constraint) and c.func and c.active: 826 return True 832 if self.isCheckable(row): 833 item = self._model_model.item(row, 1) 834 if item.hasChildren(): 835 c = item.child(0).data() 836 if isinstance(c, Constraint) and c.func and c.active: 837 return True 827 838 return False 828 839 … … 1556 1567 # internal so can use closure for param_dict 1557 1568 param_name = str(self._model_model.item(row, 0).text()) 1558 if param_name not in list(param_dict.keys()):1569 if not self.isCheckable(row) or param_name not in list(param_dict.keys()): 1559 1570 return 1560 1571 # modify the param value … … 1568 1579 # Utility function for updateof polydispersity part of the main model 1569 1580 param_name = str(self._model_model.item(row, 0).text())+'.width' 1570 if param_name not in list(param_dict.keys()):1581 if not self.isCheckable(row) or param_name not in list(param_dict.keys()): 1571 1582 return 1572 1583 # modify the param value … … 1711 1722 """ 1712 1723 for row_i in range(self._magnet_model.rowCount()): 1713 func(row_i) 1724 if self.isCheckable(row_i): 1725 func(row_i) 1714 1726 1715 1727 def updateMagnetModelFromList(self, param_dict): … … 2031 2043 self.shell_names = self.shellNamesList() 2032 2044 2033 # Add a header 2034 header_row = [QtGui.QStandardItem() for i in range(5)] 2035 header_row[0].setText(self.kernel_module.name) 2036 font = header_row[0].font() 2037 font.setBold(True) 2038 header_row[0].setFont(font) 2039 for item in header_row: 2040 item.setEditable(False) 2041 item.setCheckable(False) 2042 item.setSelectable(False) 2043 2044 self._model_model.appendRow(header_row) 2045 2046 # Update the QModel 2045 # Get new rows for QModel 2047 2046 new_rows = FittingUtilities.addParametersToModel(self.model_parameters, self.kernel_module, self.is2D) 2048 2047 2048 # Add heading row 2049 FittingUtilities.addHeadingRowToModel(self._model_model, model_name) 2050 2051 # Update QModel 2049 2052 for row in new_rows: 2050 2053 self._model_model.appendRow(row) … … 2064 2067 self.kernel_module = MultiplicationModel(form_kernel, structure_kernel) 2065 2068 2066 # Add a header 2067 header_row = [QtGui.QStandardItem() for i in range(5)] 2068 header_row[0].setText(structure_kernel._model_info.name) 2069 font = header_row[0].font() 2070 font.setBold(True) 2071 header_row[0].setFont(font) 2072 for item in header_row: 2073 item.setEditable(False) 2074 item.setCheckable(False) 2075 item.setSelectable(False) 2076 2077 self._model_model.appendRow(header_row) 2078 2069 # Get new rows for QModel 2079 2070 new_rows = FittingUtilities.addSimpleParametersToModel(structure_parameters, self.is2D) 2071 2072 # Add heading row 2073 FittingUtilities.addHeadingRowToModel(self._model_model, structure_factor) 2074 2075 # Update QModel 2080 2076 for row in new_rows: 2081 2077 self._model_model.appendRow(row) … … 2517 2513 def updateFunctionCaption(row): 2518 2514 # Utility function for update of polydispersity function name in the main model 2515 if not self.isCheckable(row): 2516 return 2519 2517 param_name = str(self._model_model.item(row, 0).text()) 2520 2518 if param_name != param.name:
Note: See TracChangeset
for help on using the changeset viewer.