Changeset aac161f1 in sasview for src/sas/sasgui/perspectives/fitting/simfitpage.py
- Timestamp:
- Mar 17, 2016 12:22:35 PM (9 years ago)
- Branches:
- master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- c10d9d6c
- Parents:
- 261e075
- git-author:
- Piotr Rozyczko <piotr.rozyczko@…> (03/17/16 12:12:28)
- git-committer:
- Piotr Rozyczko <piotr.rozyczko@…> (03/17/16 12:22:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/simfitpage.py
rd85c194 raac161f1 91 91 ## selected mdoel to fit 92 92 self.model_toFit = [] 93 ## Control the fit state 94 self.fit_started = False 93 95 ## number of constraint 94 96 self.nb_constraint = 0 … … 423 425 424 426 """ 427 if self.fit_started: 428 self._stop_fit() 429 self.fit_started = False 430 return 431 425 432 flag = False 426 433 # check if the current page a simultaneous fit page or a batch page … … 439 446 self.manager.schedule_for_fit(value=1, uid=item[2]) 440 447 try: 448 self.fit_started = True 449 wx.CallAfter(self.set_fitbutton) 441 450 if not self.manager.onFit(uid=self.uid): 442 451 return … … 447 456 msg = "Select at least one model check box to fit " 448 457 wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 458 459 def _on_fit_complete(self): 460 """ 461 Set the completion flag and display the updated fit button label. 462 """ 463 self.fit_started = False 464 self.set_fitbutton() 465 466 def _stop_fit(self, event=None): 467 """ 468 Attempt to stop the fitting thread 469 """ 470 if event != None: 471 event.Skip() 472 self.manager.stop_fit(self.uid) 473 self.manager._reset_schedule_problem(value=0) 474 self._on_fit_complete() 475 476 def set_fitbutton(self): 477 """ 478 Set fit button label depending on the fit_started 479 """ 480 label = "Stop" if self.fit_started else "Fit" 481 color = "red" if self.fit_started else "black" 482 483 self.btFit.SetLabel(label) 484 self.btFit.SetForegroundColour(color) 485 self.btFit.Enable(True) 449 486 450 487 def _onHelp(self, event):
Note: See TracChangeset
for help on using the changeset viewer.