Changes in / [367a31c:a06ee7e] 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 Queue18 from threading import Thread19 17 from collections import defaultdict 20 18 from wx.lib.scrolledpanel import ScrolledPanel … … 243 241 self.set_layout() 244 242 245 # Setting up a thread for the fitting246 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 times254 self.last_time_fit_submitted = 0.00255 256 243 def set_index_model(self, index): 257 244 """ … … 1706 1693 :param chisqr: update chisqr value [bool] 1707 1694 """ 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) 1742 1696 1743 1697 def _draw_model_after(self, update_chisqr=True, source='model'): … … 1762 1716 toggle_mode_on = self.model_view.IsEnabled() 1763 1717 is_2d = self._is_2D() 1764 1765 1718 self._manager.draw_model(self.model, 1766 1719 data=self.data,
Note: See TracChangeset
for help on using the changeset viewer.