Changeset 33dc18f in sasview


Ignore:
Timestamp:
Sep 14, 2017 9:33:49 AM (5 years ago)
Author:
lewis
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:
252d959
Parents:
908f090
Message:

Update S(Q) combobox when plugins reloaded

Rather buggy. Seems related to ticket #865

Location:
src/sas/sasgui/perspectives/fitting
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r914c49d5 r33dc18f  
    18411841            if models.name != "NoStructure": 
    18421842                mlist.append((models.name, models)) 
    1843  
    18441843        # Sort the models 
    18451844        mlist_sorted = sorted(mlist) 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r2d9526d r33dc18f  
    357357                            else: 
    358358                                page.formfactorbox.SetLabel(current_val) 
     359                        if hasattr(page, 'structurebox'): 
     360                            page.structurebox.Clear() 
     361                            page._populate_box(page.structurebox, 
     362                                page.model_list_box["Structure Factors"]) 
    359363        except: 
    360364            logger.error("update_custom_combo: %s", sys.exc_value) 
  • src/sas/sasgui/perspectives/fitting/models.py

    r908f090 r33dc18f  
    1414import py_compile 
    1515import shutil 
     16from copy import copy 
    1617# Explicitly import from the pluginmodel module so that py2exe 
    1718# places it in the distribution. The Model1DPlugin class is used 
     
    347348        """ 
    348349        self.plugins = [] 
    349         new_plugins = _find_models() 
    350         stored_names = self.stored_plugins.keys() 
     350        self.stored_plugins = _find_models() 
    351351        structure_names = [model.name for model in self.struct_list] 
    352352        form_names = [model.name for model in self.multiplication_factor] 
    353         for name, plug in  new_plugins.iteritems(): 
    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] 
     353 
     354        # Remove all plugin structure factors and form factors 
     355        for name in copy(structure_names): 
     356            if '[plug-in]' in name: 
     357                i = structure_names.index(name) 
     358                del self.struct_list[i] 
     359                structure_names.remove(name) 
     360        for name in copy(form_names): 
     361            if '[plug-in]' in name: 
     362                i = form_names.index(name) 
     363                del self.multiplication_factor[i] 
     364                form_names.remove(name) 
     365 
     366        # Add new plugin structure factors and form factors 
     367        for name, plug in self.stored_plugins.iteritems(): 
    358368            if plug.is_structure_factor: 
    359369                if name in structure_names: 
     
    379389 
    380390        self.model_combobox.reset_list("Plugin Models", self.plugins) 
    381         # TODO: Also update structure factor box (if it exists) 
     391        self.model_combobox.reset_list("Structure Factors", self.struct_list) 
     392        self.model_combobox.reset_list("P(Q)*S(Q)", self.multiplication_factor) 
     393 
    382394        return self.model_combobox.get_list() 
    383395 
Note: See TracChangeset for help on using the changeset viewer.