Changeset 93c79b5 in sasview


Ignore:
Timestamp:
Apr 25, 2018 4:08:35 AM (7 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:
d4dac80
Parents:
27689dc (diff), 38f838e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ESS_GUI' into ESS_GUI_sum_editor

Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • installers/installer_generator.py

    • Property mode changed from 100755 to 100644
    r0595bb7 r988deab  
    5555        for item in wild_cards: 
    5656            #['All (*.*)|*.*'] 
    57             file_type, ext = string.split(item, "|*", 1) 
     57            file_type, ext = item.split("|*", 1) 
    5858            if ext.strip() not in ['.*', ''] and ext.strip() not in list_data: 
    5959                list_data.append((ext, 'string', file_type)) 
     
    6161        pass 
    6262    try: 
    63         file_type, ext = string.split(local_config.APPLICATION_WLIST, "|*", 1) 
     63        file_type, ext = local_config.APPLICATION_WLIST.split("|*", 1) 
    6464        if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 
    6565            list_app.append((ext, 'string', file_type)) 
     
    6868    try: 
    6969        for item in local_config.PLUGINS_WLIST: 
    70             file_type, ext = string.split(item, "|*", 1) 
     70            file_type, ext = item.split("|*", 1) 
    7171            if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 
    7272                list_app.append((ext, 'string', file_type)) 
     
    8383    msg = "" 
    8484    if data_extension is not None and data_extension: 
     85        msg = "\n\n[Registry]\n" 
    8586        openwithlist = "OpenWithList\%s" % str(APPLICATION) 
    86         msg = "\n\n[Registry]\n" 
    8787        for (ext, type, _) in data_extension: 
    8888            list = os.path.join(ext, openwithlist) 
     
    192192    return msg 
    193193 
    194 dist_path = "dist" 
     194dist_path = "dist\sasview" 
    195195def write_file(): 
    196196    """ 
     
    200200    msg += """Source: "%s\%s";\t""" % (dist_path, str(APPLICATION)) 
    201201    msg += """DestDir: "{app}";\tFlags: ignoreversion\n""" 
    202     msg += """Source: "dist\*";\tDestDir: "{app}";\t""" 
     202    msg += """Source: "dist\sasview\*";\tDestDir: "{app}";\t""" 
    203203    msg += """Flags: ignoreversion recursesubdirs createallsubdirs\n""" 
    204     msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 
     204    msg += """Source: "dist\sasview\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 
    205205    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    206     msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t""" 
    207     msg += """Flags: recursesubdirs createallsubdirs\n""" 
    208     msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t""" 
     206    msg += """Source: "dist\sasview\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t""" 
    209207    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    210208    #msg += """Source: "dist\default_categories.json";    DestDir: "{userdesktop}\..\.sasview";\t""" 
  • run.py

    r4992ff2 ra3221b6  
    151151    logger.debug("Starting SASVIEW in debug mode.") 
    152152    prepare() 
    153     from sas.qtgui.MainWindow.MainWindow import run 
    154     run() 
     153    from sas.qtgui.MainWindow.MainWindow import run_sasview 
     154    run_sasview() 
    155155    logger.debug("Ending SASVIEW in debug mode.") 
  • src/sas/qtgui/MainWindow/MainWindow.py

    r8ac3551 ra3221b6  
    5050    return splashScreen 
    5151 
    52 def run(): 
     52def run_sasview(): 
    5353    app = QApplication([]) 
    5454 
     
    8585 
    8686if __name__ == "__main__": 
    87     run() 
     87    run_sasview() 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    rd6e38661 rded5e77  
    191191        self.is_batch_fitting = False 
    192192        self.is_chain_fitting = False 
     193        # Is the fit job running? 
     194        self.fit_started=False 
     195        # The current fit thread 
     196        self.calc_fit = None 
    193197        # Current SasModel in view 
    194198        self.kernel_module = None 
     
    12001204        Perform fitting on the current data 
    12011205        """ 
     1206        if self.fit_started: 
     1207            self.stopFit() 
     1208            return 
     1209 
    12021210        # initialize fitter constants 
    12031211        fit_id = 0 
     
    12261234        completefn = self.batchFittingCompleted if self.is_batch_fitting else self.fittingCompleted 
    12271235 
    1228         calc_fit = FitThread(handler=handler, 
     1236        self.calc_fit = FitThread(handler=handler, 
    12291237                            fn=fitters, 
    12301238                            batch_inputs=batch_inputs, 
     
    12371245        if LocalConfig.USING_TWISTED: 
    12381246            # start the trhrhread with twisted 
    1239             calc_thread = threads.deferToThread(calc_fit.compute) 
     1247            calc_thread = threads.deferToThread(self.calc_fit.compute) 
    12401248            calc_thread.addCallback(completefn) 
    12411249            calc_thread.addErrback(self.fitFailed) 
    12421250        else: 
    12431251            # Use the old python threads + Queue 
    1244             calc_fit.queue() 
    1245             calc_fit.ready(2.5) 
     1252            self.calc_fit.queue() 
     1253            self.calc_fit.ready(2.5) 
    12461254 
    12471255        self.communicate.statusBarUpdateSignal.emit('Fitting started...') 
     1256        self.fit_started = True 
    12481257        # Disable some elements 
    12491258        self.setFittingStarted() 
    12501259 
     1260    def stopFit(self): 
     1261        """ 
     1262        Attempt to stop the fitting thread 
     1263        """ 
     1264        if self.calc_fit is None or not self.calc_fit.isrunning(): 
     1265            return 
     1266        self.calc_fit.stop() 
     1267        #self.fit_started=False 
     1268        #re-enable the Fit button 
     1269        self.setFittingStopped() 
     1270 
     1271        msg = "Fitting cancelled." 
     1272        self.communicate.statusBarUpdateSignal.emit(msg) 
     1273 
    12511274    def updateFit(self): 
    12521275        """ 
     
    12581281        """ 
    12591282        """ 
    1260         print("FIT FAILED: ", reason) 
    1261         pass 
     1283        self.setFittingStopped() 
     1284        msg = "Fitting failed with: "+ str(reason) 
     1285        self.communicate.statusBarUpdateSignal.emit(msg) 
    12621286 
    12631287    def batchFittingCompleted(self, result): 
     
    13091333 
    13101334        elapsed = result[1] 
    1311         msg = "Fitting completed successfully in: %s s.\n" % GuiUtils.formatNumber(elapsed) 
     1335        if self.calc_fit._interrupting: 
     1336            msg = "Fitting cancelled by user after: %s s." % GuiUtils.formatNumber(elapsed) 
     1337            logging.warning("\n"+msg+"\n") 
     1338        else: 
     1339            msg = "Fitting completed successfully in: %s s." % GuiUtils.formatNumber(elapsed) 
    13121340        self.communicate.statusBarUpdateSignal.emit(msg) 
    13131341 
     
    23862414    def setFittingStarted(self): 
    23872415        """ 
    2388         Set item enablement on fitting start 
    2389         """ 
    2390         #disable the Fit button 
    2391         self.cmdFit.setText('Running...') 
    2392         self.cmdFit.setEnabled(False) 
     2416        Set buttion caption on fitting start 
     2417        """ 
     2418        # Notify the user that fitting is being run 
     2419        # Allow for stopping the job 
     2420        self.cmdFit.setStyleSheet('QPushButton {color: red;}') 
     2421        self.cmdFit.setText('Stop fit') 
    23932422 
    23942423    def setFittingStopped(self): 
    23952424        """ 
    2396         Set item enablement on fitting stop 
    2397         """ 
    2398         #enable the Fit button 
     2425        Set button caption on fitting stop 
     2426        """ 
     2427        # Notify the user that fitting is available 
     2428        self.cmdFit.setStyleSheet('QPushButton {color: black;}') 
    23992429        self.cmdFit.setText("Fit") 
    2400         self.cmdFit.setEnabled(True) 
     2430        self.fit_started = False 
    24012431 
    24022432    def readFitPage(self, fp): 
  • src/sas/qtgui/Utilities/TabbedModelEditor.py

    r3b8cc00 r93c79b5  
    126126        self.editor_widget.setEnabled(True) 
    127127        self.editor_widget.blockSignals(False) 
    128         self.filename, _ = os.path.splitext(os.path.basename(filename)) 
    129  
    130         self.setWindowTitle(self.window_title + " - " + self.filename) 
     128        self.filename = filename 
     129        display_name, _ = os.path.splitext(os.path.basename(filename)) 
     130 
     131        self.setWindowTitle(self.window_title + " - " + display_name) 
    131132 
    132133    def onModifiedExit(self): 
  • 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 
Note: See TracChangeset for help on using the changeset viewer.