Ignore:
Timestamp:
Apr 25, 2018 2:32:11 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
27689dc
Parents:
01ef3f7
Message:

Code review changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/TabbedModelEditor.py

    r3790f7f r3b8cc00  
    1111from sas.sascalc.fit import models 
    1212 
     13import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    1314from sas.qtgui.Utilities.UI.TabbedModelEditor import Ui_TabbedModelEditor 
    1415from sas.qtgui.Utilities.PluginDefinition import PluginDefinition 
     
    2324    # Signals for intertab communication plugin -> editor 
    2425    def __init__(self, parent=None, edit_only=False): 
    25         super(TabbedModelEditor, self).__init__() 
     26        super(TabbedModelEditor, self).__init__(parent._parent) 
    2627 
    2728        self.parent = parent 
     
    238239        # Run the model test in sasmodels 
    239240        try: 
    240             _ = self.checkModel(full_path) 
     241            _ = GuiUtils.checkModel(full_path) 
    241242        except Exception as ex: 
    242243            msg = "Error building model: "+ str(ex) 
     
    405406 
    406407    @classmethod 
    407     def checkModel(cls, path): 
    408         """ 
    409         Check that the model save in file 'path' can run. 
    410         """ 
    411         # try running the model 
    412         from sasmodels.sasview_model import load_custom_model 
    413         Model = load_custom_model(path) 
    414         model = Model() 
    415         q =  np.array([0.01, 0.1]) 
    416         _ = model.evalDistribution(q) 
    417         qx, qy =  np.array([0.01, 0.01]), np.array([0.1, 0.1]) 
    418         _ = model.evalDistribution([qx, qy]) 
    419  
    420         # check the model's unit tests run 
    421         from sasmodels.model_test import run_one 
    422         # TestSuite module in Qt5 now deletes tests in the suite after running, 
    423         # so suite[0] in run_one() in sasmodels/model_test.py will contain [None] and 
    424         # test.info.tests will raise. 
    425         # Not sure how to change the behaviour here, most likely sasmodels will have to 
    426         # be modified 
    427         result = run_one(path) 
    428  
    429         return result 
    430  
    431     @classmethod 
    432408    def getParamHelper(cls, param_str): 
    433409        """ 
Note: See TracChangeset for help on using the changeset viewer.