1 '''
2 Created on Sep 12, 2009
3
4 @author: tw55413
5 '''
6
7 import logging
8 logger = logging.getLogger('camelot.view.model_thread.no_thread_model_thread')
9
10 from PyQt4 import QtCore
11 from signal_slot_model_thread import AbstractModelThread, setup_model
12
14
20
23
24 - def post( self, request, response = None, exception = None ):
25 try:
26 result = request()
27 response( result )
28 except Exception, e:
29 if exception:
30 logger.error( 'exception caught in model thread while executing %s'%self._name, exc_info = e )
31 import traceback, cStringIO
32 sio = cStringIO.StringIO()
33 traceback.print_exc(file=sio)
34 traceback_print = sio.getvalue()
35 sio.close()
36 exception_info = (e, traceback_print)
37 exception(exception_info)
38
40 app = QtCore.QCoreApplication.instance()
41 while app.hasPendingEvents():
42 app.processEvents()
43
46