- Timestamp:
- Apr 25, 2018 6:08:35 AM (7 years ago)
- 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. - Location:
- src/sas/qtgui
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/MainWindow.py
r8ac3551 ra3221b6 50 50 return splashScreen 51 51 52 def run ():52 def run_sasview(): 53 53 app = QApplication([]) 54 54 … … 85 85 86 86 if __name__ == "__main__": 87 run ()87 run_sasview() -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rd6e38661 rded5e77 191 191 self.is_batch_fitting = False 192 192 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 193 197 # Current SasModel in view 194 198 self.kernel_module = None … … 1200 1204 Perform fitting on the current data 1201 1205 """ 1206 if self.fit_started: 1207 self.stopFit() 1208 return 1209 1202 1210 # initialize fitter constants 1203 1211 fit_id = 0 … … 1226 1234 completefn = self.batchFittingCompleted if self.is_batch_fitting else self.fittingCompleted 1227 1235 1228 calc_fit = FitThread(handler=handler,1236 self.calc_fit = FitThread(handler=handler, 1229 1237 fn=fitters, 1230 1238 batch_inputs=batch_inputs, … … 1237 1245 if LocalConfig.USING_TWISTED: 1238 1246 # start the trhrhread with twisted 1239 calc_thread = threads.deferToThread( calc_fit.compute)1247 calc_thread = threads.deferToThread(self.calc_fit.compute) 1240 1248 calc_thread.addCallback(completefn) 1241 1249 calc_thread.addErrback(self.fitFailed) 1242 1250 else: 1243 1251 # 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) 1246 1254 1247 1255 self.communicate.statusBarUpdateSignal.emit('Fitting started...') 1256 self.fit_started = True 1248 1257 # Disable some elements 1249 1258 self.setFittingStarted() 1250 1259 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 1251 1274 def updateFit(self): 1252 1275 """ … … 1258 1281 """ 1259 1282 """ 1260 print("FIT FAILED: ", reason) 1261 pass 1283 self.setFittingStopped() 1284 msg = "Fitting failed with: "+ str(reason) 1285 self.communicate.statusBarUpdateSignal.emit(msg) 1262 1286 1263 1287 def batchFittingCompleted(self, result): … … 1309 1333 1310 1334 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) 1312 1340 self.communicate.statusBarUpdateSignal.emit(msg) 1313 1341 … … 2386 2414 def setFittingStarted(self): 2387 2415 """ 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') 2393 2422 2394 2423 def setFittingStopped(self): 2395 2424 """ 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;}') 2399 2429 self.cmdFit.setText("Fit") 2400 self. cmdFit.setEnabled(True)2430 self.fit_started = False 2401 2431 2402 2432 def readFitPage(self, fp): -
src/sas/qtgui/Utilities/TabbedModelEditor.py
r3b8cc00 r93c79b5 126 126 self.editor_widget.setEnabled(True) 127 127 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) 131 132 132 133 def onModifiedExit(self): -
src/sas/qtgui/GUITests.py
r3b3b40b r01ef3f7 48 48 from Utilities.UnitTesting import PluginDefinitionTest 49 49 from Utilities.UnitTesting import TabbedModelEditorTest 50 from Utilities.UnitTesting import AddMultEditorTest 50 51 51 52 # Unit Testing … … 107 108 unittest.makeSuite(PluginDefinitionTest.PluginDefinitionTest, 'test'), 108 109 unittest.makeSuite(TabbedModelEditorTest.TabbedModelEditorTest,'test'), 110 unittest.makeSuite(AddMultEditorTest.AddMultEditorTest, 'test'), 109 111 110 112 # Calculators -
src/sas/qtgui/MainWindow/GuiManager.py
r8ac3551 r3b8cc00 39 39 from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow 40 40 from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow, DEFAULT_PERSPECTIVE 41 42 from sas.qtgui.Utilities.AddMultEditor import AddMultEditor 41 43 42 44 class Acknowledgements(QDialog, Ui_Acknowledgements): … … 407 409 self._workspace.actionEdit_Custom_Model.triggered.connect(self.actionEdit_Custom_Model) 408 410 self._workspace.actionManage_Custom_Models.triggered.connect(self.actionManage_Custom_Models) 411 self._workspace.actionAddMult_Models.triggered.connect(self.actionAddMult_Models) 409 412 # Window 410 413 self._workspace.actionCascade.triggered.connect(self.actionCascade) … … 681 684 self.model_manager.show() 682 685 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 683 693 #============ ANALYSIS ================= 684 694 def actionFitting(self): -
src/sas/qtgui/MainWindow/UI/MainWindowUI.ui
r8ac3551 r01ef3f7 25 25 <y>0</y> 26 26 <width>915</width> 27 <height>2 6</height>27 <height>22</height> 28 28 </rect> 29 29 </property> … … 111 111 <addaction name="actionEdit_Custom_Model"/> 112 112 <addaction name="actionManage_Custom_Models"/> 113 <addaction name="actionAddMult_Models"/> 113 114 </widget> 114 115 <widget class="QMenu" name="menuWindow"> … … 526 527 </property> 527 528 </action> 529 <action name="actionAddMult_Models"> 530 <property name="text"> 531 <string>Add/Multiply Models</string> 532 </property> 533 </action> 528 534 </widget> 529 535 <resources/> -
src/sas/qtgui/Utilities/GuiUtils.py
rbb57068 r27689dc 10 10 import webbrowser 11 11 import urllib.parse 12 13 import numpy as np 12 14 13 15 warnings.simplefilter("ignore") … … 926 928 input = input.replace(",", "") 927 929 930 def 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 928 957 929 958 def enum(*sequential, **named): -
src/sas/qtgui/Utilities/PluginDefinition.py
r8b480d27 r3b8cc00 58 58 59 59 # Validators 60 #rx = QtCore.QRegExp(r'^[\w,\s-]+$')61 #rx = QtCore.QRegExp("[a-z-A-Z_]+")62 60 rx = QtCore.QRegExp("^[A-Za-z0-9_]*$") 63 61 -
src/sas/qtgui/Utilities/PluginManager.py
r8b480d27 r3b8cc00 19 19 """ 20 20 def __init__(self, parent=None): 21 super(PluginManager, self).__init__( )21 super(PluginManager, self).__init__(parent._parent) 22 22 self.setupUi(self) 23 23
Note: See TracChangeset
for help on using the changeset viewer.