Changeset 65f3930 in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Jun 26, 2017 4: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 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/CategoryInstaller.py

    r235f514 r65f3930  
    1919logger = logging.getLogger(__name__) 
    2020 
    21 class CategoryInstaller: 
     21class CategoryInstaller(object): 
    2222    """ 
    2323    Class for making sure all category stuff is installed 
     
    3434        returns the dir where installed_models.txt should be 
    3535        """ 
    36         import sas.sascalc.dataloader.readers 
    37         return sas.sascalc.dataloader.readers.get_data_path() 
    38  
    39     @staticmethod 
    40     def _get_models_py_dir(): 
    41         """ 
    42         returns the dir where models.py should be 
    43         """ 
    44         import sas.sasgui.perspectives.fitting.models 
    45         return sas.sasgui.perspectives.fitting.models.get_model_python_path() 
     36        from sas.sascalc.dataloader.readers import get_data_path 
     37        return get_data_path() 
    4638 
    4739    @staticmethod 
     
    8577        by_model_dict = defaultdict(list) 
    8678        model_enabled_dict = defaultdict(bool) 
    87          
     79 
    8880        for category in master_category_dict: 
    8981            for (model, enabled) in master_category_dict[category]: 
     
    9688    def _regenerate_master_dict(by_model_dict, model_enabled_dict): 
    9789        """ 
    98         regenerates master_category_dict from by_model_dict  
     90        regenerates master_category_dict from by_model_dict 
    9991        and model_enabled_dict 
    10092        returns the master category dictionary 
     
    128120               which are user supplied. 
    129121        """ 
    130         _model_dict = { model.name: model for model in model_list} 
     122        _model_dict = {model.name: model for model in model_list} 
    131123        _model_list = _model_dict.keys() 
    132124 
     
    150142                model_name, enabled = master_category_dict[cat][ind] 
    151143                if model_name not in _model_list: 
    152                     del_name = True  
     144                    del_name = True 
    153145                    try: 
    154146                        by_model_dict.pop(model_name) 
    155147                        model_enabled_dict.pop(model_name) 
    156                     except: 
     148                    except Exception: 
    157149                        logger.error("CategoryInstaller: %s", sys.exc_value) 
    158150                else: 
     
    160152        if del_name or (len(add_list) > 0): 
    161153            for model in add_list: 
    162                 model_enabled_dict[model]= True 
    163                 if _model_dict[model].category is None or len(str(_model_dict[model].category.capitalize())) == 0: 
     154                model_enabled_dict[model] = True 
     155                # TODO: should be:  not _model_dict[model].category 
     156                if (_model_dict[model].category is None 
     157                        or len(str(_model_dict[model].category.capitalize())) == 0): 
    164158                    by_model_dict[model].append('Uncategorized') 
    165159                else: 
Note: See TracChangeset for help on using the changeset viewer.