Changeset ded5e77 in sasview
- Timestamp:
- Apr 11, 2018 7:25:45 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:
- a3221b6
- Parents:
- d6e38661
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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):
Note: See TracChangeset
for help on using the changeset viewer.