Changes in / [835937b5:cfd27dd] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
raf1187a 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 self.threaded_draw_queue.put([copy.copy(update_chisqr), copy.copy(source)]) 1709 1710 def _threaded_draw_worker(self, threaded_draw_queue): 1711 while True: 1712 # sit and wait for the next task 1713 next_task = threaded_draw_queue.get() 1714 1715 # sleep for 1/10th second in case some other tasks accumulate 1716 time.sleep(0.1) 1717 1718 # skip all intermediate tasks 1719 while self.threaded_draw_queue.qsize() > 0: 1720 self.threaded_draw_queue.task_done() 1721 next_task = self.threaded_draw_queue.get() 1722 1723 # and finally, do the task 1724 self._draw_model_after(*next_task) 1725 threaded_draw_queue.task_done() 1695 wx.CallAfter(self._draw_model_after, update_chisqr, source) 1726 1696 1727 1697 def _draw_model_after(self, update_chisqr=True, source='model'): … … 1746 1716 toggle_mode_on = self.model_view.IsEnabled() 1747 1717 is_2d = self._is_2D() 1748 1749 1718 self._manager.draw_model(self.model, 1750 1719 data=self.data,
Note: See TracChangeset
for help on using the changeset viewer.