Changeset 93c505b in sasview for src/sas/sasgui
- Timestamp:
- Sep 28, 2018 1:34:58 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- ca30e36b
- Parents:
- 85cf6b8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
r85cf6b8 r93c505b 347 347 if not new_pmodel_list: 348 348 return 349 # Set the new plugin model list for all fit pages 349 # Set the new plugin model list for all fit pages; anticipating 350 # categories, the updated plugin may be in either the form factor 351 # or the structure factor combo boxes 350 352 for uid, page in self.fit_panel.opened_pages.iteritems(): 351 if hasattr(page, "formfactorbox"): 352 page.model_list_box = new_pmodel_list 353 mod_cat = page.categorybox.GetStringSelection() 354 if mod_cat == custom_model: 355 box = page.formfactorbox 356 model_name = box.GetValue() 357 model = (box.GetClientData(box.GetCurrentSelection()) 358 if model_name else None) 359 page._show_combox_helper() 360 new_index = box.FindString(model_name) 361 new_model = (box.GetClientData(new_index) 362 if new_index >= 0 else None) 363 if new_index >= 0: 364 box.SetStringSelection(model_name) 365 else: 366 box.SetStringSelection('') 367 if model and new_model != model: 368 page._on_select_model(keep_pars=True) 369 if hasattr(page, "structurebox"): 370 selected_name = page.structurebox.GetStringSelection() 371 372 page.structurebox.Clear() 373 page.initialize_combox() 374 375 index = page.structurebox.FindString(selected_name) 376 if index == -1: 377 index = 0 378 page.structurebox.SetSelection(index) 379 page._on_select_model(keep_pars=True) 353 pbox = getattr(page, "formfactorbox", None) 354 sbox = getattr(page, "structurebox", None) 355 if pbox is None: 356 continue 357 358 # Set the new model list for the page 359 page.model_list_box = new_pmodel_list 360 361 # Grab names of the P and S models from the page. Need to do 362 # this before resetting the form factor box since that clears 363 # the structure factor box. 364 old_struct = old_form = None 365 form_name = pbox.GetValue() 366 struct_name = sbox.GetStringSelection() 367 if form_name: 368 old_form = pbox.GetClientData(pbox.GetCurrentSelection()) 369 if struct_name: 370 old_struct = sbox.GetClientData(sbox.GetCurrentSelection()) 371 372 # Reset form factor combo box. We are doing this for all 373 # categories not just plugins since eventually the category 374 # manager will allow plugin models to be anywhere. 375 page._show_combox_helper() 376 form_index = pbox.FindString(form_name) 377 pbox.SetSelection(form_index) 378 new_form = (pbox.GetClientData(form_index) 379 if form_index != wx.NOT_FOUND else None) 380 #print("form: %r"%form_name, old_form, new_form) 381 382 # Reset structure factor combo box. If a (even if the model list 383 # hasn't changed, the model may have). Show the structure 384 # factor combobox if the selected model is a form factor. 385 sbox.Clear() 386 page.initialize_combox() 387 if new_form is not None and getattr(new_form, 'is_form_factor', False): 388 sbox.Show() 389 sbox.Enable() 390 page.text2.Show() 391 page.text2.Enable() 392 struct_index = sbox.FindString(struct_name) 393 sbox.SetSelection(struct_index) 394 new_struct = (sbox.GetClientData(struct_index) 395 if struct_index != wx.NOT_FOUND else None) 396 #print("struct: %r"%struct_name, old_struct, new_struct) 397 398 # Update the page if P or S has changed 399 if old_form != new_form or old_struct != new_struct: 400 #print("triggering model update") 401 page._on_select_model(keep_pars=True) 380 402 except Exception: 381 403 logger.error("update_custom_combo: %s", sys.exc_value)
Note: See TracChangeset
for help on using the changeset viewer.