Changeset 908f090 in sasview
- Timestamp:
- Sep 14, 2017 7:07:37 AM (7 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 33dc18f
- Parents:
- 7b3f154
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/models.py
rb1c2011 r908f090 278 278 """ 279 279 280 # regular model names only280 # Regular model names only 281 281 self.model_name_list = [] 282 282 283 # Build list automagically from sasmodels package283 # Build list automagically from sasmodels package 284 284 for model in load_standard_models(): 285 285 self.model_dictionary[model.name] = model … … 293 293 self.model_name_list.append(model.name) 294 294 295 # Looking for plugins295 # Looking for plugins 296 296 self.stored_plugins = self.findModels() 297 297 self.plugins = self.stored_plugins.values() 298 298 for name, plug in self.stored_plugins.iteritems(): 299 299 self.model_dictionary[name] = plug 300 if plug.is_structure_factor: 301 self.struct_list.append(plug) 302 self.plugins.remove(plug) 303 elif plug.is_form_factor: 304 self.multiplication_factor.append(plug) 305 if plug.is_multiplicity_model: 306 self.multi_func_list.append(plug) 300 307 301 308 self._get_multifunc_models() … … 341 348 self.plugins = [] 342 349 new_plugins = _find_models() 350 stored_names = self.stored_plugins.keys() 351 structure_names = [model.name for model in self.struct_list] 352 form_names = [model.name for model in self.multiplication_factor] 343 353 for name, plug in new_plugins.iteritems(): 344 for stored_name, stored_plug in self.stored_plugins.iteritems(): 345 if name == stored_name: 346 del self.stored_plugins[name] 347 del self.model_dictionary[name] 348 break 354 if name in stored_names: 355 # Delete references to the olf model 356 del self.stored_plugins[name] 357 del self.model_dictionary[name] 358 if plug.is_structure_factor: 359 if name in structure_names: 360 # Delete the old model from self.struct list 361 i = structure_names.index(name) 362 del self.struct_list[i] 363 # Add the new model to self.struct_list 364 self.struct_list.append(plug) 365 elif plug.is_form_factor: 366 if name in form_names: 367 # Delete the old model from self.multiplication_factor 368 i = form_names.index(name) 369 del self.multiplication_factor[i] 370 # Add the new model to self.multiplication_factor 371 self.multiplication_factor.append(plug) 372 373 # Add references to the updated model 349 374 self.stored_plugins[name] = plug 350 self.plugins.append(plug) 375 if not plug.is_structure_factor: 376 # Don't show S(Q) models in the 'Plugin Models' dropdown 377 self.plugins.append(plug) 351 378 self.model_dictionary[name] = plug 352 379 353 380 self.model_combobox.reset_list("Plugin Models", self.plugins) 381 # TODO: Also update structure factor box (if it exists) 354 382 return self.model_combobox.get_list() 355 383
Note: See TracChangeset
for help on using the changeset viewer.