Package Camelot :: Package camelot :: Package view :: Package model_thread :: Class AbstractModelThread
[frames] | no frames]

Class AbstractModelThread

source code


Abstract implementation of a model thread class Thread in which the model runs, all requests to the model should be posted to the the model thread.

This class ensures the gui thread doesn't block when the model needs time to complete tasks by providing asynchronous communication between the model thread and the gui thread

Instance Methods
 
__init__(self, setup_thread=<function setup_model at 0xc217b54>)
@param setup_thread: function to be called at startup of the thread to initialize everything, by default this will setup the model. set to None if nothing should be done.
source code
 
run(self) source code
 
traceback(self)
The formatted traceback of the last exception in the model thread
source code
 
wait_on_work(self)
Wait for all work to be finished, this function should only be used to do unit testing and such, since it will block the calling thread until all work is done
source code
 
post(self, request, response=None, exception=None)
Post a request to the model thread, request should be a function that takes no arguments. The request function will be called within the model thread. When the request is finished, on first occasion, the response function will be called within the gui thread. The response function takes as arguments, the results of the request function. @param request: function to be called within the model thread @param response: a slot that will be called with the result of the request function @param exception: a slot that will be called in case request throws an exception
source code
 
busy(self)
Return True or False indicating wether either the model or the gui thread is doing something
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  thread_busy_signal = '2thread_busy'
Properties

Inherited from object: __class__

Method Details

__init__(self, setup_thread=<function setup_model at 0xc217b54>)
(Constructor)

source code 
@param setup_thread: function to be called at startup of the thread to initialize everything, by default this will setup the model. set to None if nothing should be done.
Overrides: object.__init__