Changeset aac161f1 in sasview for src/sas


Ignore:
Timestamp:
Mar 17, 2016 12:22:35 PM (9 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
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)
Message:

Ticket 411: added stop button to simultaneous fits.

Location:
src/sas/sasgui/perspectives/fitting
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fit_thread.py

    rd85c194 raac161f1  
    9696            #some mssg and reset progress bar. 
    9797 
     98            # Shouldn't this be re-raising? ConsoleUpdate doesn't act on it. 
     99            # raise KeyboardInterrupt 
    98100            if self.handler is not None: 
    99101                self.handler.stop(msg=msg) 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    • Property mode changed from 100644 to 100755
    rd85c194 raac161f1  
    14831483        try: 
    14841484            index = 0 
     1485            # Update potential simfit page(s) 
     1486            if self.sim_page is not None: 
     1487                self.sim_page._on_fit_complete() 
     1488            if self.batch_page: 
     1489                self.batch_page._on_fit_complete() 
     1490            # Update all fit pages 
    14851491            for uid in page_id: 
    14861492                res = result[index] 
  • src/sas/sasgui/perspectives/fitting/simfitpage.py

    rd85c194 raac161f1  
    9191        ## selected mdoel to fit 
    9292        self.model_toFit = [] 
     93        ## Control the fit state 
     94        self.fit_started = False 
    9395        ## number of constraint 
    9496        self.nb_constraint = 0 
     
    423425 
    424426        """ 
     427        if self.fit_started: 
     428            self._stop_fit() 
     429            self.fit_started = False 
     430            return 
     431 
    425432        flag = False 
    426433        # check if the current page a simultaneous fit page or a batch page 
     
    439446                    self.manager.schedule_for_fit(value=1, uid=item[2]) 
    440447            try: 
     448                self.fit_started = True 
     449                wx.CallAfter(self.set_fitbutton) 
    441450                if not self.manager.onFit(uid=self.uid): 
    442451                    return 
     
    447456            msg = "Select at least one model check box to fit " 
    448457            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) 
    449486 
    450487    def _onHelp(self, event): 
Note: See TracChangeset for help on using the changeset viewer.