Changeset 9c9fae1 in sasview


Ignore:
Timestamp:
Apr 6, 2017 10:03:48 AM (7 months ago)
Author:
Tim Snow <tim.snow@…>
Branches:
py3, ticket-853-fit-gui-to-calc, ticket-869, ticket-887-reorg, ticket-947-sasmodels-docs, unittest-saveload
Children:
d70f6d2
Parents:
07b50df9
Message:

Threaded plot drawing

However, need a status update as it looks like the plot has hung

File:
1 edited

Legend:

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

    r9c0f3c17 r9c9fae1  
    1212import logging 
    1313import traceback 
     14 
     15from Queue import Queue 
     16from threading import Thread 
    1417 
    1518from collections import defaultdict 
     
    239242        self.set_layout() 
    240243 
     244        # Putting matplotlib in the background so as not to hang the interface 
     245        self.threadedDrawQueue = Queue() 
     246 
     247        self.threadedDrawWorker = Thread(target = self._threaded_draw_worker, args = (self.threadedDrawQueue,)) 
     248        self.threadedDrawWorker.setDaemon(True) 
     249        self.threadedDrawWorker.start() 
     250 
     251 
    241252    def set_index_model(self, index): 
    242253        """ 
     
    16911702        :param chisqr: update chisqr value [bool] 
    16921703        """ 
    1693         wx.CallAfter(self._draw_model_after, update_chisqr, source) 
     1704        self.threadedDrawQueue.put([update_chisqr, source]) 
     1705 
     1706    def _threaded_draw_worker(self, threadedDrawQueue): 
     1707        while True: 
     1708            inputVariables = threadedDrawQueue.get() 
     1709            self._draw_model_after(inputVariables[0], inputVariables[1]) 
     1710            self.threadedDrawQueue.task_done() 
    16941711 
    16951712    def _draw_model_after(self, update_chisqr=True, source='model'): 
Note: See TracChangeset for help on using the changeset viewer.