@@ -2875,58 +2875,68 @@ class myTableWidgetItem(QTableWidgetItem):
28752875 def __lt__ (self , other ):
28762876 return int (self .data (33 ).toPyObject ()) < int (other .data (33 ).toPyObject ())
28772877
2878-
2879- class UISignaler (QThread ):
2878+ from threading import Thread
2879+ class UISignaler (Thread , QThread ):
28802880
28812881 def __init__ (self , parent = None ):
2882+ Thread .__init__ (self , parent )
28822883 QThread .__init__ (self , parent )
28832884
28842885 def run (self ):
28852886 while True :
2886- command , data = shared .UISignalQueue .get ()
2887- if command == 'writeNewAddressToTable' :
2888- label , address , streamNumber = data
2889- self .emit (SIGNAL (
2890- "writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ), label , address , str (streamNumber ))
2891- elif command == 'updateStatusBar' :
2892- self .emit (SIGNAL ("updateStatusBar(PyQt_PyObject)" ), data )
2893- elif command == 'updateSentItemStatusByHash' :
2894- hash , message = data
2895- self .emit (SIGNAL (
2896- "updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)" ), hash , message )
2897- elif command == 'updateSentItemStatusByAckdata' :
2898- ackData , message = data
2899- self .emit (SIGNAL (
2900- "updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)" ), ackData , message )
2901- elif command == 'displayNewInboxMessage' :
2902- inventoryHash , toAddress , fromAddress , subject , body = data
2903- self .emit (SIGNAL (
2904- "displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ),
2905- inventoryHash , toAddress , fromAddress , subject , body )
2906- elif command == 'displayNewSentMessage' :
2907- toAddress , fromLabel , fromAddress , subject , message , ackdata = data
2908- self .emit (SIGNAL (
2909- "displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ),
2910- toAddress , fromLabel , fromAddress , subject , message , ackdata )
2911- elif command == 'updateNetworkStatusTab' :
2912- self .emit (SIGNAL ("updateNetworkStatusTab()" ))
2913- elif command == 'incrementNumberOfMessagesProcessed' :
2914- self .emit (SIGNAL ("incrementNumberOfMessagesProcessed()" ))
2915- elif command == 'incrementNumberOfPubkeysProcessed' :
2916- self .emit (SIGNAL ("incrementNumberOfPubkeysProcessed()" ))
2917- elif command == 'incrementNumberOfBroadcastsProcessed' :
2918- self .emit (SIGNAL ("incrementNumberOfBroadcastsProcessed()" ))
2919- elif command == 'setStatusIcon' :
2920- self .emit (SIGNAL ("setStatusIcon(PyQt_PyObject)" ), data )
2921- elif command == 'rerenderInboxFromLabels' :
2922- self .emit (SIGNAL ("rerenderInboxFromLabels()" ))
2923- elif command == 'rerenderSubscriptions' :
2924- self .emit (SIGNAL ("rerenderSubscriptions()" ))
2925- elif command == 'removeInboxRowByMsgid' :
2926- self .emit (SIGNAL ("removeInboxRowByMsgid(PyQt_PyObject)" ), data )
2927- else :
2928- sys .stderr .write (
2929- 'Command sent to UISignaler not recognized: %s\n ' % command )
2887+ try :
2888+ command , data = shared .UISignalQueue .get ()
2889+ if command == 'writeNewAddressToTable' :
2890+ label , address , streamNumber = data
2891+ self .emit (SIGNAL (
2892+ "writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ), label , address , str (streamNumber ))
2893+ elif command == 'updateStatusBar' :
2894+ self .emit (SIGNAL ("updateStatusBar(PyQt_PyObject)" ), data )
2895+ elif command == 'updateSentItemStatusByHash' :
2896+ hash , message = data
2897+ self .emit (SIGNAL (
2898+ "updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)" ), hash , message )
2899+ elif command == 'updateSentItemStatusByAckdata' :
2900+ ackData , message = data
2901+ self .emit (SIGNAL (
2902+ "updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)" ), ackData , message )
2903+ elif command == 'displayNewInboxMessage' :
2904+ inventoryHash , toAddress , fromAddress , subject , body = data
2905+ self .emit (SIGNAL (
2906+ "displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ),
2907+ inventoryHash , toAddress , fromAddress , subject , body )
2908+ elif command == 'displayNewSentMessage' :
2909+ toAddress , fromLabel , fromAddress , subject , message , ackdata = data
2910+ self .emit (SIGNAL (
2911+ "displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)" ),
2912+ toAddress , fromLabel , fromAddress , subject , message , ackdata )
2913+ elif command == 'updateNetworkStatusTab' :
2914+ self .emit (SIGNAL ("updateNetworkStatusTab()" ))
2915+ elif command == 'incrementNumberOfMessagesProcessed' :
2916+ self .emit (SIGNAL ("incrementNumberOfMessagesProcessed()" ))
2917+ elif command == 'incrementNumberOfPubkeysProcessed' :
2918+ self .emit (SIGNAL ("incrementNumberOfPubkeysProcessed()" ))
2919+ elif command == 'incrementNumberOfBroadcastsProcessed' :
2920+ self .emit (SIGNAL ("incrementNumberOfBroadcastsProcessed()" ))
2921+ elif command == 'setStatusIcon' :
2922+ self .emit (SIGNAL ("setStatusIcon(PyQt_PyObject)" ), data )
2923+ elif command == 'rerenderInboxFromLabels' :
2924+ self .emit (SIGNAL ("rerenderInboxFromLabels()" ))
2925+ elif command == 'rerenderSubscriptions' :
2926+ self .emit (SIGNAL ("rerenderSubscriptions()" ))
2927+ elif command == 'removeInboxRowByMsgid' :
2928+ self .emit (SIGNAL ("removeInboxRowByMsgid(PyQt_PyObject)" ), data )
2929+ else :
2930+ sys .stderr .write (
2931+ 'Command sent to UISignaler not recognized: %s\n ' % command )
2932+ except Exception ,ex :
2933+ # uncaught exception will block gevent
2934+ import traceback
2935+ traceback .print_exc ()
2936+ traceback .print_stack ()
2937+ print ex
2938+ pass
2939+
29302940try :
29312941 import gevent
29322942except ImportError as ex :
0 commit comments