Changes in / [658dd57:140159c] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
ra1b8fee ra1b8fee 15 15 import traceback 16 16 17 from Queue import Queue 18 from threading import Thread 17 19 from collections import defaultdict 18 20 from wx.lib.scrolledpanel import ScrolledPanel … … 241 243 self.set_layout() 242 244 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 243 256 def set_index_model(self, index): 244 257 """ … … 1693 1706 :param chisqr: update chisqr value [bool] 1694 1707 """ 1695 wx.CallAfter(self._draw_model_after, update_chisqr, source) 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() 1696 1742 1697 1743 def _draw_model_after(self, update_chisqr=True, source='model'): … … 1716 1762 toggle_mode_on = self.model_view.IsEnabled() 1717 1763 is_2d = self._is_2D() 1764 1718 1765 self._manager.draw_model(self.model, 1719 1766 data=self.data,
Note: See TracChangeset
for help on using the changeset viewer.