Changeset 51f14603 in sasview for src/sans/data_util/calcthread.py
- Timestamp:
- Apr 3, 2014 11:37:53 AM (11 years ago)
- 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 2f2d9d0
- Parents:
- eea3ffa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/data_util/calcthread.py
r4bae1ef r51f14603 33 33 34 34 When defining the compute() method you need to include code which 35 allows the GUI to run. They are as follows: 36 self.isquit() call frequently to check for interrupts 37 self.update(kw=...) call when the GUI could be updated 38 self.complete(kw=...) call before exiting compute() 35 allows the GUI to run. They are as follows: :: 36 37 self.isquit() # call frequently to check for interrupts 38 self.update(kw=...) # call when the GUI could be updated 39 self.complete(kw=...) # call before exiting compute() 40 39 41 The update() and complete() calls accept field=value keyword 40 42 arguments which are passed to the called function. complete() … … 46 48 of the derived class. 47 49 48 The user of this class will call the following: 49 50 thread = Work(...,kw=...) prepare the work thread.51 thread.queue(...,kw=...) queue a work unit52 thread.requeue(...,kw=...) replace work unit on the end of queue53 thread.reset(...,kw=...) reset the queue to the given work unit54 thread.stop() clear the queue and halt55 thread.interrupt() halt the current work unit but continue56 thread.ready(delay=0.) request an update signal after delay57 thread.isrunning() returns true if compute() is running50 The user of this class will call the following: :: 51 52 thread = Work(...,kw=...) # prepare the work thread. 53 thread.queue(...,kw=...) # queue a work unit 54 thread.requeue(...,kw=...) # replace work unit on the end of queue 55 thread.reset(...,kw=...) # reset the queue to the given work unit 56 thread.stop() # clear the queue and halt 57 thread.interrupt() # halt the current work unit but continue 58 thread.ready(delay=0.) # request an update signal after delay 59 thread.isrunning() # returns true if compute() is running 58 60 59 61 Use queue() when all work must be done. Use requeue() when intermediate … … 63 65 stop() to halt the current and pending computations (e.g., in response to 64 66 a stop button). 65 67 66 68 The methods queue(), requeue() and reset() are proxies for the compute() 67 69 method in the subclass. Look there for a description of the arguments. … … 82 84 should be implemented vary from framework to framework. 83 85 84 For wx, something like the following is needed: 86 For wx, something like the following is needed: :: 85 87 86 88 import wx, wx.lib.newevent
Note: See TracChangeset
for help on using the changeset viewer.