Changeset 085e3c9d in sasview for src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
- Timestamp:
- Jul 10, 2018 4:21:02 AM (6 years ago)
- Branches:
- ESS_GUI_iss959
- Parents:
- 6052c02
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
r6052c02 r085e3c9d 308 308 def createEditor(self, parent, option, index): 309 309 """ 310 Override generic createEditor -- certain elements have 311 combo boxes312 """310 Override generic createEditor -- certain elements have combo boxes 311 """ 312 print("gotta create me an editor") 313 313 314 314 model = self.fittingWidget.structureView.model() 315 315 316 if notindex.parent():316 if index.parent(): 317 317 # we only care about child items since we don't edit top-level 318 318 # items in this view anyway 319 return super(QtWidgets.QStyledItemDelegate, self).createEditor( 320 parent, option, index 321 ) 322 323 # navigate to the parameter name through the parent item (it'll be 324 # on the same row, but col. 0) 325 parent_item = model.itemFromIndex(index.parent()) 326 param_item = parent_item.child(index.row(), 0) 327 328 #item = model.itemFromIndex(index) 329 #print("item (row) [param]: \"{}\" ({}) [{}]".format( 330 # item.text(), index.row(), param_item.text()) 331 #) 332 333 if param_item.text() in ["effective radius", "volume fraction"]: 334 # we want a combo box for these 335 return QtWidgets.QComboBox(parent) 319 print("the item has a parent") 320 321 if index.column() == 1: 322 print("the item's col. is 1") 323 # col. 1 contains elements that may be combo boxes 324 325 # navigate to the parameter name through the parent item (it'll 326 # be on the same row, but col. 0) 327 parent_item = model.itemFromIndex(index.parent()) 328 param_item = parent_item.child(index.row(), 0) 329 330 if param_item.text() == "mixture": 331 print("gonna do a mixture combo box") 332 # TODO: ONLY TEMPORARY EXAMPLE STUFF HERE RIGHT NOW 333 cbox = QtWidgets.QComboBox(parent) 334 cbox.addItems([ 335 "P(Q)*S(Q)", 336 "P(Q)+S(Q)", 337 "custom" 338 ]) 339 return cbox 340 341 elif param_item.text() == "effective radius": 342 print("gonna do an effective radius combo box") 343 # TODO: ONLY TEMPORARY EXAMPLE STUFF HERE RIGHT NOW 344 cbox = QtWidgets.QComboBox(parent) 345 cbox.addItems([ 346 "ER_mean_curvature", 347 "ER_equivalent_sphere", 348 "ER_maximum_radius", 349 "ER_minimum_radius" 350 ]) 351 return cbox 352 353 elif param_item.text() == "volume fraction": 354 print("gonna do a volume fraction combo box") 355 # TODO: ONLY TEMPORARY EXAMPLE STUFF HERE RIGHT NOW 356 cbox = QtWidgets.QComboBox(parent) 357 cbox.addItems([ 358 "VR_something", 359 "VR_something_else", 360 "VR_something_completely_different" 361 ]) 362 return cbox 336 363 337 364 # return default otherwise 365 print("let's do a normal thing instead") 338 366 return super(StructureViewDelegate, self).createEditor( 339 367 parent, option, index
Note: See TracChangeset
for help on using the changeset viewer.