Ignore:
Timestamp:
Sep 4, 2018 10:29:20 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
287d356
Parents:
6b50296
Message:

Make fitting widget understand 'name' attribute on models. SASVIEW-1014

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r6b50296 re3df84e  
    19971997        """ 
    19981998        name = model_name 
     1999        kernel_module = None 
    19992000        if self.cbCategory.currentText() == CATEGORY_CUSTOM: 
    20002001            # custom kernel load requires full path 
     
    20022003        try: 
    20032004            kernel_module = generate.load_kernel_module(name) 
    2004         except ModuleNotFoundError: 
    2005             # maybe it's a recategorised custom model? 
    2006             name = os.path.join(ModelUtilities.find_plugins_dir(), model_name+".py") 
    2007             # If this rises, it's a valid problem. 
    2008             kernel_module = generate.load_kernel_module(name) 
     2005        except ModuleNotFoundError as ex: 
     2006            pass 
     2007 
     2008        if kernel_module is None: 
     2009            # mismatch between "name" attribute and actual filename. 
     2010            curr_model = self.models[model_name] 
     2011            name, _ = os.path.splitext(os.path.basename(curr_model.filename)) 
     2012            try: 
     2013                kernel_module = generate.load_kernel_module(name) 
     2014            except ModuleNotFoundError as ex: 
     2015                logging.error("Can't find the model "+ str(ex)) 
     2016                return 
    20092017 
    20102018        if hasattr(kernel_module, 'parameters'): 
Note: See TracChangeset for help on using the changeset viewer.