Changes in / [38f838e:93c79b5] in sasview


Ignore:
Location:
src/sas/qtgui
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/GUITests.py

    r3b3b40b r01ef3f7  
    4848from Utilities.UnitTesting import PluginDefinitionTest 
    4949from Utilities.UnitTesting import TabbedModelEditorTest 
     50from Utilities.UnitTesting import AddMultEditorTest 
    5051 
    5152# Unit Testing 
     
    107108        unittest.makeSuite(PluginDefinitionTest.PluginDefinitionTest,  'test'), 
    108109        unittest.makeSuite(TabbedModelEditorTest.TabbedModelEditorTest,'test'), 
     110        unittest.makeSuite(AddMultEditorTest.AddMultEditorTest, 'test'), 
    109111 
    110112        # Calculators 
  • src/sas/qtgui/MainWindow/GuiManager.py

    r8ac3551 r3b8cc00  
    3939from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow 
    4040from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow, DEFAULT_PERSPECTIVE 
     41 
     42from sas.qtgui.Utilities.AddMultEditor import AddMultEditor 
    4143 
    4244class Acknowledgements(QDialog, Ui_Acknowledgements): 
     
    407409        self._workspace.actionEdit_Custom_Model.triggered.connect(self.actionEdit_Custom_Model) 
    408410        self._workspace.actionManage_Custom_Models.triggered.connect(self.actionManage_Custom_Models) 
     411        self._workspace.actionAddMult_Models.triggered.connect(self.actionAddMult_Models) 
    409412        # Window 
    410413        self._workspace.actionCascade.triggered.connect(self.actionCascade) 
     
    681684        self.model_manager.show() 
    682685 
     686    def actionAddMult_Models(self): 
     687        """ 
     688        """ 
     689        # Add Simple Add/Multiply Editor 
     690        self.add_mult_editor = AddMultEditor(self) 
     691        self.add_mult_editor.show() 
     692 
    683693    #============ ANALYSIS ================= 
    684694    def actionFitting(self): 
  • src/sas/qtgui/MainWindow/UI/MainWindowUI.ui

    r8ac3551 r01ef3f7  
    2525     <y>0</y> 
    2626     <width>915</width> 
    27      <height>26</height> 
     27     <height>22</height> 
    2828    </rect> 
    2929   </property> 
     
    111111    <addaction name="actionEdit_Custom_Model"/> 
    112112    <addaction name="actionManage_Custom_Models"/> 
     113    <addaction name="actionAddMult_Models"/> 
    113114   </widget> 
    114115   <widget class="QMenu" name="menuWindow"> 
     
    526527   </property> 
    527528  </action> 
     529  <action name="actionAddMult_Models"> 
     530   <property name="text"> 
     531    <string>Add/Multiply Models</string> 
     532   </property> 
     533  </action> 
    528534 </widget> 
    529535 <resources/> 
  • src/sas/qtgui/Utilities/GuiUtils.py

    rbb57068 r27689dc  
    1010import webbrowser 
    1111import urllib.parse 
     12 
     13import numpy as np 
    1214 
    1315warnings.simplefilter("ignore") 
     
    926928        input = input.replace(",", "") 
    927929 
     930def checkModel(path): 
     931    """ 
     932    Check that the model save in file 'path' can run. 
     933    """ 
     934    # The following return needs to be removed once 
     935    # the unittest related changes in Sasmodels are commited 
     936    return True 
     937    # try running the model 
     938    from sasmodels.sasview_model import load_custom_model 
     939    Model = load_custom_model(path) 
     940    model = Model() 
     941    q =  np.array([0.01, 0.1]) 
     942    _ = model.evalDistribution(q) 
     943    qx, qy =  np.array([0.01, 0.01]), np.array([0.1, 0.1]) 
     944    _ = model.evalDistribution([qx, qy]) 
     945 
     946    # check the model's unit tests run 
     947    from sasmodels.model_test import run_one 
     948    # TestSuite module in Qt5 now deletes tests in the suite after running, 
     949    # so suite[0] in run_one() in sasmodels/model_test.py will contain [None] and 
     950    # test.info.tests will raise. 
     951    # Not sure how to change the behaviour here, most likely sasmodels will have to 
     952    # be modified 
     953    result = run_one(path) 
     954 
     955    return result 
     956 
    928957 
    929958def enum(*sequential, **named): 
  • src/sas/qtgui/Utilities/PluginDefinition.py

    r8b480d27 r3b8cc00  
    5858 
    5959        # Validators 
    60         #rx = QtCore.QRegExp(r'^[\w,\s-]+$') 
    61         #rx = QtCore.QRegExp("[a-z-A-Z_]+") 
    6260        rx = QtCore.QRegExp("^[A-Za-z0-9_]*$") 
    6361 
  • src/sas/qtgui/Utilities/PluginManager.py

    r8b480d27 r3b8cc00  
    1919    """ 
    2020    def __init__(self, parent=None): 
    21         super(PluginManager, self).__init__() 
     21        super(PluginManager, self).__init__(parent._parent) 
    2222        self.setupUi(self) 
    2323 
  • src/sas/qtgui/Utilities/TabbedModelEditor.py

    r38f838e 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 
     
    239240        # Run the model test in sasmodels 
    240241        try: 
    241             _ = self.checkModel(full_path) 
     242            _ = GuiUtils.checkModel(full_path) 
    242243        except Exception as ex: 
    243244            msg = "Error building model: "+ str(ex) 
     
    406407 
    407408    @classmethod 
    408     def checkModel(cls, path): 
    409         """ 
    410         Check that the model save in file 'path' can run. 
    411         """ 
    412         # try running the model 
    413         from sasmodels.sasview_model import load_custom_model 
    414         Model = load_custom_model(path) 
    415         model = Model() 
    416         q =  np.array([0.01, 0.1]) 
    417         _ = model.evalDistribution(q) 
    418         qx, qy =  np.array([0.01, 0.01]), np.array([0.1, 0.1]) 
    419         _ = model.evalDistribution([qx, qy]) 
    420  
    421         # check the model's unit tests run 
    422         from sasmodels.model_test import run_one 
    423         # TestSuite module in Qt5 now deletes tests in the suite after running, 
    424         # so suite[0] in run_one() in sasmodels/model_test.py will contain [None] and 
    425         # test.info.tests will raise. 
    426         # Not sure how to change the behaviour here, most likely sasmodels will have to 
    427         # be modified 
    428         result = run_one(path) 
    429  
    430         return result 
    431  
    432     @classmethod 
    433409    def getParamHelper(cls, param_str): 
    434410        """ 
Note: See TracChangeset for help on using the changeset viewer.