Ignore:
Timestamp:
Mar 11, 2011 12:14:57 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
a3149c5
Parents:
aae7a8d
Message:

update plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/models.py

    r6bbeacd4 rb2d9826  
    7878    """ 
    7979    # List of plugin objects 
    80     plugins = [] 
     80    plugins = {} 
    8181    # Go through files in plug-in directory 
    8282    try: 
     
    9595                        try: 
    9696                            if _check_plugin(module.Model, name)!=None: 
    97                                 plugins.append(module.Model) 
     97                                plugins[name] = module.Model 
    9898                        except: 
    9999                            msg="Error accessing Model" 
     
    150150    struct_factor_dict = {} 
    151151    ##list of form factors 
    152     shape_list =[] 
     152    shape_list = [] 
    153153    ## independent shape model list 
    154154    shape_indep_list = [] 
    155155    ##list of structure factors  
    156     struct_list= [] 
     156    struct_list = [] 
    157157    ##list of model allowing multiplication 
    158     multiplication_factor=[] 
     158    multiplication_factor = [] 
    159159    ##list of multifunctional shapes 
    160     multi_func_list =[] 
     160    multi_func_list = [] 
    161161    ## list of added models 
    162     plugins=[] 
     162    plugins = [] 
    163163    ## Event owner (guiframe) 
    164164    event_owner = None 
     
    166166        """ 
    167167        """ 
     168        self.stored_plugins = {} 
    168169        self._getModelList() 
    169170         
     
    388389     
    389390        #Looking for plugins 
    390         self.plugins = findModels() 
    391         self._get_multifunc_models() 
     391        self.stored_plugins = findModels() 
     392        self.plugins = self.stored_plugins.values() 
    392393        self.plugins.append(ReflectivityModel) 
    393394        self.plugins.append(ReflectivityIIModel) 
     395        self._get_multifunc_models() 
     396        
    394397        return 0 
    395398 
    396399     
     400    def update(self): 
     401        """ 
     402        """ 
     403        new_plugins = findModels() 
     404        for name, plug in  new_plugins.iteritems(): 
     405            if name not in self.stored_plugins.keys(): 
     406                self.stored_plugins[name] = plug 
     407                self.plugins.append(plug) 
     408        self.model_combobox.set_list("Customized Models", self.plugins) 
     409        return self.model_combobox.get_list() 
     410         
    397411    def populate_menu(self, modelmenu, event_owner): 
    398412        """ 
     
    563577        self.model_combobox.set_list("multiplication", self.multiplication_factor) 
    564578        self.model_combobox.set_list("Multi-Functions", self.multi_func_list) 
    565         return self.model_combobox 
     579        return self.model_combobox.get_list() 
    566580     
    567581   
Note: See TracChangeset for help on using the changeset viewer.