Changes in / [367a31c:a06ee7e] in sasview


Ignore:
File:
1 edited

Legend:

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

    ra1b8fee ra1b8fee  
    1515import traceback 
    1616 
    17 from Queue import Queue 
    18 from threading import Thread 
    1917from collections import defaultdict 
    2018from wx.lib.scrolledpanel import ScrolledPanel 
     
    243241        self.set_layout() 
    244242 
    245         # Setting up a thread for the fitting 
    246         self.threaded_draw_queue = Queue() 
    247  
    248         self.draw_worker_thread = Thread(target = self._threaded_draw_worker, 
    249                                          args = (self.threaded_draw_queue,)) 
    250         self.draw_worker_thread.setDaemon(True) 
    251         self.draw_worker_thread.start() 
    252  
    253         # And a home for the thread submission times 
    254         self.last_time_fit_submitted = 0.00 
    255  
    256243    def set_index_model(self, index): 
    257244        """ 
     
    17061693        :param chisqr: update chisqr value [bool] 
    17071694        """ 
    1708         # Get the time 
    1709         current_time = time.time() 
    1710  
    1711         # When loading we slam a number of fits through here 
    1712         # let's filter these out to start with 
    1713         if current_time > (self.last_time_fit_submitted + 0.1): 
    1714             # Submitting the rest 
    1715             self.threaded_draw_queue.put([update_chisqr, source]) 
    1716         else: 
    1717             pass 
    1718  
    1719         self.last_time_fit_submitted = current_time 
    1720  
    1721     def _threaded_draw_worker(self, threaded_draw_queue): 
    1722         while True: 
    1723             # Check to see is a manager is running and a calc is running 
    1724             if ((self._manager.calc_1D is not None 
    1725                  and self._manager.calc_1D.isrunning()) or 
    1726                 (self._manager.calc_2D is not None 
    1727                  and self._manager.calc_2D.isrunning())): 
    1728                 # If a manager is running a calculation 
    1729                 # then trim the queue 
    1730                 if self.threaded_draw_queue.qsize() > 1: 
    1731                     for loopIter in range(threaded_draw_queue.qsize() - 1): 
    1732                         dump = self.threaded_draw_queue.get() 
    1733                         self.threaded_draw_queue.task_done() 
    1734             else: 
    1735                 # Otherwise, just run 
    1736                 input_variables = threaded_draw_queue.get() 
    1737                 self._draw_model_after(input_variables[0], input_variables[1]) 
    1738                 event = StatusEvent(status="Computation is in progress...", 
    1739                                     type="progress") 
    1740                 wx.PostEvent(self._manager.parent, event) 
    1741                 threaded_draw_queue.task_done() 
     1695        wx.CallAfter(self._draw_model_after, update_chisqr, source) 
    17421696 
    17431697    def _draw_model_after(self, update_chisqr=True, source='model'): 
     
    17621716            toggle_mode_on = self.model_view.IsEnabled() 
    17631717            is_2d = self._is_2D() 
    1764  
    17651718            self._manager.draw_model(self.model, 
    17661719                                     data=self.data, 
Note: See TracChangeset for help on using the changeset viewer.