Ignore:
Timestamp:
Sep 23, 2017 4:24:27 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
b963b20, fca1f50
Parents:
9706d88 (diff), dba8557 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ticket-887-reorg' into ticket-853-fit-gui-to-calc

File:
1 edited

Legend:

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

    r69363c7 rd3b0c77  
    1212import logging 
    1313import traceback 
     14from Queue import Queue 
     15from threading import Thread 
    1416from collections import defaultdict 
    1517 
     
    248250        self.set_layout() 
    249251 
     252        # Setting up a thread for the fitting 
     253        self.threaded_draw_queue = Queue() 
     254 
     255        self.draw_worker_thread = Thread(target = self._threaded_draw_worker, 
     256                                         args = (self.threaded_draw_queue,)) 
     257        self.draw_worker_thread.setDaemon(True) 
     258        self.draw_worker_thread.start() 
     259 
     260        # And a home for the thread submission times 
     261        self.last_time_fit_submitted = 0.00 
     262 
    250263    def set_index_model(self, index): 
    251264        """ 
     
    17351748        :param chisqr: update chisqr value [bool] 
    17361749        """ 
    1737         wx.CallAfter(self._draw_model_after, update_chisqr, source) 
     1750        self.threaded_draw_queue.put([copy.copy(update_chisqr), copy.copy(source)]) 
     1751 
     1752    def _threaded_draw_worker(self, threaded_draw_queue): 
     1753        while True: 
     1754            # sit and wait for the next task 
     1755            next_task = threaded_draw_queue.get() 
     1756 
     1757            # sleep for 1/10th second in case some other tasks accumulate 
     1758            time.sleep(0.1) 
     1759 
     1760            # skip all intermediate tasks 
     1761            while self.threaded_draw_queue.qsize() > 0: 
     1762                self.threaded_draw_queue.task_done() 
     1763                next_task = self.threaded_draw_queue.get() 
     1764 
     1765            # and finally, do the task 
     1766            self._draw_model_after(*next_task) 
     1767            threaded_draw_queue.task_done() 
    17381768 
    17391769    def _draw_model_after(self, update_chisqr=True, source='model'): 
     
    17571787            toggle_mode_on = self.model_view.IsEnabled() 
    17581788            is_2d = self._is_2D() 
     1789 
    17591790            self._manager.draw_model(self.model, 
    17601791                                     data=self.data, 
Note: See TracChangeset for help on using the changeset viewer.