Changeset 916f5c0 in sasview for fittingview/src/sans/perspectives


Ignore:
Timestamp:
Dec 8, 2011 11:44:28 AM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
f2b843c
Parents:
d760c0a
Message:

custom model now update as soon as it is compiled

Location:
fittingview/src/sans/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fittingview/src/sans/perspectives/fitting/fitpanel.py

    r09b3505 r916f5c0  
    127127            self.model_list_box = temp 
    128128        return temp 
    129  
     129     
     130    def reset_pmodel_list(self): 
     131        """ 
     132        """ 
     133        temp = self.menu_mng.pulgins_reset() 
     134        if len(temp): 
     135            self.model_list_box = temp 
     136        return temp 
     137     
    130138    def get_page_by_id(self, uid):   
    131139        """ 
  • fittingview/src/sans/perspectives/fitting/models.py

    r5d1c1f4 r916f5c0  
    175175        """ 
    176176        if name not in self.mydict.keys(): 
    177             self.mydict[name] = mylist 
     177            self.reset_list(name, mylist) 
    178178             
     179    def reset_list(self, name, mylist): 
     180        """ 
     181        :param name: the type of the list 
     182        :param mylist: the list to add 
     183        """ 
     184        self.mydict[name] = mylist          
    179185             
    180186    def get_list(self): 
     
    466472        is_modified = False 
    467473        if os.path.isdir(PLUGIN_DIR): 
    468             # getmtime doesn't seem to work well: use getatime 
    469             temp =  os.path.getatime(PLUGIN_DIR) 
     474            temp =  os.path.getmtime(PLUGIN_DIR) 
    470475            if  self.last_time_dir_modified != temp: 
    471476                is_modified = True 
     
    490495            return {} 
    491496     
    492               
     497    def pulgins_reset(self): 
     498        """ 
     499        return a dictionary of model 
     500        """ 
     501        self.plugins = [] 
     502        new_plugins = _findModels(dir) 
     503        for name, plug in  new_plugins.iteritems(): 
     504            for stored_name, stored_plug in self.stored_plugins.iteritems(): 
     505                if name == stored_name: 
     506                    del self.stored_plugins[name] 
     507                    break 
     508            self.stored_plugins[name] = plug 
     509            self.plugins.append(plug) 
     510        from sans.models.ReflectivityModel import ReflectivityModel 
     511        from sans.models.ReflectivityIIModel import ReflectivityIIModel 
     512        self.plugins.append(ReflectivityModel) 
     513        self.plugins.append(ReflectivityIIModel) 
     514        self.model_combobox.reset_list("Customized Models", self.plugins) 
     515        return self.model_combobox.get_list() 
     516        
    493517    def populate_menu(self, modelmenu, event_owner): 
    494518        """ 
     
    681705        return self.__modelmanager.update() 
    682706     
     707    def pulgins_reset(self): 
     708        return self.__modelmanager.pulgins_reset() 
     709     
    683710    def populate_menu(self, modelmenu, event_owner): 
    684711        return self.__modelmanager.populate_menu(modelmenu, event_owner) 
Note: See TracChangeset for help on using the changeset viewer.