- Timestamp:
- Sep 7, 2018 5:57:38 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:
- 3fbd77b
- Parents:
- f3a19ad
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
rc7809a9 r70f4458 259 259 model.header_tooltips = copy.copy(poly_header_error_tooltips) 260 260 261 def addShellsToModel(parameters, model, index): 262 """ 263 Find out multishell parameters and update the model with the requested number of them 261 def addShellsToModel(parameters, model, index, row_num=None): 262 """ 263 Find out multishell parameters and update the model with the requested number of them. 264 Inserts them after the row at row_num, if not None; otherwise, appends to end. 265 Returns a list of lists of QStandardItem objects. 264 266 """ 265 267 multishell_parameters = getIterParams(parameters) 266 268 269 rows = [] 267 270 for i in range(index): 268 271 for par in multishell_parameters: … … 291 294 item4 = QtGui.QStandardItem(str(par.limits[1])) 292 295 item5 = QtGui.QStandardItem(par.units) 293 model.appendRow([item1, item2, item3, item4, item5]) 296 row = [item1, item2, item3, item4, item5] 297 rows.append(row) 298 299 if row_num is None: 300 model.appendRow(row) 301 else: 302 model.insertRow(row_num, row) 303 row_num += 1 304 305 return rows 294 306 295 307 def calculateChi2(reference_data, current_data): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rf3a19ad r70f4458 221 221 # Utility variable to enable unselectable option in category combobox 222 222 self._previous_category_index = 0 223 # Utility variable for multishell display 224 self._last_model_row = 0 223 # Utility variables for multishell display 224 self._n_shells_row = 0 225 self._num_shell_params = 0 225 226 # Dictionary of {model name: model class} for the current category 226 227 self.models = {} … … 1968 1969 else: 1969 1970 self.fromModelToQModel(model_name) 1971 self.addExtraShells() 1972 1970 1973 if structure_factor not in (None, "None"): 1971 1974 # add S(Q) … … 1974 1977 # enable selection of S(Q) 1975 1978 self.enableStructureFactorControl(structure_factor) 1979 1976 1980 # Add polydispersity to the model 1977 1981 self.setPolyModel() 1978 1982 # Add magnetic parameters to the model 1979 1983 self.setMagneticModel() 1980 1981 # Then, add multishells1982 if model_name is not None:1983 # Multishell models need additional treatment1984 self.addExtraShells()1985 1984 1986 1985 # Adjust the table cells width … … 2056 2055 for row in new_rows: 2057 2056 self._model_model.appendRow(row) 2058 # Update the counter used for multishell display2059 self._last_model_row = self._model_model.rowCount()2060 2057 2061 2058 def fromStructureFactorToQModel(self, structure_factor): … … 2124 2121 # row_num = self._model_model.rowCount() - 1 2125 2122 # FittingUtilities.markParameterDisabled(self._model_model, row_num) 2126 2127 # Update the counter used for multishell display2128 self._last_model_row = self._model_model.rowCount()2129 2123 2130 2124 def haveParamsToFit(self): … … 2744 2738 2745 2739 self.lstParams.setIndexWidget(shell_index, func) 2746 self._ last_model_row = self._model_model.rowCount()2740 self._n_shells_row = shell_row - 1 2747 2741 2748 2742 # Set the index to the state-kept value … … 2755 2749 """ 2756 2750 # Find row location of the combobox 2757 last_row = self._last_model_row2758 remove_rows = self._ model_model.rowCount() - last_row2751 first_row = self._n_shells_row + 1 2752 remove_rows = self._num_shell_params 2759 2753 2760 2754 if remove_rows > 1: 2761 self._model_model.removeRows(last_row, remove_rows) 2762 2763 FittingUtilities.addShellsToModel(self.model_parameters, self._model_model, index) 2755 self._model_model.removeRows(first_row, remove_rows) 2756 2757 new_rows = FittingUtilities.addShellsToModel(self.model_parameters, self._model_model, index, first_row) 2758 self._num_shell_params = len(new_rows) 2759 2764 2760 self.current_shell_displayed = index 2765 2761
Note: See TracChangeset
for help on using the changeset viewer.