| 6 | |
| 7 | |
| 8 | class UISignaler(QThread): |
| 9 | _instance = None |
| 10 | |
| 11 | def __init__(self, parent=None): |
| 12 | QThread.__init__(self, parent) |
| 13 | |
| 14 | @classmethod |
| 15 | def get(cls): |
| 16 | if not cls._instance: |
| 17 | cls._instance = UISignaler() |
| 18 | return cls._instance |
| 19 | |
| 20 | def run(self): |
| 21 | while True: |
| 22 | command, data = queues.UISignalQueue.get() |
| 23 | if command == 'writeNewAddressToTable': |
| 24 | label, address, streamNumber = data |
| 25 | self.emit(SIGNAL( |
| 26 | "writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), label, address, str(streamNumber)) |
| 27 | elif command == 'updateStatusBar': |
| 28 | self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"), data) |
| 29 | elif command == 'updateSentItemStatusByToAddress': |
| 30 | toAddress, message = data |
| 31 | self.emit(SIGNAL( |
| 32 | "updateSentItemStatusByToAddress(PyQt_PyObject,PyQt_PyObject)"), toAddress, message) |
| 33 | elif command == 'updateSentItemStatusByAckdata': |
| 34 | ackData, message = data |
| 35 | self.emit(SIGNAL( |
| 36 | "updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), ackData, message) |
| 37 | elif command == 'displayNewInboxMessage': |
| 38 | inventoryHash, toAddress, fromAddress, subject, body = data |
| 39 | self.emit(SIGNAL( |
| 40 | "displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), |
| 41 | inventoryHash, toAddress, fromAddress, subject, body) |
| 42 | elif command == 'displayNewSentMessage': |
| 43 | toAddress, fromLabel, fromAddress, subject, message, ackdata = data |
| 44 | self.emit(SIGNAL( |
| 45 | "displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), |
| 46 | toAddress, fromLabel, fromAddress, subject, message, ackdata) |
| 47 | elif command == 'updateNetworkStatusTab': |
| 48 | outbound, add, destination = data |
| 49 | self.emit(SIGNAL("updateNetworkStatusTab(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), outbound, add, destination) |
| 50 | elif command == 'updateNumberOfMessagesProcessed': |
| 51 | self.emit(SIGNAL("updateNumberOfMessagesProcessed()")) |
| 52 | elif command == 'updateNumberOfPubkeysProcessed': |
| 53 | self.emit(SIGNAL("updateNumberOfPubkeysProcessed()")) |
| 54 | elif command == 'updateNumberOfBroadcastsProcessed': |
| 55 | self.emit(SIGNAL("updateNumberOfBroadcastsProcessed()")) |
| 56 | elif command == 'setStatusIcon': |
| 57 | self.emit(SIGNAL("setStatusIcon(PyQt_PyObject)"), data) |
| 58 | elif command == 'changedInboxUnread': |
| 59 | self.emit(SIGNAL("changedInboxUnread(PyQt_PyObject)"), data) |
| 60 | elif command == 'rerenderMessagelistFromLabels': |
| 61 | self.emit(SIGNAL("rerenderMessagelistFromLabels()")) |
| 62 | elif command == 'rerenderMessagelistToLabels': |
| 63 | self.emit(SIGNAL("rerenderMessagelistToLabels()")) |
| 64 | elif command == 'rerenderAddressBook': |
| 65 | self.emit(SIGNAL("rerenderAddressBook()")) |