Changeset b609c34 in sasview


Ignore:
Timestamp:
Mar 18, 2016 10:42:04 AM (9 years ago)
Author:
ajj
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:
66f21cd
Parents:
cde9d7d (diff), fce0139 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into sasmodels-integration

Files:
4 added
2 deleted
30 edited
6 moved

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/source/conf.py

    rd85c194 r82bc7a9  
    201201# -- Options for LaTeX output -------------------------------------------------- 
    202202 
     203LATEX_PREAMBLE=r""" 
     204\renewcommand{\AA}{\text{\r{A}}} % Allow \AA in math mode 
     205\usepackage[utf8]{inputenc}      % Allow unicode symbols in text 
     206\DeclareUnicodeCharacter {00B7} {\ensuremath{\cdot}}   % cdot 
     207\DeclareUnicodeCharacter {00B0} {\ensuremath{^\circ}}  % degrees 
     208\DeclareUnicodeCharacter {212B} {\AA}                  % Angstrom 
     209""" 
    203210latex_elements = { 
    204211# The paper size ('letterpaper' or 'a4paper'). 
    205 #'papersize': 'letterpaper', 
     212'papersize': 'a4paper', 
    206213 
    207214# The font size ('10pt', '11pt' or '12pt'). 
     
    209216 
    210217# Additional stuff for the LaTeX preamble. 
    211 #'preamble': '', 
     218'preamble': LATEX_PREAMBLE 
     219 
    212220} 
    213221 
  • docs/sphinx-docs/source/user/user.rst

    re0bbb7c re479a9f  
    88 
    99   Model Documentation <models/model_functions> 
     10    
     11   Tools <tools> 
     12    
     13   Types of Analysis <analysis> 
    1014 
    1115   Data Formats <sasgui/guiframe/data_formats_help> 
     
    1418    
    1519   Plotting Data/Models <sasgui/guiframe/graph_help> 
    16     
    17    Fitting Perspective <sasgui/perspectives/fitting/fitting> 
    18     
    19    P(r) Inversion Perspective <sasgui/perspectives/pr/pr_help> 
    20     
    21    Invariant Calculation Perspective <sasgui/perspectives/invariant/invariant_help> 
    22     
    23    Data Operations Tool <sasgui/perspectives/calculator/data_operator_help> 
    2420       
    25    Density/Volume Calculator Tool <sasgui/perspectives/calculator/density_calculator_help> 
    26     
    27    Generic SANS Calculator Tool <sasgui/perspectives/calculator/sas_calculator_help> 
    28     
    29    Image Viewer Tool <sasgui/perspectives/calculator/image_viewer_help> 
    30     
    31    Kiessig Thickness Calculator Tool <sasgui/perspectives/calculator/kiessig_calculator_help> 
    32     
    33    SLD Calculator Tool <sasgui/perspectives/calculator/sld_calculator_help> 
    34     
    35    Slit Size Calculator Tool <sasgui/perspectives/calculator/slit_calculator_help> 
    36     
    37    Q Resolution Estimator Tool <sasgui/perspectives/calculator/resolution_calculator_help> 
    38     
    39    Python Shell Tool <sasgui/perspectives/calculator/python_shell_help> 
    40  
    4121   Test Data <../test/testdata_help.rst> 
  • src/examples/test_chisq_panel.py

    rd7bb526 rc10d9d6c  
    8686        dy = numpy.sqrt(100*numpy.abs(y))/100 
    8787 
    88     from sas.plottools.plottables import Data1D, Theory1D, Chisq , Graph 
     88    from sas.sasgui.plottools.plottables import Data1D, Theory1D, Chisq , Graph 
    8989    data = Data1D(x,y,dy=dy) 
    9090    data.xaxis('distance', 'm') 
  • src/sas/sascalc/data_util/qsmearing.py

    • Property mode changed from 100644 to 100755
    ra3f125f0 rfc18690  
    1414import sys 
    1515import sas.models.sas_extension.smearer as smearer 
    16 from sas.models.smearing_2d import Smearer2D 
     16from sas.sascalc.data_util.smearing_2d import Smearer2D 
    1717 
    1818def smear_selection(data1D, model = None): 
  • src/sas/sascalc/data_util/resolution.py

    • Property mode changed from 100644 to 100755
    r80ba1a2 rfdeabcc  
    189189 
    190190 
    191     Algorithm 
    192     --------- 
     191    Definition 
     192    ---------- 
    193193 
    194194    We are using the mid-point integration rule to assign weights to each 
     
    430430    Substituting: 
    431431 
    432         n_\text{extend} = (n-1) (\log q_\text{max} - \log q_n) 
     432         n_\text{extend} = (n-1) (\log q_\text{max} - \log q_n) 
    433433            / (\log q_n - log q_1) 
    434434    """ 
  • src/sas/sascalc/data_util/smearing_2d.py

    • Property mode changed from 100644 to 100755
  • src/sas/sascalc/fit/AbstractFitEngine.py

    rb699768 rfc18690  
    140140            do the following: :: 
    141141             
    142                 from sas.models.qsmearing import smear_selection 
     142                from sas.sascalc.data_util.qsmearing import smear_selection 
    143143                smearer = smear_selection(some_data) 
    144144                fitdata1d = FitData1D( x= [1,3,..,], 
  • src/sas/sascalc/pr/fit/AbstractFitEngine.py

    rb699768 rfc18690  
    140140            do the following: :: 
    141141             
    142                 from sas.models.qsmearing import smear_selection 
     142                from sas.sascalc.data_util.qsmearing import smear_selection 
    143143                smearer = smear_selection(some_data) 
    144144                fitdata1d = FitData1D( x= [1,3,..,], 
  • src/sas/sasgui/guiframe/data_processor.py

    rd85c194 rfce0139  
    1010The organization of the classes goes as: 
    1111 
    12 .. image::  ../../user/guiframe/BatchGridClassLayout.png 
     12#Path to this is:           /sasview/src/sas/sasgui/guiframe/data_processor.py 
     13#Path to image is:          /sasview/src/sas/sasgui/guiframe/media/BatchGridClassLayout.png 
     14.. image::  ./guiframe/media/BatchGridClassLayout.png 
    1315   :align:   center 
    1416 
  • src/sas/sasgui/guiframe/dummyapp.py

    rd85c194 rb080ba8  
    77from sas.sasgui.guiframe.plugin_base import PluginBase 
    88 
    9 class DummyView(gui_manager.ViewApp): 
     9class DummyView(gui_manager.SasViewApp): 
    1010    """ 
    1111    """ 
  • src/sas/sasgui/guiframe/gui_manager.py

    r0d534de rb080ba8  
    34803480 
    34813481if __name__ == "__main__": 
    3482     app = ViewApp(0) 
     3482    app = SasViewApp(0) 
    34833483    app.MainLoop() 
  • src/sas/sasgui/perspectives/fitting/batchfitpage.py

    rd85c194 rfc18690  
    1515 
    1616from sas.sasgui.perspectives.fitting.basepage import PageInfoEvent 
    17 from sas.models.qsmearing import smear_selection 
     17from sas.sascalc.data_util.qsmearing import smear_selection 
    1818from sas.sasgui.perspectives.fitting.fitpage import FitPage 
    1919from sas.sasgui.perspectives.fitting.fitpage import check_data_validity 
  • src/sas/sasgui/perspectives/fitting/fit_thread.py

    rd85c194 raac161f1  
    9696            #some mssg and reset progress bar. 
    9797 
     98            # Shouldn't this be re-raising? ConsoleUpdate doesn't act on it. 
     99            # raise KeyboardInterrupt 
    98100            if self.handler is not None: 
    99101                self.handler.stop(msg=msg) 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r7d265a8 rb609c34  
    2626from sas.sasgui.perspectives.fitting.basepage import BasicPage as BasicPage 
    2727from sas.sasgui.perspectives.fitting.basepage import PageInfoEvent as PageInfoEvent 
    28 from sas.models.qsmearing import smear_selection 
     28from sas.sascalc.data_util.qsmearing import smear_selection 
    2929from .basepage import ModelTextCtrl 
    3030 
  • src/sas/sasgui/perspectives/fitting/fitproblem.py

    rd85c194 rfc18690  
    1414################################################################################ 
    1515import copy 
    16 from sas.models.qsmearing import smear_selection 
     16from sas.sascalc.data_util.qsmearing import smear_selection 
    1717 
    1818class FitProblemComponent(object): 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    • Property mode changed from 100644 to 100755
    rd85c194 raac161f1  
    14831483        try: 
    14841484            index = 0 
     1485            # Update potential simfit page(s) 
     1486            if self.sim_page is not None: 
     1487                self.sim_page._on_fit_complete() 
     1488            if self.batch_page: 
     1489                self.batch_page._on_fit_complete() 
     1490            # Update all fit pages 
    14851491            for uid in page_id: 
    14861492                res = result[index] 
  • src/sas/sasgui/perspectives/fitting/pagestate.py

    rd85c194 rc10d9d6c  
    16131613 
    16141614        if state.data is None: 
    1615             data = sas.dataloader.data_info.Data1D(x=[], y=[]) 
     1615            data = sas.sascalc.dataloader.data_info.Data1D(x=[], y=[]) 
    16161616            return None 
    16171617        elif not state.data.is_data: 
     
    16261626 
    16271627            if issubclass(state.data.__class__, 
    1628                           sas.dataloader.data_info.Data1D): 
     1628                          sas.sascalc.dataloader.data_info.Data1D): 
    16291629                data = state.data 
    16301630                doc, sasentry = self._to_xml_doc(data) 
  • src/sas/sasgui/perspectives/fitting/simfitpage.py

    rd85c194 raac161f1  
    9191        ## selected mdoel to fit 
    9292        self.model_toFit = [] 
     93        ## Control the fit state 
     94        self.fit_started = False 
    9395        ## number of constraint 
    9496        self.nb_constraint = 0 
     
    423425 
    424426        """ 
     427        if self.fit_started: 
     428            self._stop_fit() 
     429            self.fit_started = False 
     430            return 
     431 
    425432        flag = False 
    426433        # check if the current page a simultaneous fit page or a batch page 
     
    439446                    self.manager.schedule_for_fit(value=1, uid=item[2]) 
    440447            try: 
     448                self.fit_started = True 
     449                wx.CallAfter(self.set_fitbutton) 
    441450                if not self.manager.onFit(uid=self.uid): 
    442451                    return 
     
    447456            msg = "Select at least one model check box to fit " 
    448457            wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 
     458 
     459    def _on_fit_complete(self): 
     460        """ 
     461        Set the completion flag and display the updated fit button label. 
     462        """ 
     463        self.fit_started = False 
     464        self.set_fitbutton() 
     465 
     466    def _stop_fit(self, event=None): 
     467        """ 
     468        Attempt to stop the fitting thread 
     469        """ 
     470        if event != None: 
     471            event.Skip() 
     472        self.manager.stop_fit(self.uid) 
     473        self.manager._reset_schedule_problem(value=0) 
     474        self._on_fit_complete() 
     475 
     476    def set_fitbutton(self): 
     477        """ 
     478        Set fit button label depending on the fit_started 
     479        """ 
     480        label = "Stop" if self.fit_started else "Fit" 
     481        color = "red" if self.fit_started else "black" 
     482 
     483        self.btFit.SetLabel(label) 
     484        self.btFit.SetForegroundColour(color) 
     485        self.btFit.Enable(True) 
    449486 
    450487    def _onHelp(self, event): 
  • src/sas/sasgui/perspectives/invariant/invariant.py

    rd85c194 rc10d9d6c  
    237237        else: 
    238238            msg = "invariant.save_file: the data being saved is" 
    239             msg += " not a sas.dataloader.data_info.Data1D object" 
     239            msg += " not a sas.sascalc.dataloader.data_info.Data1D object" 
    240240            raise RuntimeError, msg 
    241241 
  • src/sas/sasgui/perspectives/invariant/invariant_state.py

    rd85c194 rc10d9d6c  
    773773        """ 
    774774        if datainfo is None: 
    775             datainfo = sas.dataloader.data_info.Data1D(x=[], y=[]) 
    776         elif not issubclass(datainfo.__class__, sas.dataloader.data_info.Data1D): 
     775            datainfo = sas.sascalc.dataloader.data_info.Data1D(x=[], y=[]) 
     776        elif not issubclass(datainfo.__class__, sas.sascalc.dataloader.data_info.Data1D): 
    777777            msg = "The cansas writer expects a Data1D" 
    778778            msg += " instance: %s" % str(datainfo.__class__.__name__) 
  • src/sas/sasgui/perspectives/pr/pr.py

    rd85c194 rc10d9d6c  
    896896        # First, check that the data is of the right type 
    897897        if issubclass(self.current_plottable.__class__, 
    898                       sas.dataloader.data_info.Data1D): 
     898                      sas.sascalc.dataloader.data_info.Data1D): 
    899899            self.state_reader.write(filepath, self.current_plottable, prstate) 
    900900        else: 
  • test/sasdataloader/test/utest_smearing.py

    rb699768 rfc18690  
    99from sas.sascalc.dataloader.data_info import Data1D, Data2D 
    1010#from DataLoader.qsmearing import SlitSmearer, QSmearer, smear_selection 
    11 from sas.models.qsmearing import SlitSmearer, QSmearer, smear_selection 
     11from sas.sascalc.data_util.qsmearing import SlitSmearer, QSmearer, smear_selection 
    1212from sas.models.SphereModel import SphereModel 
    1313import os.path 
  • test/sasfit/test/batch_fit.py

    rb699768 rfc18690  
    66from sas.models.CylinderModel import CylinderModel 
    77import sas.models.dispersion_models  
    8 from sas.models.qsmearing import smear_selection 
     8from sas.sascalc.data_util.qsmearing import smear_selection 
    99 
    1010NPTS = 1 
  • test/sasfit/test/utest_fit_smeared.py

    rb699768 rfc18690  
    1010from sas.sascalc.fit.BumpsFitting import BumpsFit as Fit 
    1111from sas.sascalc.dataloader.loader import Loader 
    12 from sas.models.qsmearing import smear_selection 
     12from sas.sascalc.data_util.qsmearing import smear_selection 
    1313from sas.models.CylinderModel import CylinderModel 
    1414from sas.models.SphereModel import SphereModel 
  • .gitignore

    rbc873053 r02098e3  
    1313.pydevproject 
    1414.vagrant 
     15.idea 
     16build 
     17dist 
     18sasview.egg-info 
     19sasview.egg-info 
     20 
    1521.mplconfig 
     22doctrees 
     23html 
     24build 
    1625 
    1726/setup.cfg 
    1827 
    1928/dist 
    20 /build 
     29**/build 
    2130sasview.egg-info 
    2231sasview-install 
     
    4150/test/sasdataloader/test/plugins.zip 
    4251/test/sasdataloader/test/test_log.txt 
     52 
  • run.py

    rb699768 r50a77df  
    104104    addpath(joinpath(root, 'src')) 
    105105 
     106    # sasmodels on the path 
     107    addpath(joinpath(root, '../sasmodels/')) 
     108 
    106109    # Import the sasview package from root/sasview as sas.sasview.  It would 
    107110    # be better to just store the package in src/sas/sasview. 
  • sasview/default_categories.json

    rdb46d13 r26d5aa5  
    1 {"Shapes": [["BarBellModel", true], ["PearlNecklaceModel", true], ["HollowCylinderModel", true], ["CoreMultiShellModel", true], ["FCCrystalModel", true], ["ParallelepipedModel", true], ["FuzzySphereModel", true], ["CoreShellEllipsoidXTModel", true], ["LamellarPCrystalModel", true], ["BCCrystalModel", true], ["EllipticalCylinderModel", true], ["RectangularHollowPrismInfThinWallsModel", true], ["CSParallelepipedModel", true], ["OnionExpShellModel", true], ["MultiShellModel", true], ["RaspBerryModel", true], ["CoreShellEllipsoidModel", true], ["CappedCylinderModel", true], ["CylinderModel", true], ["SphericalSLDModel", true], ["SCCrystalModel", true], ["StackedDisksModel", true], ["LamellarPSHGModel", true], ["CoreShellBicelleModel", true], ["RectangularHollowPrismModel", true], ["LamellarPSModel", true], ["EllipsoidModel", true], ["SphereModel", true], ["VesicleModel", true], ["TriaxialEllipsoidModel", true], ["LamellarModel", true], ["PringlesModel", true], ["RectangularPrismModel", true], ["CoreShellCylinderModel", true], ["BinaryHSModel", true], ["FlexibleCylinderModel", true], ["LamellarFFHGModel", true], ["FlexCylEllipXModel", true], ["LinearPearlsModel", true], ["CoreShellModel", true]], "Structure Factor": [["SquareWellStructure", true], ["HayterMSAStructure", true], ["HardsphereStructure", true], ["StickyHSStructure", true]], "Shape-Independent": [["TwoPowerLawModel", true], ["GelFitModel", true], ["DABModel", true], ["PowerLawAbsModel", true], ["PorodModel", true], ["GuinierModel", true], ["RPA10Model", true], ["TeubnerStreyModel", true], ["StarPolymer", true], ["UnifiedPowerRgModel", true], ["MassSurfaceFractal", true], ["Core2ndMomentModel", true], ["TwoLorentzianModel", true], ["DebyeModel", true], ["MassFractalModel", true], ["GuinierPorodModel", true], ["CorrLengthModel", true], ["PolymerExclVolume", true], ["FractalModel", true], ["PeakLorentzModel", true], ["BroadPeakModel", true], ["FractalCoreShellModel", true], ["PeakGaussModel", true], ["BEPolyelectrolyte", true], ["Poly_GaussCoil", true], ["SurfaceFractalModel", true], ["GaussLorentzGelModel", true], ["LorentzModel", true]], "Uncategorized": [["ReflectivityModel", true], ["ReflectivityIIModel", true], ["LineModel", true], ["MicelleSphCoreModel", true]]} 
     1{"Shapes": [["cylinder", true], ["lamellarPC", true], ["core_shell_cylinder", true], ["barbell", true], ["fuzzy_sphere", true], ["sphere", true], ["triaxial_ellipsoid", true], ["rectangular_prism", true], ["core_shell_bicelle", true], ["flexible_cylinder", true], ["hollow_rectangular_prism", true], ["ellipsoid", true], ["flexible_cylinder_ex", true], ["capped_cylinder", true], ["core_shell_ellipsoid", true], ["core_shell_parallelepiped", true], ["core_shell_ellipsoid_xt", true], ["vesicle", true], ["core_shell_sphere", true], ["parallelepiped", true], ["hollow_cylinder", true], ["linear_pearls", true], ["pearl_necklace", true], ["lamellar", true], ["multi_shell", true], ["hollow_rectangular_prism_infinitely_thin_walls", true], ["sc_crystal", true], ["stacked_disks", true]], "Structure Factor": [["stickyhardsphere", true], ["hayter_msa", true], ["squarewell", true], ["hardsphere", true]], "Shape-Independent": [["guinier", true], ["gel_fit", true], ["teubner_strey", true], ["gaussian_peak", true], ["mono_gauss_coil", true], ["mass_surface_fractal", true], ["adsorbed_layer", true], ["two_lorentzian", true], ["correlation_length", true], ["dab", true], ["poly_gauss_coil", true], ["guinier_porod", true], ["star_polymer", true], ["two_power_law", true], ["power_law", true], ["peak_lorentz", true], ["rpa", true], ["broad_peak", true], ["surface_fractal", true], ["be_polyelectrolyte", true], ["mass_fractal", true], ["polymer_excl_volume", true], ["porod", true], ["gauss_lorentz_gel", true], ["lorentz", true], ["fractal_core_shell", true]], "Uncategorized": [["line", true], ["fcc_paracrystal", true], ["elliptical_cylinder", true], ["lamellarPS", true], ["micelle_spherical_core", true], ["lamellar_FFHG", true], ["bcc_paracrystal", true], ["sphere (python)", true], ["lamellarCailleHG", true]]} 
  • sasview/setup_mac.py

    r55c7d4b rbd971ec  
    44Usage: 
    55    python setup.py py2app 
    6      
    7      
     6 
     7 
    88NOTES: 
    99   12/01/2011: When seeing an error related to pytz.zoneinfo not being found, change the following line in py2app/recipes/matplotlib.py 
     
    1313from setuptools import setup 
    1414import periodictable.xsf 
    15 import sas.sascalc.dataloader.readers  
     15import sas.sascalc.dataloader.readers 
    1616import os 
    1717import string 
     
    5454for item in lib_locs: 
    5555    libxml_path_test = '%s/libxml2.2.dylib' % item 
    56     if os.path.isfile(libxml_path_test):  
     56    if os.path.isfile(libxml_path_test): 
    5757        libxml_path = libxml_path_test 
    5858if libxml_path == None: 
     
    7474else: 
    7575    raise Exception("You must first build the documentation before creating an installer.") 
    76      
     76 
    7777# locate file extensions 
    7878def find_extension(): 
     
    102102            file_type, ext = string.split(item, "|*.", 1) 
    103103            if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list: 
    104                 list.append(ext)  
     104                list.append(ext) 
    105105    except: 
    106106        pass 
    107      
     107 
    108108    return list 
    109109 
    110110EXTENSIONS_LIST = find_extension() 
    111111 
    112   
     112 
    113113plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=EXTENSIONS_LIST, 
    114114                                         CFBundleTypeIconFile=ICON, 
     
    131131           'packages': ['lxml','numpy', 'scipy', 'pytz', 'encodings', 
    132132                        'encodings','matplotlib', 'periodictable', 
    133                         'reportlab' 
     133                        'reportlab','sasmodels' 
    134134                        ], 
    135135           'iconfile': ICON, 
     
    153153os.system('cd dist && ../../build_tools/dmgpack.sh "%s" "%s.app"'%(DMGNAME,APPNAME)) 
    154154os.system('chmod a+r "%s"'%DMG) 
    155  
  • setup.py

    re0bbb7c re5ea2d0  
    252252model_dir = os.path.join("src", "sas","models") 
    253253 
    254 if os.path.isdir(wrapper_dir): 
    255     for file in os.listdir(wrapper_dir):  
    256         file_path =  os.path.join(wrapper_dir, file) 
    257         os.remove(file_path) 
    258 else: 
    259     os.makedirs(wrapper_dir) 
    260 sys.path.append(os.path.join("src", "sas", "models", "c_extension", "python_wrapper")) 
    261 from wrapping import generate_wrappers 
    262 generate_wrappers(header_dir = includedir,  
    263                   output_dir = model_dir, 
    264                   c_wrapper_dir = wrapper_dir) 
     254#if os.path.isdir(wrapper_dir): 
     255#    for file in os.listdir(wrapper_dir): 
     256#        file_path =  os.path.join(wrapper_dir, file) 
     257#        os.remove(file_path) 
     258#else: 
     259#    os.makedirs(wrapper_dir) 
     260#sys.path.append(os.path.join("src", "sas", "models", "c_extension", "python_wrapper")) 
     261#from wrapping import generate_wrappers 
     262#generate_wrappers(header_dir = includedir, 
     263#                  output_dir = model_dir, 
     264#                  c_wrapper_dir = wrapper_dir) 
    265265 
    266266IGNORED_FILES = [".svn"] 
     
    291291model_sources = [] 
    292292append_file(file_list=model_sources, dir_path=igordir) 
    293 append_file(file_list=model_sources, dir_path=c_model_dir) 
    294 append_file(file_list=model_sources, dir_path=wrapper_dir) 
     293#append_file(file_list=model_sources, dir_path=c_model_dir) 
     294#append_file(file_list=model_sources, dir_path=wrapper_dir) 
    295295 
    296296smear_sources = [] 
     
    311311 
    312312c_models = [  
    313     Extension("sas.models.sas_extension.c_models", 
    314         sources=model_sources,                  
    315         include_dirs=[ 
    316             igordir, includedir, c_model_dir, numpy_incl_path, cephes_dir 
    317         ], 
    318     ), 
     313    #Extension("sas.models.sas_extension.c_models", 
     314    #    sources=model_sources, 
     315    #    include_dirs=[ 
     316    #        igordir, includedir, c_model_dir, numpy_incl_path, cephes_dir 
     317    #    ], 
     318    #), 
    319319 
    320320    # Smearer extension 
     
    348348ext_modules.extend(c_models) 
    349349 
     350packages.append("sas.models") 
    350351# SasView 
    351352 
     
    358359                               'test/save_states/*', 
    359360                               'test/upcoming_formats/*',  
    360                                'default_categories.json'] 
     361                                 'default_categories.json'] 
    361362packages.append("sas.sasview") 
    362363 
  • src/sas/models/dispersion_models.py

    rfd5ac0d r0e4e554  
    154154        c_models.set_dispersion_weights(self.cdisp, values, weights) 
    155155         
    156 models = {"gaussian":GaussianDispersion,  "rectangula":RectangleDispersion, 
     156models = {"gaussian":GaussianDispersion,  "rectangular":RectangleDispersion, 
    157157          "array":ArrayDispersion, "schulz":SchulzDispersion,  
    158158          "lognormal":LogNormalDispersion}        
  • src/sas/sasgui/perspectives/calculator/model_editor.py

    rd85c194 rec36e48  
    110110        self.plugin_dir = plugin_dir 
    111111        self.model_list = model_list 
    112         self.model1_string = "SphereModel" 
    113         self.model2_string = "CylinderModel" 
     112        self.model1_string = "sphere" 
     113        self.model2_string = "cylinder" 
    114114        self.name = 'Sum' + M_NAME 
    115115        self.factor = 'scale_factor' 
     
    574574                    if not self.is_p1_custom: 
    575575                        line = line.replace('#', '') 
    576                         out_f.write(line % (name1, name1) + "\n") 
     576                        out_f.write(line % (name1) + "\n") 
    577577                    else: 
    578578                        out_f.write(line + "\n") 
     
    586586                    if not self.is_p2_custom: 
    587587                        line = line.replace('#', '') 
    588                         out_f.write(line % (name2, name2) + "\n") 
     588                        out_f.write(line % (name2) + "\n") 
    589589                    else: 
    590590                        out_f.write(line + "\n") 
     591                elif line.count("P1 = make_class"): 
     592                    out_f.write(line % (name1) + "\n") 
     593                elif line.count("P2 = make_class"): 
     594                    out_f.write(line % (name2) + "\n") 
     595 
    591596                elif line.count("self.description = '%s'"): 
    592597                    out_f.write(line % description + "\n") 
     
    12631268import copy 
    12641269from sas.models.pluginmodel import Model1DPlugin 
     1270from sasmodels.sasview_model import make_class 
     1271from sasmodels.core import load_model_info 
    12651272# User can change the name of the model (only with single functional model) 
    12661273#P1_model: 
    1267 #from sas.models.%s import %s as P1 
    12681274#from %s import Model as P1 
    12691275 
    12701276#P2_model: 
    1271 #from sas.models.%s import %s as P2 
    12721277#from %s import Model as P2 
    12731278import os 
     
    12781283    def __init__(self): 
    12791284        Model1DPlugin.__init__(self, name='') 
     1285        P1 = make_class(load_model_info('%s')) 
     1286        P2 = make_class(load_model_info('%s')) 
    12801287        p_model1 = P1() 
    12811288        p_model2 = P2() 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rd85c194 rbac3988  
    5757    ## Title to appear on top of the window 
    5858    window_caption = "Fit Page " 
     59 
    5960    # These two buttons have specific IDs since they seem to be created more 
    6061    # frequently than they need to.  In particular, set_dispers_sizer() is 
     
    12811282            else: 
    12821283                self.model_view.SetLabel("1D Mode") 
    1283          
     1284 
    12841285        ## set the select all check box to the a given state 
    12851286        self.cb1.SetValue(state.cb1) 
     
    13791380            if disp.__class__.__name__ == 'str': 
    13801381                disp_model = None 
    1381                 com_str = "from sas.models.dispersion_models " 
     1382                com_str = "from sasmodels.weights " 
    13821383                com_str += "import %s as disp_func \ndisp_model = disp_func()" 
    13831384                exec com_str % disp 
     
    19031904                        m_list.append(self.model_dict[model]) 
    19041905                    #else: 
    1905                     #    msg = "This model is disabled by Category Manager."  
     1906                    #    msg = "This model is disabled by Category Manager." 
    19061907                    #    wx.PostEvent(self.parent.parent, 
    19071908                    #                 StatusEvent(status=msg, info="error")) 
     
    19441945            name = model.__class__.__name__ 
    19451946            if models.__name__ != "NoStructure": 
    1946                 if hasattr(model, "name"): 
    1947                     name = model.name 
     1947                name = model.name 
    19481948                mlist.append((name, models)) 
    19491949 
     
    24142414        self._draw_model() 
    24152415        ## Need to use FitInside again here to replace the next four lines. 
    2416         ## Otherwised polydispersity off does not resize the scrollwindow.  
     2416        ## Otherwised polydispersity off does not resize the scrollwindow. 
    24172417        ## PDB Nov 28, 2015 
    24182418        self.FitInside() 
     
    24592459        self.weights = {} 
    24602460 
    2461         from sas.models.dispersion_models import GaussianDispersion 
     2461        #from sas.models.dispersion_models import GaussianDispersion 
     2462        from sasmodels.weights import GaussianDispersion 
    24622463        if len(self.disp_cb_dict) == 0: 
    24632464            self.save_current_state() 
     
    29662967        self.Show(False) 
    29672968        self.set_model_param_sizer(self.model) 
    2968         #self._set_sizer_dispersion()  
     2969        #self._set_sizer_dispersion() 
    29692970        self.state.magnetic_on = self.magnetic_on 
    29702971        self.SetupScrolling() 
     
    35873588        cat_tip = "Modify model categories \n" 
    35883589        cat_tip += "(also accessible from the menu bar)." 
    3589         show_cat_button.SetToolTip(wx.ToolTip(cat_tip)) 
     3590        show_cat_button.SetToolTip( wx.ToolTip(cat_tip) ) 
    35903591        show_cat_button.Bind(wx.EVT_BUTTON, self._on_modify_cat) 
    35913592        sizer_cat_box.Add(self.categorybox, 1, wx.RIGHT, 3) 
    3592         sizer_cat_box.Add((10, 10)) 
     3593        sizer_cat_box.Add((10,10)) 
    35933594        sizer_cat_box.Add(show_cat_button) 
    35943595        #self.shape_rbutton.SetValue(True) 
     
    35973598        #sizer_radiobutton.Add(self.shape_rbutton) 
    35983599        #sizer_radiobutton.Add(self.shape_indep_rbutton) 
    3599         sizer_radiobutton.Add((5, 5)) 
     3600        sizer_radiobutton.Add((5,5)) 
    36003601        sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 5) 
    36013602        #sizer_radiobutton.Add(self.plugin_rbutton) 
     
    38133814        event.Skip() 
    38143815        #pass 
    3815  
  • src/sas/sasgui/perspectives/fitting/fitpanel.py

    rd85c194 rf66d9d1  
    120120        """ 
    121121        """ 
    122         temp = self.menu_mng.pulgins_reset() 
     122        temp = self.menu_mng.plugins_reset() 
    123123        if len(temp): 
    124124            self.model_list_box = temp 
  • src/sas/sasgui/perspectives/fitting/models.py

    r4ee041f rcde9d7d  
    66import os 
    77import sys 
     8import math 
    89import os.path 
    910# Time is needed by the log method 
     
    1213import py_compile 
    1314import shutil 
     15from sas.sasgui.guiframe.events import StatusEvent 
    1416# Explicitly import from the pluginmodel module so that py2exe 
    1517# places it in the distribution. The Model1DPlugin class is used 
    1618# as the base class of plug-in models. 
    1719from sas.models.pluginmodel import Model1DPlugin 
     20from sas.models.BaseComponent import BaseComponent 
    1821from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
     22from sasmodels.sasview_model import make_class 
     23import sasmodels.core 
     24 
    1925 
    2026PLUGIN_DIR = 'plugin_models' 
     
    251257    ## dictionary of structure factor models 
    252258    struct_factor_dict = {} 
    253     ##list of shape models -- this is superseded by categories 
    254 #    shape_list = [] 
    255     ## shape independent model list-- this is superseded by categories 
    256 #    shape_indep_list = [] 
    257259    ##list of structure factors 
    258260    struct_list = [] 
     
    294296        """ 
    295297 
    296         ## NOTE: as of April 26, 2014, as part of first pass on fixing categories, 
    297         ## all the appends to shape_list or shape_independent_list are 
    298         ## commented out.  They should be possible to remove.  They are in 
    299         ## fact a "category" of model whereas the other list are actually 
    300         ## "attributes" of a model.  In other words is it a structure factor 
    301         ## that can be used against a form factor, is it a form factor that is 
    302         ## knows how to be multiplied by a structure factor, does it have user 
    303         ## defined number of parameters, etc. 
    304         ## 
    305         ## We hope this whole list will be superseded by the new C models 
    306         ## structure where each model will provide a method to interrogate it 
    307         ## about its "attributes" -- then this long list becomes a loop reading 
    308         ## each model in the category list to populate the "attribute"lists. 
    309         ## We should also refactor the whole category vs attribute list 
    310         ## structure when doing this as now the attribute lists think they are 
    311         ## also category lists. 
    312         ## 
    313         ##   -PDB  April 26, 2014 
    314  
    315298        # regular model names only 
    316299        base_message = "Unable to load model {0}" 
    317300        self.model_name_list = [] 
    318         try: 
    319             from sas.models.SphereModel import SphereModel 
    320             self.model_dictionary[SphereModel.__name__] = SphereModel 
    321             #        self.shape_list.append(SphereModel) 
    322             self.multiplication_factor.append(SphereModel) 
    323             self.model_name_list.append(SphereModel.__name__) 
    324         except: 
    325             logging.error(base_message.format(SphereModel.__name__)) 
    326  
    327         try: 
    328             from sas.models.BinaryHSModel import BinaryHSModel 
    329             self.model_dictionary[BinaryHSModel.__name__] = BinaryHSModel 
    330             #        self.shape_list.append(BinaryHSModel) 
    331             self.model_name_list.append(BinaryHSModel.__name__) 
    332         except: 
    333             logging.error(base_message.format(BinaryHSModel.__name__)) 
    334  
    335         try: 
    336             from sas.models.FuzzySphereModel import FuzzySphereModel 
    337             self.model_dictionary[FuzzySphereModel.__name__] = FuzzySphereModel 
    338             #        self.shape_list.append(FuzzySphereModel) 
    339             self.multiplication_factor.append(FuzzySphereModel) 
    340             self.model_name_list.append(FuzzySphereModel.__name__) 
    341         except: 
    342             logging.error(base_message.format(FuzzySphereModel.__name__)) 
    343  
    344         try: 
    345             from sas.models.RaspBerryModel import RaspBerryModel 
    346             self.model_dictionary[RaspBerryModel.__name__] = RaspBerryModel 
    347             #        self.shape_list.append(RaspBerryModel) 
    348             self.model_name_list.append(RaspBerryModel.__name__) 
    349         except: 
    350             logging.error(base_message.format(RaspBerryModel.__name__)) 
    351  
    352         try: 
    353             from sas.models.CoreShellModel import CoreShellModel 
    354  
    355             self.model_dictionary[CoreShellModel.__name__] = CoreShellModel 
    356             #        self.shape_list.append(CoreShellModel) 
    357             self.multiplication_factor.append(CoreShellModel) 
    358             self.model_name_list.append(CoreShellModel.__name__) 
    359         except: 
    360             logging.error(base_message.format(CoreShellModel.__name__)) 
    361  
    362         try: 
    363             from sas.models.Core2ndMomentModel import Core2ndMomentModel 
    364             self.model_dictionary[Core2ndMomentModel.__name__] = Core2ndMomentModel 
    365             #        self.shape_list.append(Core2ndMomentModel) 
    366             self.model_name_list.append(Core2ndMomentModel.__name__) 
    367         except: 
    368             logging.error(base_message.format(Core2ndMomentModel.__name__)) 
    369              
    370         try: 
    371             from sas.models.CoreMultiShellModel import CoreMultiShellModel 
    372             self.model_dictionary[CoreMultiShellModel.__name__] = CoreMultiShellModel 
    373             #        self.shape_list.append(CoreMultiShellModel) 
    374             self.multiplication_factor.append(CoreMultiShellModel) 
    375             self.multi_func_list.append(CoreMultiShellModel) 
    376         except: 
    377             logging.error(base_message.format(CoreMultiShellModel.__name__)) 
    378  
    379         try: 
    380             from sas.models.VesicleModel import VesicleModel 
    381             self.model_dictionary[VesicleModel.__name__] = VesicleModel 
    382             #        self.shape_list.append(VesicleModel) 
    383             self.multiplication_factor.append(VesicleModel) 
    384             self.model_name_list.append(VesicleModel.__name__) 
    385         except: 
    386             logging.error(base_message.format(VesicleModel.__name__)) 
    387  
    388         try: 
    389             from sas.models.MultiShellModel import MultiShellModel 
    390             self.model_dictionary[MultiShellModel.__name__] = MultiShellModel 
    391             #        self.shape_list.append(MultiShellModel) 
    392             self.multiplication_factor.append(MultiShellModel) 
    393             self.model_name_list.append(MultiShellModel.__name__) 
    394         except: 
    395             logging.error(base_message.format(MultiShellModel.__name__)) 
    396  
    397         try: 
    398             from sas.models.OnionExpShellModel import OnionExpShellModel 
    399             self.model_dictionary[OnionExpShellModel.__name__] = OnionExpShellModel 
    400             #        self.shape_list.append(OnionExpShellModel) 
    401             self.multiplication_factor.append(OnionExpShellModel) 
    402             self.multi_func_list.append(OnionExpShellModel) 
    403         except: 
    404             logging.error(base_message.format(OnionExpShellModel.__name__)) 
    405  
    406         try: 
    407             from sas.models.SphericalSLDModel import SphericalSLDModel 
    408  
    409             self.model_dictionary[SphericalSLDModel.__name__] = SphericalSLDModel 
    410             #        self.shape_list.append(SphericalSLDModel) 
    411             self.multiplication_factor.append(SphericalSLDModel) 
    412             self.multi_func_list.append(SphericalSLDModel) 
    413         except: 
    414             logging.error(base_message.format(SphericalSLDModel.__name__)) 
    415  
    416         try: 
    417             from sas.models.LinearPearlsModel import LinearPearlsModel 
    418  
    419             self.model_dictionary[LinearPearlsModel.__name__] = LinearPearlsModel 
    420             #        self.shape_list.append(LinearPearlsModel) 
    421             self.model_name_list.append(LinearPearlsModel.__name__) 
    422         except: 
    423             logging.error(base_message.format(LinearPearlsModel.__name__)) 
    424  
    425         try: 
    426             from sas.models.PearlNecklaceModel import PearlNecklaceModel 
    427  
    428             self.model_dictionary[PearlNecklaceModel.__name__] = PearlNecklaceModel 
    429             #        self.shape_list.append(PearlNecklaceModel) 
    430             self.model_name_list.append(PearlNecklaceModel.__name__) 
    431         except: 
    432             logging.error(base_message.format(PearlNecklaceModel.__name__)) 
    433  
    434         try: 
    435             from sas.models.CylinderModel import CylinderModel 
    436  
    437             self.model_dictionary[CylinderModel.__name__] = CylinderModel 
    438             #        self.shape_list.append(CylinderModel) 
    439             self.multiplication_factor.append(CylinderModel) 
    440             self.model_name_list.append(CylinderModel.__name__) 
    441         except: 
    442             logging.error(base_message.format(CylinderModel.__name__)) 
    443  
    444         try: 
    445             from sas.models.CoreShellCylinderModel import CoreShellCylinderModel 
    446  
    447             self.model_dictionary[CoreShellCylinderModel.__name__] = CoreShellCylinderModel 
    448             #        self.shape_list.append(CoreShellCylinderModel) 
    449             self.multiplication_factor.append(CoreShellCylinderModel) 
    450             self.model_name_list.append(CoreShellCylinderModel.__name__) 
    451         except: 
    452             logging.error(base_message.format(CoreShellCylinderModel.__name__)) 
    453  
    454         try: 
    455             from sas.models.CoreShellBicelleModel import CoreShellBicelleModel 
    456  
    457             self.model_dictionary[CoreShellBicelleModel.__name__] = CoreShellBicelleModel 
    458             #        self.shape_list.append(CoreShellBicelleModel) 
    459             self.multiplication_factor.append(CoreShellBicelleModel) 
    460             self.model_name_list.append(CoreShellBicelleModel.__name__) 
    461         except: 
    462             logging.error(base_message.format(CoreShellBicelleModel.__name__)) 
    463  
    464         try: 
    465             from sas.models.HollowCylinderModel import HollowCylinderModel 
    466  
    467             self.model_dictionary[HollowCylinderModel.__name__] = HollowCylinderModel 
    468             #        self.shape_list.append(HollowCylinderModel) 
    469             self.multiplication_factor.append(HollowCylinderModel) 
    470             self.model_name_list.append(HollowCylinderModel.__name__) 
    471         except: 
    472             logging.error(base_message.format(HollowCylinderModel.__name__)) 
    473  
    474         try: 
    475             from sas.models.FlexibleCylinderModel import FlexibleCylinderModel 
    476  
    477             self.model_dictionary[FlexibleCylinderModel.__name__] = FlexibleCylinderModel 
    478             #        self.shape_list.append(FlexibleCylinderModel) 
    479             self.model_name_list.append(FlexibleCylinderModel.__name__) 
    480         except: 
    481             logging.error(base_message.format(FlexibleCylinderModel.__name__)) 
    482  
    483         try: 
    484             from sas.models.FlexCylEllipXModel import FlexCylEllipXModel 
    485  
    486             self.model_dictionary[FlexCylEllipXModel.__name__] = FlexCylEllipXModel 
    487             #        self.shape_list.append(FlexCylEllipXModel) 
    488             self.model_name_list.append(FlexCylEllipXModel.__name__) 
    489         except: 
    490             logging.error(base_message.format(FlexCylEllipXModel.__name__)) 
    491  
    492         try: 
    493             from sas.models.StackedDisksModel import StackedDisksModel 
    494  
    495             self.model_dictionary[StackedDisksModel.__name__] = StackedDisksModel 
    496             #        self.shape_list.append(StackedDisksModel) 
    497             self.multiplication_factor.append(StackedDisksModel) 
    498             self.model_name_list.append(StackedDisksModel.__name__) 
    499         except: 
    500             logging.error(base_message.format(StackedDisksModel.__name__)) 
    501  
    502         try: 
    503             from sas.models.ParallelepipedModel import ParallelepipedModel 
    504  
    505             self.model_dictionary[ParallelepipedModel.__name__] = ParallelepipedModel 
    506             #        self.shape_list.append(ParallelepipedModel) 
    507             self.multiplication_factor.append(ParallelepipedModel) 
    508             self.model_name_list.append(ParallelepipedModel.__name__) 
    509         except: 
    510             logging.error(base_message.format(ParallelepipedModel.__name__)) 
    511  
    512         try: 
    513             from sas.models.CSParallelepipedModel import CSParallelepipedModel 
    514  
    515             self.model_dictionary[CSParallelepipedModel.__name__] = CSParallelepipedModel 
    516             #        self.shape_list.append(CSParallelepipedModel) 
    517             self.multiplication_factor.append(CSParallelepipedModel) 
    518             self.model_name_list.append(CSParallelepipedModel.__name__) 
    519         except: 
    520             logging.error(base_message.format(CSParallelepipedModel.__name__)) 
    521  
    522         try: 
    523             from sas.models.EllipticalCylinderModel import EllipticalCylinderModel 
    524  
    525             self.model_dictionary[EllipticalCylinderModel.__name__] = EllipticalCylinderModel 
    526             #        self.shape_list.append(EllipticalCylinderModel) 
    527             self.multiplication_factor.append(EllipticalCylinderModel) 
    528             self.model_name_list.append(EllipticalCylinderModel.__name__) 
    529         except: 
    530             logging.error(base_message.format(EllipticalCylinderModel.__name__)) 
    531  
    532         try: 
    533             from sas.models.BarBellModel import BarBellModel 
    534  
    535             self.model_dictionary[BarBellModel.__name__] = BarBellModel 
    536             #       self.shape_list.append(BarBellModel) 
    537             self.model_name_list.append(BarBellModel.__name__) 
    538         except: 
    539             logging.error(base_message.format(BarBellModel.__name__)) 
    540  
    541         try: 
    542             from sas.models.CappedCylinderModel import CappedCylinderModel 
    543  
    544             self.model_dictionary[CappedCylinderModel.__name__] = CappedCylinderModel 
    545             #       self.shape_list.append(CappedCylinderModel) 
    546             self.model_name_list.append(CappedCylinderModel.__name__) 
    547         except: 
    548             logging.error(base_message.format(CappedCylinderModel.__name__)) 
    549  
    550         try: 
    551             from sas.models.EllipsoidModel import EllipsoidModel 
    552  
    553             self.model_dictionary[EllipsoidModel.__name__] = EllipsoidModel 
    554             #        self.shape_list.append(EllipsoidModel) 
    555             self.multiplication_factor.append(EllipsoidModel) 
    556             self.model_name_list.append(EllipsoidModel.__name__) 
    557         except: 
    558             logging.error(base_message.format(EllipsoidModel.__name__)) 
    559  
    560         try: 
    561             from sas.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel 
    562  
    563             self.model_dictionary[CoreShellEllipsoidModel.__name__] = CoreShellEllipsoidModel 
    564             #        self.shape_list.append(CoreShellEllipsoidModel) 
    565             self.multiplication_factor.append(CoreShellEllipsoidModel) 
    566             self.model_name_list.append(CoreShellEllipsoidModel.__name__) 
    567         except: 
    568             logging.error(base_message.format(CoreShellEllipsoidModel.__name__)) 
    569  
    570         try: 
    571             from sas.models.CoreShellEllipsoidXTModel import CoreShellEllipsoidXTModel 
    572  
    573             self.model_dictionary[CoreShellEllipsoidXTModel.__name__] = CoreShellEllipsoidXTModel 
    574             #        self.shape_list.append(CoreShellEllipsoidXTModel) 
    575             self.multiplication_factor.append(CoreShellEllipsoidXTModel) 
    576             self.model_name_list.append(CoreShellEllipsoidXTModel.__name__) 
    577         except: 
    578             logging.error(base_message.format(CoreShellEllipsoidXTModel.__name__)) 
    579  
    580         try: 
    581             from sas.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel 
    582  
    583             self.model_dictionary[TriaxialEllipsoidModel.__name__] = TriaxialEllipsoidModel 
    584             #        self.shape_list.append(TriaxialEllipsoidModel) 
    585             self.multiplication_factor.append(TriaxialEllipsoidModel) 
    586             self.model_name_list.append(TriaxialEllipsoidModel.__name__) 
    587         except: 
    588             logging.error(base_message.format(TriaxialEllipsoidModel.__name__)) 
    589  
    590         try: 
    591             from sas.models.LamellarModel import LamellarModel 
    592  
    593             self.model_dictionary[LamellarModel.__name__] = LamellarModel 
    594             #        self.shape_list.append(LamellarModel) 
    595             self.model_name_list.append(LamellarModel.__name__) 
    596         except: 
    597             logging.error(base_message.format(LamellarModel.__name__)) 
    598  
    599         try: 
    600             from sas.models.LamellarFFHGModel import LamellarFFHGModel 
    601  
    602             self.model_dictionary[LamellarFFHGModel.__name__] = LamellarFFHGModel 
    603             #        self.shape_list.append(LamellarFFHGModel) 
    604             self.model_name_list.append(LamellarFFHGModel.__name__) 
    605         except: 
    606             logging.error(base_message.format(LamellarFFHGModel.__name__)) 
    607  
    608         try: 
    609             from sas.models.LamellarPSModel import LamellarPSModel 
    610  
    611             self.model_dictionary[LamellarPSModel.__name__] = LamellarPSModel 
    612             #        self.shape_list.append(LamellarPSModel) 
    613             self.model_name_list.append(LamellarPSModel.__name__) 
    614         except: 
    615             logging.error(base_message.format(LamellarPSModel.__name__)) 
    616  
    617         try: 
    618             from sas.models.LamellarPSHGModel import LamellarPSHGModel 
    619  
    620             self.model_dictionary[LamellarPSHGModel.__name__] = LamellarPSHGModel 
    621             #        self.shape_list.append(LamellarPSHGModel) 
    622             self.model_name_list.append(LamellarPSHGModel.__name__) 
    623         except: 
    624             logging.error(base_message.format(LamellarPSHGModel.__name__)) 
    625  
    626         try: 
    627             from sas.models.LamellarPCrystalModel import LamellarPCrystalModel 
    628  
    629             self.model_dictionary[LamellarPCrystalModel.__name__] = LamellarPCrystalModel 
    630             #        self.shape_list.append(LamellarPCrystalModel) 
    631             self.model_name_list.append(LamellarPCrystalModel.__name__) 
    632         except: 
    633             logging.error(base_message.format(LamellarPCrystalModel.__name__)) 
    634  
    635         try: 
    636             from sas.models.SCCrystalModel import SCCrystalModel 
    637  
    638             self.model_dictionary[SCCrystalModel.__name__] = SCCrystalModel 
    639             #        self.shape_list.append(SCCrystalModel) 
    640             self.model_name_list.append(SCCrystalModel.__name__) 
    641         except: 
    642             logging.error(base_message.format(SCCrystalModel.__name__)) 
    643              
    644         try: 
    645             from sas.models.FCCrystalModel import FCCrystalModel 
    646  
    647             self.model_dictionary[FCCrystalModel.__name__] = FCCrystalModel 
    648             #        self.shape_list.append(FCCrystalModel) 
    649             self.model_name_list.append(FCCrystalModel.__name__) 
    650         except: 
    651             logging.error(base_message.format(FCCrystalModel.__name__)) 
    652  
    653         try: 
    654             from sas.models.BCCrystalModel import BCCrystalModel 
    655  
    656             self.model_dictionary[BCCrystalModel.__name__] = BCCrystalModel 
    657             #        self.shape_list.append(BCCrystalModel) 
    658             self.model_name_list.append(BCCrystalModel.__name__) 
    659         except: 
    660             logging.error(base_message.format(BCCrystalModel.__name__)) 
    661  
    662  
    663         ## Structure factor 
    664         try: 
    665             from sas.models.SquareWellStructure import SquareWellStructure 
    666  
    667             self.model_dictionary[SquareWellStructure.__name__] = SquareWellStructure 
    668             self.struct_list.append(SquareWellStructure) 
    669             self.model_name_list.append(SquareWellStructure.__name__) 
    670         except: 
    671             logging.error(base_message.format(SquareWellStructure.__name__)) 
    672  
    673         try: 
    674             from sas.models.HardsphereStructure import HardsphereStructure 
    675  
    676             self.model_dictionary[HardsphereStructure.__name__] = HardsphereStructure 
    677             self.struct_list.append(HardsphereStructure) 
    678             self.model_name_list.append(HardsphereStructure.__name__) 
    679         except: 
    680             logging.error(base_message.format(HardsphereStructure.__name__)) 
    681  
    682         try: 
    683             from sas.models.StickyHSStructure import StickyHSStructure 
    684  
    685             self.model_dictionary[StickyHSStructure.__name__] = StickyHSStructure 
    686             self.struct_list.append(StickyHSStructure) 
    687             self.model_name_list.append(StickyHSStructure.__name__) 
    688         except: 
    689             logging.error(base_message.format(StickyHSStructure.__name__)) 
    690  
    691         try: 
    692             from sas.models.HayterMSAStructure import HayterMSAStructure 
    693  
    694             self.model_dictionary[HayterMSAStructure.__name__] = HayterMSAStructure 
    695             self.struct_list.append(HayterMSAStructure) 
    696             self.model_name_list.append(HayterMSAStructure.__name__) 
    697         except: 
    698             logging.error(base_message.format(HayterMSAStructure.__name__)) 
    699  
    700  
    701  
    702         ##shape-independent models 
    703         try: 
    704             from sas.models.PowerLawAbsModel import PowerLawAbsModel 
    705  
    706             self.model_dictionary[PowerLawAbsModel.__name__] = PowerLawAbsModel 
    707             #        self.shape_indep_list.append(PowerLawAbsModel) 
    708             self.model_name_list.append(PowerLawAbsModel.__name__) 
    709         except: 
    710             logging.error(base_message.format(PowerLawAbsModel.__name__)) 
    711  
    712         try: 
    713             from sas.models.BEPolyelectrolyte import BEPolyelectrolyte 
    714  
    715             self.model_dictionary[BEPolyelectrolyte.__name__] = BEPolyelectrolyte 
    716             #        self.shape_indep_list.append(BEPolyelectrolyte) 
    717             self.model_name_list.append(BEPolyelectrolyte.__name__) 
    718             self.form_factor_dict[str(wx.NewId())] = [SphereModel] 
    719         except: 
    720             logging.error(base_message.format(BEPolyelectrolyte.__name__)) 
    721  
    722         try: 
    723             from sas.models.BroadPeakModel import BroadPeakModel 
    724  
    725             self.model_dictionary[BroadPeakModel.__name__] = BroadPeakModel 
    726             #        self.shape_indep_list.append(BroadPeakModel) 
    727             self.model_name_list.append(BroadPeakModel.__name__) 
    728         except: 
    729             logging.error(base_message.format(BroadPeakModel.__name__)) 
    730  
    731         try: 
    732             from sas.models.CorrLengthModel import CorrLengthModel 
    733  
    734             self.model_dictionary[CorrLengthModel.__name__] = CorrLengthModel 
    735             #        self.shape_indep_list.append(CorrLengthModel) 
    736             self.model_name_list.append(CorrLengthModel.__name__) 
    737         except: 
    738             logging.error(base_message.format(CorrLengthModel.__name__)) 
    739  
    740         try: 
    741             from sas.models.DABModel import DABModel 
    742  
    743             self.model_dictionary[DABModel.__name__] = DABModel 
    744             #        self.shape_indep_list.append(DABModel) 
    745             self.model_name_list.append(DABModel.__name__) 
    746         except: 
    747             logging.error(base_message.format(DABModel.__name__)) 
    748  
    749         try: 
    750             from sas.models.DebyeModel import DebyeModel 
    751  
    752             self.model_dictionary[DebyeModel.__name__] = DebyeModel 
    753             #        self.shape_indep_list.append(DebyeModel) 
    754             self.model_name_list.append(DebyeModel.__name__) 
    755         except: 
    756             logging.error(base_message.format(DebyeModel.__name__)) 
    757  
    758         try: 
    759             from sas.models.FractalModel import FractalModel 
    760  
    761             self.model_dictionary[FractalModel.__name__] = FractalModel 
    762             #        self.shape_indep_list.append(FractalModel) 
    763             self.model_name_list.append(FractalModel.__name__) 
    764         except: 
    765             logging.error(base_message.format(FractalModel.__name__)) 
    766  
    767         try: 
    768             from sas.models.FractalCoreShellModel import FractalCoreShellModel 
    769  
    770             self.model_dictionary[FractalCoreShellModel.__name__] = FractalCoreShellModel 
    771             #        self.shape_indep_list.append(FractalCoreShellModel) 
    772             self.model_name_list.append(FractalCoreShellModel.__name__) 
    773         except: 
    774             logging.error(base_message.format(FractalCoreShellModel.__name__)) 
    775  
    776         try: 
    777             from sas.models.GaussLorentzGelModel import GaussLorentzGelModel 
    778  
    779             self.model_dictionary[GaussLorentzGelModel.__name__] = GaussLorentzGelModel 
    780             #        self.shape_indep_list.append(GaussLorentzGelModel) 
    781             self.model_name_list.append(GaussLorentzGelModel.__name__) 
    782         except: 
    783             logging.error(base_message.format(GaussLorentzGelModel.__name__)) 
    784  
    785         try: 
    786             from sas.models.GuinierModel import GuinierModel 
    787  
    788             self.model_dictionary[GuinierModel.__name__] = GuinierModel 
    789             #        self.shape_indep_list.append(GuinierModel) 
    790             self.model_name_list.append(GuinierModel.__name__) 
    791         except: 
    792             logging.error(base_message.format(GuinierModel.__name__)) 
    793  
    794         try: 
    795             from sas.models.GuinierPorodModel import GuinierPorodModel 
    796  
    797             self.model_dictionary[GuinierPorodModel.__name__] = GuinierPorodModel 
    798             #        self.shape_indep_list.append(GuinierPorodModel) 
    799             self.model_name_list.append(GuinierPorodModel.__name__) 
    800         except: 
    801             logging.error(base_message.format(GuinierPorodModel.__name__)) 
    802  
    803         try: 
    804             from sas.models.LorentzModel import LorentzModel 
    805  
    806             self.model_dictionary[LorentzModel.__name__] = LorentzModel 
    807             #        self.shape_indep_list.append(LorentzModel) 
    808             self.model_name_list.append(LorentzModel.__name__) 
    809         except: 
    810             logging.error(base_message.format(LorentzModel.__name__)) 
    811  
    812         try: 
    813             from sas.models.MassFractalModel import MassFractalModel 
    814  
    815             self.model_dictionary[MassFractalModel.__name__] = MassFractalModel 
    816             #        self.shape_indep_list.append(MassFractalModel) 
    817             self.model_name_list.append(MassFractalModel.__name__) 
    818         except: 
    819             logging.error(base_message.format(MassFractalModel.__name__)) 
    820  
    821         try: 
    822             from sas.models.MassSurfaceFractal import MassSurfaceFractal 
    823  
    824             self.model_dictionary[MassSurfaceFractal.__name__] = MassSurfaceFractal 
    825             #        self.shape_indep_list.append(MassSurfaceFractal) 
    826             self.model_name_list.append(MassSurfaceFractal.__name__) 
    827         except: 
    828             logging.error(base_message.format(MassSurfaceFractal.__name__)) 
    829  
    830         try: 
    831             from sas.models.PeakGaussModel import PeakGaussModel 
    832  
    833             self.model_dictionary[PeakGaussModel.__name__] = PeakGaussModel 
    834             #        self.shape_indep_list.append(PeakGaussModel) 
    835             self.model_name_list.append(PeakGaussModel.__name__) 
    836         except: 
    837             logging.error(base_message.format(PeakGaussModel.__name__)) 
    838  
    839         try: 
    840             from sas.models.PeakLorentzModel import PeakLorentzModel 
    841  
    842             self.model_dictionary[PeakLorentzModel.__name__] = PeakLorentzModel 
    843             #        self.shape_indep_list.append(PeakLorentzModel) 
    844             self.model_name_list.append(PeakLorentzModel.__name__) 
    845         except: 
    846             logging.error(base_message.format(PeakLorentzModel.__name__)) 
    847  
    848         try: 
    849             from sas.models.Poly_GaussCoil import Poly_GaussCoil 
    850  
    851             self.model_dictionary[Poly_GaussCoil.__name__] = Poly_GaussCoil 
    852             #        self.shape_indep_list.append(Poly_GaussCoil) 
    853             self.model_name_list.append(Poly_GaussCoil.__name__) 
    854         except: 
    855             logging.error(base_message.format(Poly_GaussCoil.__name__)) 
    856  
    857         try: 
    858             from sas.models.PolymerExclVolume import PolymerExclVolume 
    859  
    860             self.model_dictionary[PolymerExclVolume.__name__] = PolymerExclVolume 
    861             #        self.shape_indep_list.append(PolymerExclVolume) 
    862             self.model_name_list.append(PolymerExclVolume.__name__) 
    863         except: 
    864             logging.error(base_message.format(PolymerExclVolume.__name__)) 
    865  
    866         try: 
    867             from sas.models.PorodModel import PorodModel 
    868  
    869             self.model_dictionary[PorodModel.__name__] = PorodModel 
    870             #        self.shape_indep_list.append(PorodModel) 
    871             self.model_name_list.append(PorodModel.__name__) 
    872         except: 
    873             logging.error(base_message.format(PorodModel.__name__)) 
    874  
    875         try: 
    876             from sas.models.RPA10Model import RPA10Model 
    877  
    878             self.model_dictionary[RPA10Model.__name__] = RPA10Model 
    879             #        self.shape_indep_list.append(RPA10Model) 
    880             self.multi_func_list.append(RPA10Model) 
    881         except: 
    882             logging.error(base_message.format(RPA10Model.__name__)) 
    883  
    884         try: 
    885             from sas.models.StarPolymer import StarPolymer 
    886  
    887             self.model_dictionary[StarPolymer.__name__] = StarPolymer 
    888             #        self.shape_indep_list.append(StarPolymer) 
    889             self.model_name_list.append(StarPolymer.__name__) 
    890         except: 
    891             logging.error(base_message.format(StarPolymer.__name__)) 
    892  
    893         try: 
    894             from sas.models.SurfaceFractalModel import SurfaceFractalModel 
    895  
    896             self.model_dictionary[SurfaceFractalModel.__name__] = SurfaceFractalModel 
    897             #        self.shape_indep_list.append(SurfaceFractalModel) 
    898             self.model_name_list.append(SurfaceFractalModel.__name__) 
    899         except: 
    900             logging.error(base_message.format(SurfaceFractalModel.__name__)) 
    901  
    902         try: 
    903             from sas.models.TeubnerStreyModel import TeubnerStreyModel 
    904  
    905             self.model_dictionary[TeubnerStreyModel.__name__] = TeubnerStreyModel 
    906             #        self.shape_indep_list.append(TeubnerStreyModel) 
    907             self.model_name_list.append(TeubnerStreyModel.__name__) 
    908         except: 
    909             logging.error(base_message.format(TeubnerStreyModel.__name__)) 
    910  
    911         try: 
    912             from sas.models.TwoLorentzianModel import TwoLorentzianModel 
    913  
    914             self.model_dictionary[TwoLorentzianModel.__name__] = TwoLorentzianModel 
    915             #        self.shape_indep_list.append(TwoLorentzianModel) 
    916             self.model_name_list.append(TwoLorentzianModel.__name__) 
    917         except: 
    918             logging.error(base_message.format(TwoLorentzianModel.__name__)) 
    919  
    920         try: 
    921             from sas.models.TwoPowerLawModel import TwoPowerLawModel 
    922  
    923             self.model_dictionary[TwoPowerLawModel.__name__] = TwoPowerLawModel 
    924             #        self.shape_indep_list.append(TwoPowerLawModel) 
    925             self.model_name_list.append(TwoPowerLawModel.__name__) 
    926         except: 
    927             logging.error(base_message.format(TwoPowerLawModel.__name__)) 
    928  
    929         try: 
    930             from sas.models.UnifiedPowerRgModel import UnifiedPowerRgModel 
    931  
    932             self.model_dictionary[UnifiedPowerRgModel.__name__] = UnifiedPowerRgModel 
    933             #        self.shape_indep_list.append(UnifiedPowerRgModel) 
    934             self.multi_func_list.append(UnifiedPowerRgModel) 
    935         except: 
    936             logging.error(base_message.format(UnifiedPowerRgModel.__name__)) 
    937  
    938         try: 
    939             from sas.models.LineModel import LineModel 
    940  
    941             self.model_dictionary[LineModel.__name__] = LineModel 
    942             #        self.shape_indep_list.append(LineModel) 
    943             self.model_name_list.append(LineModel.__name__) 
    944         except: 
    945             logging.error(base_message.format(LineModel.__name__)) 
    946  
    947         try: 
    948             from sas.models.ReflectivityModel import ReflectivityModel 
    949  
    950             self.model_dictionary[ReflectivityModel.__name__] = ReflectivityModel 
    951             #        self.shape_indep_list.append(ReflectivityModel) 
    952             self.multi_func_list.append(ReflectivityModel) 
    953         except: 
    954             logging.error(base_message.format(ReflectivityModel.__name__)) 
    955  
    956         try: 
    957             from sas.models.ReflectivityIIModel import ReflectivityIIModel 
    958  
    959             self.model_dictionary[ReflectivityIIModel.__name__] = ReflectivityIIModel 
    960             #        self.shape_indep_list.append(ReflectivityIIModel) 
    961             self.multi_func_list.append(ReflectivityIIModel) 
    962         except: 
    963             logging.error(base_message.format(ReflectivityIIModel.__name__)) 
    964  
    965         try: 
    966             from sas.models.GelFitModel import GelFitModel 
    967  
    968             self.model_dictionary[GelFitModel.__name__] = GelFitModel 
    969             #        self.shape_indep_list.append(GelFitModel) 
    970             self.model_name_list.append(GelFitModel.__name__) 
    971         except: 
    972             logging.error(base_message.format(GelFitModel.__name__)) 
    973  
    974         try: 
    975             from sas.models.PringlesModel import PringlesModel 
    976  
    977             self.model_dictionary[PringlesModel.__name__] = PringlesModel 
    978             #        self.shape_indep_list.append(PringlesModel) 
    979             self.model_name_list.append(PringlesModel.__name__) 
    980         except: 
    981             logging.error(base_message.format(PringlesModel.__name__)) 
    982  
    983         try: 
    984             from sas.models.RectangularPrismModel import RectangularPrismModel 
    985  
    986             self.model_dictionary[RectangularPrismModel.__name__] = RectangularPrismModel 
    987             #        self.shape_list.append(RectangularPrismModel) 
    988             self.multiplication_factor.append(RectangularPrismModel) 
    989             self.model_name_list.append(RectangularPrismModel.__name__) 
    990         except: 
    991             logging.error(base_message.format(RectangularPrismModel.__name__)) 
    992  
    993         try: 
    994             from sas.models.RectangularHollowPrismInfThinWallsModel import RectangularHollowPrismInfThinWallsModel 
    995  
    996             self.model_dictionary[RectangularHollowPrismInfThinWallsModel.__name__] = RectangularHollowPrismInfThinWallsModel 
    997             #        self.shape_list.append(RectangularHollowPrismInfThinWallsModel) 
    998             self.multiplication_factor.append(RectangularHollowPrismInfThinWallsModel) 
    999             self.model_name_list.append(RectangularHollowPrismInfThinWallsModel.__name__) 
    1000         except: 
    1001             logging.error(base_message.format(RectangularHollowPrismInfThinWallsModel.__name__)) 
    1002  
    1003         try: 
    1004             from sas.models.RectangularHollowPrismModel import RectangularHollowPrismModel 
    1005  
    1006             self.model_dictionary[RectangularHollowPrismModel.__name__] = RectangularHollowPrismModel 
    1007             #        self.shape_list.append(RectangularHollowPrismModel) 
    1008             self.multiplication_factor.append(RectangularHollowPrismModel) 
    1009             self.model_name_list.append(RectangularHollowPrismModel.__name__) 
    1010         except: 
    1011             logging.error(base_message.format(RectangularHollowPrismModel.__name__)) 
    1012  
    1013         try: 
    1014             from sas.models.MicelleSphCoreModel import MicelleSphCoreModel 
    1015  
    1016             self.model_dictionary[MicelleSphCoreModel.__name__] = MicelleSphCoreModel 
    1017             #        self.shape_list.append(MicelleSphCoreModel) 
    1018             self.multiplication_factor.append(MicelleSphCoreModel) 
    1019             self.model_name_list.append(MicelleSphCoreModel.__name__) 
    1020         except: 
    1021             logging.error(base_message.format(MicelleSphCoreModel.__name__)) 
    1022  
    1023  
    1024  
    1025         #from sas.models.FractalO_Z import FractalO_Z 
    1026         #self.model_dictionary[FractalO_Z.__name__] = FractalO_Z 
    1027         #self.shape_indep_list.append(FractalO_Z) 
    1028         #self.model_name_list.append(FractalO_Z.__name__) 
     301 
     302        #Build list automagically from sasmodels package 
     303        for mod_name in sasmodels.core.list_models(): 
     304            try: 
     305                mod_def = sasmodels.core.load_model_info(mod_name) 
     306                self.model_dictionary[mod_def['name']] = make_class(mod_def,dtype=None,namestyle='name') 
     307                if mod_def['structure_factor'] == True: 
     308                    self.struct_list.append(self.model_dictionary[mod_def['name']]) 
     309                if mod_def['variant_info'] is not None: 
     310                    self.multi_func_list.append(self.model_dictionary[mod_def['name']]) 
     311                else: 
     312                    self.model_name_list.append(mod_def['name']) 
     313                if mod_def['ER'] is not None: 
     314                    self.multiplication_factor.append(self.model_dictionary[mod_def['name']]) 
     315            except: 
     316                logging.info("Problem loading %s model" % mod_name) 
    1029317 
    1030318        #Looking for plugins 
     
    1070358            return {} 
    1071359 
    1072     def pulgins_reset(self): 
     360    def plugins_reset(self): 
    1073361        """ 
    1074362        return a dictionary of model 
     
    1077365        new_plugins = _findModels(dir) 
    1078366        for name, plug in  new_plugins.iteritems(): 
    1079             for stored_name, _ in self.stored_plugins.iteritems(): 
     367            for stored_name, stored_plug in self.stored_plugins.iteritems(): 
    1080368                if name == stored_name: 
    1081369                    del self.stored_plugins[name] 
     
    1089377        return self.model_combobox.get_list() 
    1090378 
    1091 ##   I believe the next four methods are for the old form factor GUI 
    1092 ##   where the dropdown showed a list of categories which then rolled out 
    1093 ##   in a second dropdown to the side. Some testing shows they indeed no longer 
    1094 ##   seem to be called.  If no problems are found during testing of release we 
    1095 ##   can remove this huge chunck of stuff. 
    1096 ## 
    1097 ##   -PDB  April 26, 2014 
    1098  
    1099 #   def populate_menu(self, modelmenu, event_owner): 
    1100 #       """ 
    1101 #       Populate a menu with our models 
    1102 #        
    1103 #       :param id: first menu event ID to use when binding the menu events 
    1104 #       :param modelmenu: wx.Menu object to populate 
    1105 #       :param event_owner: wx object to bind the menu events to 
    1106 #        
    1107 #       :return: the next free event ID following the new menu events 
    1108 #        
    1109 #       """ 
    1110 #  
    1111         ## Fill model lists 
    1112 #        self._getModelList() 
    1113         ## store reference to model menu of guiframe 
    1114 #        self.modelmenu = modelmenu 
    1115         ## guiframe reference 
    1116 #        self.event_owner = event_owner 
    1117  
    1118 #        shape_submenu = wx.Menu() 
    1119 #        shape_indep_submenu = wx.Menu() 
    1120 #        structure_factor = wx.Menu() 
    1121 #        added_models = wx.Menu() 
    1122 #        multip_models = wx.Menu() 
    1123         ## create menu with shape 
    1124 #        self._fill_simple_menu(menuinfo=["Shapes", 
    1125 #                                         shape_submenu, 
    1126 #                                         " simple shape"], 
    1127 #                         list1=self.shape_list) 
    1128  
    1129 #        self._fill_simple_menu(menuinfo=["Shape-Independent", 
    1130 #                                         shape_indep_submenu, 
    1131 #                                         "List of shape-independent models"], 
    1132 #                         list1=self.shape_indep_list) 
    1133  
    1134 #        self._fill_simple_menu(menuinfo=["Structure Factors", 
    1135 #                                         structure_factor, 
    1136 #                                         "List of Structure factors models"], 
    1137 #                                list1=self.struct_list) 
    1138  
    1139 #        self._fill_plugin_menu(menuinfo=["Customized Models", added_models, 
    1140 #                                            "List of additional models"], 
    1141 #                                 list1=self.plugins) 
    1142  
    1143 #        self._fill_menu(menuinfo=["P(Q)*S(Q)", multip_models, 
    1144 #                                  "mulplication of 2 models"], 
    1145 #                                   list1=self.multiplication_factor, 
    1146 #                                   list2=self.struct_list) 
    1147 #        return 0 
    1148  
    1149 #    def _fill_plugin_menu(self, menuinfo, list1): 
    1150 #        """ 
    1151 #        fill the plugin menu with costumized models 
    1152 #        """ 
    1153 #        print ("got to fill plugin menu") 
    1154 #        if len(list1) == 0: 
    1155 #            id = wx.NewId() 
    1156 #            msg = "No model available check plugins.log for errors to fix problem" 
    1157 #            menuinfo[1].Append(int(id), "Empty", msg) 
    1158 #        self._fill_simple_menu(menuinfo, list1) 
    1159  
    1160 #   def _fill_simple_menu(self, menuinfo, list1): 
    1161 #       """ 
    1162 #       Fill the menu with list item 
    1163 #        
    1164 #       :param modelmenu: the menu to fill 
    1165 #       :param menuinfo: submenu item for the first column of this modelmenu 
    1166 #                        with info.Should be a list : 
    1167 #                        [name(string) , menu(wx.menu), help(string)] 
    1168 #       :param list1: contains item (form factor )to fill modelmenu second column 
    1169 #        
    1170 #       """ 
    1171 #       if len(list1) > 0: 
    1172 #           self.model_combobox.set_list(menuinfo[0], list1) 
    1173  
    1174 #            for item in list1: 
    1175 #                try: 
    1176 #                    id = wx.NewId() 
    1177 #                    struct_factor = item() 
    1178 #                    struct_name = struct_factor.__class__.__name__ 
    1179 #                    if hasattr(struct_factor, "name"): 
    1180 #                        struct_name = struct_factor.name 
    1181 #                         
    1182 #                    menuinfo[1].Append(int(id), struct_name, struct_name) 
    1183 #                    if not  item in self.struct_factor_dict.itervalues(): 
    1184 #                        self.struct_factor_dict[str(id)] = item 
    1185 #                    wx.EVT_MENU(self.event_owner, int(id), self._on_model) 
    1186 #                except: 
    1187 #                    msg = "Error Occured: %s" % sys.exc_value 
    1188 #                    wx.PostEvent(self.event_owner, StatusEvent(status=msg)) 
    1189 #                 
    1190 #        id = wx.NewId() 
    1191 #        self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2]) 
    1192 #         
    1193 #    def _fill_menu(self, menuinfo, list1, list2): 
    1194 #        """ 
    1195 #        Fill the menu with list item 
    1196 #         
    1197 #        :param menuinfo: submenu item for the first column of this modelmenu 
    1198 #                         with info.Should be a list : 
    1199 #                         [name(string) , menu(wx.menu), help(string)] 
    1200 #        :param list1: contains item (form factor )to fill modelmenu second column 
    1201 #        :param list2: contains item (Structure factor )to fill modelmenu 
    1202 #                third column 
    1203 #                 
    1204 #        """ 
    1205 #        if len(list1) > 0: 
    1206 #            self.model_combobox.set_list(menuinfo[0], list1) 
    1207 #             
    1208 #            for item in list1: 
    1209 #                form_factor = item() 
    1210 #                form_name = form_factor.__class__.__name__ 
    1211 #                if hasattr(form_factor, "name"): 
    1212 #                    form_name = form_factor.name 
    1213 #                ### store form factor to return to other users 
    1214 #                newmenu = wx.Menu() 
    1215 #                if len(list2) > 0: 
    1216 #                    for model  in list2: 
    1217 #                        id = wx.NewId() 
    1218 #                        struct_factor = model() 
    1219 #                        name = struct_factor.__class__.__name__ 
    1220 #                        if hasattr(struct_factor, "name"): 
    1221 #                            name = struct_factor.name 
    1222 #                        newmenu.Append(id, name, name) 
    1223 #                        wx.EVT_MENU(self.event_owner, int(id), self._on_model) 
    1224 #                        ## save form_fact and struct_fact 
    1225 #                        self.form_factor_dict[int(id)] = [form_factor, 
    1226 #                                                          struct_factor] 
    1227 #                         
    1228 #                form_id = wx.NewId() 
    1229 #                menuinfo[1].AppendMenu(int(form_id), form_name, 
    1230 #                                       newmenu, menuinfo[2]) 
    1231 #        id = wx.NewId() 
    1232 #        self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2]) 
    1233  
    1234379    def _on_model(self, evt): 
    1235380        """ 
     
    1247392            model = self.struct_factor_dict[str(evt.GetId())]() 
    1248393 
    1249         #TODO: investigate why the following two lines were left in the code 
    1250         #      even though the ModelEvent class doesn't exist 
    1251         #evt = ModelEvent(model=model) 
    1252         #wx.PostEvent(self.event_owner, evt) 
    1253394 
    1254395    def _get_multifunc_models(self): 
     
    1324465        return self.__modelmanager.update() 
    1325466 
    1326     def pulgins_reset(self): 
    1327         return self.__modelmanager.pulgins_reset() 
     467    def plugins_reset(self): 
     468        return self.__modelmanager.plugins_reset() 
    1328469 
    1329470    def populate_menu(self, modelmenu, event_owner): 
Note: See TracChangeset for help on using the changeset viewer.