Changes in src/sas/perspectives/fitting/models.py [415fb82:f0d720b] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/models.py
r415fb82 rf0d720b 6 6 import os 7 7 import sys 8 import math 8 9 import os.path 9 10 # Time is needed by the log method … … 12 13 import py_compile 13 14 import shutil 15 from sas.guiframe.events import StatusEvent 14 16 # Explicitly import from the pluginmodel module so that py2exe 15 17 # places it in the distribution. The Model1DPlugin class is used 16 18 # as the base class of plug-in models. 17 19 from sas.models.pluginmodel import Model1DPlugin 20 from sas.models.BaseComponent import BaseComponent 18 21 from sas.guiframe.CategoryInstaller import CategoryInstaller 19 22 23 from sasmodels.sasview_model import make_class 24 20 25 PLUGIN_DIR = 'plugin_models' 21 26 … … 314 319 315 320 # regular model names only 316 base_message = "Unable to load model {0}" 317 try: 318 self.model_name_list = [] 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__)) 321 self.model_name_list = [] 322 323 #Build list automagically from sasmodels package 324 import pkgutil 325 from importlib import import_module 326 import sasmodels.models 327 for importer,modname,ispkg in pkgutil.iter_modules(sasmodels.models.__path__): 328 if not ispkg: 329 module = import_module('.'+modname,'sasmodels.models') 330 self.model_dictionary[module.oldname] = make_class(module, dtype='single',namestyle='oldname') 331 self.model_name_list.append(module.oldname) 332 333 334 ### NASTY HACK - Comment out most of these lines as models are added to sasmodels. 335 ### Still need the lines that put models into multiplication etc 336 337 try: 338 # # from sas.models.SphereModel import SphereModel 339 # from sasmodels.models import sphere 340 # SphereModel = make_class(sphere, dtype='single',namestyle='oldname') 341 # self.model_dictionary[SphereModel.__name__] = SphereModel 342 # # self.shape_list.append(SphereModel) 343 self.multiplication_factor.append(SphereModel) 344 # self.model_name_list.append(SphereModel.__name__) 345 except: 346 pass 326 347 327 348 try: … … 1068 1089 new_plugins = _findModels(dir) 1069 1090 for name, plug in new_plugins.iteritems(): 1070 for stored_name, _in self.stored_plugins.iteritems():1091 for stored_name, stored_plug in self.stored_plugins.iteritems(): 1071 1092 if name == stored_name: 1072 1093 del self.stored_plugins[name]
Note: See TracChangeset
for help on using the changeset viewer.