Changeset b69b549 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
- Timestamp:
- Sep 7, 2018 10:10:42 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:
- 5fb714b
- Parents:
- bc7371fd (diff), fb560d2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
rbc7371fd rb69b549 167 167 return rows 168 168 169 def addSimpleParametersToModel(parameters, is2D, model=None, view=None):169 def addSimpleParametersToModel(parameters, is2D, parameters_original=None, model=None, view=None): 170 170 """ 171 171 Update local ModelModel with sasmodel parameters (non-dispersed, non-magnetic) 172 172 Actually appends to model, if model and view params are not None. 173 173 Always returns list of lists of QStandardItems. 174 175 parameters_original: list of parameters before any tagging on their IDs, e.g. for product model (so that those are 176 the display names; see below) 174 177 """ 175 178 if is2D: … … 178 181 params = parameters.iq_parameters 179 182 183 if parameters_original: 184 # 'parameters_original' contains the parameters as they are to be DISPLAYED, while 'parameters' 185 # contains the parameters as they were renamed; this is for handling name collisions in product model. 186 # The 'real name' of the parameter will be stored in the item's user data. 187 if is2D: 188 params_orig = [p for p in parameters_original.kernel_parameters if p.type != 'magnetic'] 189 else: 190 params_orig = parameters_original.iq_parameters 191 else: 192 # no difference in names anyway 193 params_orig = params 194 180 195 rows = [] 181 for param in params:196 for param, param_orig in zip(params, params_orig): 182 197 # Create the top level, checkable item 183 item_name = param .name198 item_name = param_orig.name 184 199 item1 = QtGui.QStandardItem(item_name) 200 item1.setData(param.name, QtCore.Qt.UserRole) 185 201 item1.setCheckable(True) 186 202 item1.setEditable(False) … … 240 256 model.appendRow(item_list) 241 257 258 def addHeadingRowToModel(model, name): 259 """adds a non-interactive top-level row to the model""" 260 header_row = [QtGui.QStandardItem() for i in range(5)] 261 header_row[0].setText(name) 262 263 font = header_row[0].font() 264 font.setBold(True) 265 header_row[0].setFont(font) 266 267 for item in header_row: 268 item.setEditable(False) 269 item.setCheckable(False) 270 item.setSelectable(False) 271 272 model.appendRow(header_row) 273 242 274 def addHeadersToModel(model): 243 275 """ … … 285 317 model.header_tooltips = copy.copy(poly_header_error_tooltips) 286 318 287 def addShellsToModel(parameters, model, index, view=None): 288 """ 289 Find out multishell parameters and update the model with the requested number of them 290 Always appends to model. If view param is not None, supports fixed-choice params. 291 Returns list of lists of QStandardItems. 319 def addShellsToModel(parameters, model, index, row_num=None, view=None): 320 """ 321 Find out multishell parameters and update the model with the requested number of them. 322 Inserts them after the row at row_num, if not None; otherwise, appends to end. 323 If view param is not None, supports fixed-choice params. 324 Returns a list of lists of QStandardItem objects. 292 325 """ 293 326 multishell_parameters = getIterParams(parameters) … … 326 359 cbox = createFixedChoiceComboBox(par, row) 327 360 328 # Always append to the model 329 model.appendRow(row) 361 # Always add to the model 362 if row_num is None: 363 model.appendRow(row) 364 else: 365 model.insertRow(row_num, row) 366 row_num += 1 330 367 331 368 # Apply combobox if required
Note: See TracChangeset
for help on using the changeset viewer.