Changeset 1c66bc5 in sasview for sansview


Ignore:
Timestamp:
Sep 8, 2008 5:16:37 PM (16 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:
aa92772
Parents:
bee885e
Message:

working on pluging model

Location:
sansview/perspectives
Files:
1 added
2 edited

Legend:

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

    r060b857 r1c66bc5  
    9090            self.fit_page_name = page_title 
    9191            return panel 
     92         
     93         
    9294    def add_model_page(self,model,page_title): 
    93         print "fitpanel: self.draw_model_name",self.draw_model_name 
     95        """ 
     96            Add a model page only one  to display any model selected from the menu or the page combo box. 
     97            when this page is closed than the user will be able to open a new one 
     98            @param model: the model for which paramters will be changed 
     99            @param page_title: the name of the page 
     100        """ 
    94101        if  page_title !=self.draw_model_name or self.draw_model_name ==None:  
    95             print "went here" 
    96102            from modelpage import ModelPage 
    97103            panel = ModelPage(self.nb,model, -1) 
     
    102108            self.draw_model_name=page_title 
    103109        else: 
    104             print "fitpanel: a page was added already " 
    105110            for i in range(self.nb.GetPageCount()): 
    106111                if self.nb.GetPageText(i)==self.page_name: 
     
    110115                 
    111116            
    112    
    113117    def get_notebook(self): 
    114118        """ 
  • sansview/perspectives/fitting/models.py

    r060b857 r1c66bc5  
    44 
    55(ModelEvent, EVT_MODEL) = wx.lib.newevent.NewEvent() 
    6  
     6def _findModels(dir): 
     7    # List of plugin objects 
     8    plugins = [] 
     9    # Go through files in plug-in directory 
     10    try: 
     11        list = os.listdir(dir) 
     12        for item in list: 
     13            toks = os.path.splitext(os.path.basename(item)) 
     14            if toks[1]=='.py' and not toks[0]=='__init__': 
     15                name = toks[0] 
     16             
     17                path = [os.path.abspath(dir)] 
     18                file = None 
     19                try: 
     20                    (file, path, info) = imp.find_module(name, path) 
     21                    module = imp.load_module( name, file, item, info ) 
     22                    if hasattr(module, "Model"): 
     23                        try: 
     24                            plugins.append(module.Model) 
     25                        except: 
     26                            log("Error accessing Model in %s\n  %s" % (name, sys.exc_value)) 
     27                except: 
     28                    pass 
     29                finally: 
     30                    if not file==None: 
     31                        file.close() 
     32    except: 
     33        pass 
     34    return plugins 
    735 
    836 
Note: See TracChangeset for help on using the changeset viewer.