Made it compatible with gevent 1.0dev version.

This commit is contained in:
linkerlin 2013-06-28 22:26:31 +08:00
parent 284b3a24f7
commit 80e5adad8c

View File

@ -2875,14 +2875,16 @@ class myTableWidgetItem(QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject()) return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
from threading import Thread
class UISignaler(QThread): class UISignaler(Thread,QThread):
def __init__(self, parent=None): def __init__(self, parent=None):
Thread.__init__(self, parent)
QThread.__init__(self, parent) QThread.__init__(self, parent)
def run(self): def run(self):
while True: while True:
try:
command, data = shared.UISignalQueue.get() command, data = shared.UISignalQueue.get()
if command == 'writeNewAddressToTable': if command == 'writeNewAddressToTable':
label, address, streamNumber = data label, address, streamNumber = data
@ -2927,6 +2929,14 @@ class UISignaler(QThread):
else: else:
sys.stderr.write( sys.stderr.write(
'Command sent to UISignaler not recognized: %s\n' % command) 'Command sent to UISignaler not recognized: %s\n' % command)
except Exception,ex:
# uncaught exception will block gevent
import traceback
traceback.print_exc()
traceback.print_stack()
print ex
pass
try: try:
import gevent import gevent
except ImportError as ex: except ImportError as ex: