Changeset 65f3930 in sasview for src/sas/sascalc/fit


Ignore:
Timestamp:
Jun 26, 2017 6:22:56 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
50fcb09
Parents:
98e3f24
Message:

move models.py to sascalc/fit

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/fit/models.py

    rba8d326 r65f3930  
    1414import py_compile 
    1515import shutil 
     16 
     17from sasmodels.sasview_model import load_custom_model, load_standard_models 
     18 
    1619# Explicitly import from the pluginmodel module so that py2exe 
    1720# places it in the distribution. The Model1DPlugin class is used 
    1821# as the base class of plug-in models. 
    19 from sas.sascalc.fit.pluginmodel import Model1DPlugin 
     22from .pluginmodel import Model1DPlugin 
     23 
    2024from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
    21 from sasmodels.sasview_model import load_custom_model, load_standard_models 
    2225 
    2326logger = logging.getLogger(__name__) 
     
    2831                          "plugins.log") 
    2932PLUGIN_NAME_BASE = '[plug-in] ' 
    30  
    31 def get_model_python_path(): 
    32     """ 
    33     Returns the python path for a model 
    34     """ 
    35     return os.path.dirname(__file__) 
    3633 
    3734 
     
    418415    implement model 
    419416    """ 
    420     __modelmanager = ModelManagerBase() 
    421     cat_model_list = [__modelmanager.model_dictionary[model_name] for model_name \ 
    422                       in __modelmanager.model_dictionary.keys() \ 
    423                       if model_name not in __modelmanager.stored_plugins.keys()] 
    424  
    425     CategoryInstaller.check_install(model_list=cat_model_list) 
     417    base = None  # type: ModelManagerBase() 
     418 
     419    def __init__(self): 
     420        if ModelManager.base is None: 
     421            self.base = ModelManagerBase() 
     422 
     423    def cat_model_list(self): 
     424        models = self.base.model_dictionary 
     425        retval = [model for model_name, model in models.items() 
     426                  if model_name not in self.base.stored_plugins] 
     427        return retval 
     428 
    426429    def findModels(self): 
    427         return self.__modelmanager.findModels() 
     430        return self.base.findModels() 
    428431 
    429432    def _getModelList(self): 
    430         return self.__modelmanager._getModelList() 
     433        return self.base._getModelList() 
    431434 
    432435    def is_changed(self): 
    433         return self.__modelmanager.is_changed() 
     436        return self.base.is_changed() 
    434437 
    435438    def update(self): 
    436         return self.__modelmanager.update() 
     439        return self.base.update() 
    437440 
    438441    def plugins_reset(self): 
    439         return self.__modelmanager.plugins_reset() 
    440  
    441     def populate_menu(self, modelmenu, event_owner): 
    442         return self.__modelmanager.populate_menu(modelmenu, event_owner) 
     442        return self.base.plugins_reset() 
     443 
     444    #def populate_menu(self, modelmenu, event_owner): 
     445    #    return self.base.populate_menu(modelmenu, event_owner) 
    443446 
    444447    def _on_model(self, evt): 
    445         return self.__modelmanager._on_model(evt) 
     448        return self.base._on_model(evt) 
    446449 
    447450    def _get_multifunc_models(self): 
    448         return self.__modelmanager._get_multifunc_models() 
     451        return self.base._get_multifunc_models() 
    449452 
    450453    def get_model_list(self): 
    451         return self.__modelmanager.get_model_list() 
     454        return self.base.get_model_list() 
    452455 
    453456    def get_model_name_list(self): 
    454         return self.__modelmanager.get_model_name_list() 
     457        return self.base.get_model_name_list() 
    455458 
    456459    def get_model_dictionary(self): 
    457         return self.__modelmanager.get_model_dictionary() 
     460        return self.base.get_model_dictionary() 
Note: See TracChangeset for help on using the changeset viewer.